@urun-sh/openai 0.6.45 → 0.6.47
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/{chunk-NUPHEB3L.js → chunk-2KN45E7P.js} +6 -6
- package/dist/{chunk-5JTIJPFV.js → chunk-5D7TVOAX.js} +1 -1
- package/dist/{chunk-3QZYIRAL.js → chunk-C452ZIU5.js} +5 -5
- package/dist/{chunk-ZXQXOEVN.js → chunk-LROCLDDN.js} +2 -2
- package/dist/chunk-P2YVKUSQ.js +66 -0
- package/dist/{chunk-GCQR62TJ.js → chunk-VRNM6ZKU.js} +1 -1
- package/dist/{chunk-BMSZZYSZ.js → chunk-XGAF2NDT.js} +1 -1
- package/dist/{composite-BXbbnmL2.d.ts → composite-D0ivH65M.d.ts} +7 -2
- package/dist/{composite-n3axzdCh.d.cts → composite-QilJ-Faj.d.cts} +25 -2
- package/dist/hosted/bin.cjs +48 -48
- package/dist/hosted/bin.js +1 -1
- package/dist/hosted/index.cjs +45 -45
- package/dist/hosted/index.d.cts +1 -1
- package/dist/hosted/index.d.ts +1 -1
- package/dist/hosted/index.js +1 -1
- package/dist/pi-extension/index.js +1 -1
- package/dist/pooler/bin.cjs +5 -5
- package/dist/pooler/bin.js +1 -1
- package/dist/proxy/cli.cjs +54 -54
- package/dist/proxy/cli.js +1 -1
- package/dist/proxy/index.cjs +33 -33
- package/dist/proxy/index.d.cts +57 -8
- package/dist/proxy/index.d.ts +16 -3
- package/dist/proxy/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-LNQW3VFC.js +0 -66
package/dist/proxy/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Server, IncomingMessage } from 'node:http';
|
|
2
|
-
import { h as ProxyHandlerOptions, P as ProxyClients, l as RealtimeCompanionsFor, k as RealtimeBinding, R as RealtimeAdmissionNotifier } from '../composite-
|
|
3
|
-
export { D as DialObserver, a as DialReport, O as OPENAI_REALTIME_PATH, f as OpenAIRealtimeOptions, g as OpenAIRealtimeResolver, i as ProxyIdentity, j as ProxyVideoOutLane, S as SessionGoneError, U as UnknownModelError, o as attachOpenAIRealtime } from '../composite-
|
|
2
|
+
import { h as ProxyHandlerOptions, P as ProxyClients, l as RealtimeCompanionsFor, k as RealtimeBinding, R as RealtimeAdmissionNotifier } from '../composite-QilJ-Faj.cjs';
|
|
3
|
+
export { D as DialObserver, a as DialReport, O as OPENAI_REALTIME_PATH, f as OpenAIRealtimeOptions, g as OpenAIRealtimeResolver, i as ProxyIdentity, j as ProxyVideoOutLane, S as SessionGoneError, U as UnknownModelError, o as attachOpenAIRealtime } from '../composite-QilJ-Faj.cjs';
|
|
4
4
|
export { h as GEMINI_LIVE_PATH, V as VIDEO_OUT_SETUP_KEY } from '../translator-C6MpaZS-.cjs';
|
|
5
5
|
import { WebSocket } from 'ws';
|
|
6
6
|
import '../models-D7F0bLJ3.cjs';
|
|
@@ -300,6 +300,8 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
300
300
|
private readonly operatorLog;
|
|
301
301
|
/** The turn-stall bound in ms (see {@link REALTIME_TURN_STALL_MS}). */
|
|
302
302
|
private readonly turnStallMs;
|
|
303
|
+
/** The whole-response lifetime bound in ms (see {@link REALTIME_RESPONSE_DEADLINE_MS}). */
|
|
304
|
+
private readonly responseDeadlineMs;
|
|
303
305
|
private config;
|
|
304
306
|
private readonly sessionId;
|
|
305
307
|
private readonly conversationId;
|
|
@@ -332,6 +334,17 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
332
334
|
*/
|
|
333
335
|
private turnCancelled;
|
|
334
336
|
private wakeTurnCancelled;
|
|
337
|
+
/**
|
|
338
|
+
* The DIAL gate: cuts a pending upstream dial — but ONLY for the lifetime
|
|
339
|
+
* deadline and socket teardown. `response.cancel` deliberately does NOT
|
|
340
|
+
* abort a pending dial (the ENG-446 ruling: the dial's own settlement
|
|
341
|
+
* speaks, `response.cancelled` rides its `inFlight.finally`) — only the
|
|
342
|
+
* two no-requester-left cases cut it.
|
|
343
|
+
*/
|
|
344
|
+
private turnDialGate;
|
|
345
|
+
private wakeTurnDialGate;
|
|
346
|
+
/** Set when the response's LIFETIME deadline fired (vs a client `response.cancel`) — the body's cut-through exit ends the turn `incomplete` instead of `cancelled`. */
|
|
347
|
+
private deadlineFired;
|
|
335
348
|
/** Output events already flowed for the active response (post-flush faults → error event, pre-flush → response.failed). */
|
|
336
349
|
private responseFlushed;
|
|
337
350
|
private cancelled;
|
|
@@ -409,6 +422,14 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
409
422
|
* default.
|
|
410
423
|
*/
|
|
411
424
|
turnStallMs?: number;
|
|
425
|
+
/**
|
|
426
|
+
* The whole-response lifetime bound in ms (see
|
|
427
|
+
* {@link REALTIME_RESPONSE_DEADLINE_MS}): a turn whose source never
|
|
428
|
+
* yields AND never ends is cut through at the deadline and ends
|
|
429
|
+
* VISIBLY (`response.done` status `incomplete`). `0` disables. Tests
|
|
430
|
+
* shrink it; prod rides the default.
|
|
431
|
+
*/
|
|
432
|
+
responseDeadlineMs?: number;
|
|
412
433
|
});
|
|
413
434
|
/**
|
|
414
435
|
* Consume the backend's OWN turn/transcript lane (§5 stt stream): the
|
|
@@ -593,6 +614,19 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
593
614
|
* the turn is never retried on another session behind the bridge's back —
|
|
594
615
|
* the only honest moves are to say why and close.
|
|
595
616
|
*/
|
|
617
|
+
/**
|
|
618
|
+
* THE CREDITS CUTOFF TERMINAL CLOSE (2026-11): ONE `error` event naming
|
|
619
|
+
* `insufficient_credits` with the authored caller line, then the 1011
|
|
620
|
+
* close carrying the SAME code as its reason — the wire contract
|
|
621
|
+
* (error-event + close + teardown, the established session-gone shape).
|
|
622
|
+
* The sense SDKs treat this code as TERMINAL: no reconnect, no re-dial —
|
|
623
|
+
* the org is drained, and the redial storm against a drained org (the
|
|
624
|
+
* generic `session_gone` death the DB cut used to surface) is the defect
|
|
625
|
+
* this replaces. No reacquire happens on this connection: the binding's
|
|
626
|
+
* pinned session IS the one that was parked, and nothing re-picks a lane
|
|
627
|
+
* behind the bridge's back.
|
|
628
|
+
*/
|
|
629
|
+
private failInsufficientCredits;
|
|
596
630
|
private failSessionGone;
|
|
597
631
|
/**
|
|
598
632
|
* Classify ONE upstream turn failure (the dial throwing, or the stream
|
|
@@ -604,6 +638,11 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
604
638
|
* LOUDLY, pre- or post-content alike — and post-CANCEL alike: the
|
|
605
639
|
* bridge is orphaned either way, and a cancelled turn must never mute
|
|
606
640
|
* a dead pinned session (round-1 review, CodeRabbit + Greptile);
|
|
641
|
+
* the ONE special case is the CREDITS CAUSE (the structured park
|
|
642
|
+
* reason `credits_exhausted`, threaded from core Session.onPhase —
|
|
643
|
+
* the platform's own word): the terminal {@link failInsufficientCredits}
|
|
644
|
+
* close, so the client never sees a generic death it would redial
|
|
645
|
+
* into;
|
|
607
646
|
* - a CANCELLED turn suppresses every OTHER late fault (round-1 review):
|
|
608
647
|
* `response.cancel` does not abort a pending dial, and the dial's
|
|
609
648
|
* rejection settles AFTER `cancelled` was set — the lane's pre-#511
|
|
@@ -627,11 +666,21 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
627
666
|
private upstreamTurnFault;
|
|
628
667
|
private emitUpstreamFault;
|
|
629
668
|
/**
|
|
630
|
-
*
|
|
631
|
-
*
|
|
632
|
-
*
|
|
633
|
-
*
|
|
634
|
-
*
|
|
669
|
+
* Cut the in-flight turn through the waits `response.cancel` cuts — the
|
|
670
|
+
* stream waits racing the cancel gate, the composite tts leg, the
|
|
671
|
+
* transcript park. `cutDial` extends the cut to a PENDING upstream dial:
|
|
672
|
+
* only the lifetime deadline and socket teardown do that (an orphaned
|
|
673
|
+
* response must not outlive its requester); a client `response.cancel`
|
|
674
|
+
* deliberately leaves the dial to settle on its own (the ENG-446 ruling —
|
|
675
|
+
* its own settlement speaks, `response.cancelled` rides its
|
|
676
|
+
* `inFlight.finally`).
|
|
677
|
+
*/
|
|
678
|
+
private cutThroughTurnWaits;
|
|
679
|
+
/**
|
|
680
|
+
* Cancel the in-flight response. The turn is cut through the cancel gate
|
|
681
|
+
* (above); the turn body's catch takes the cancelled exit — the partial
|
|
682
|
+
* output is NEVER adopted into the transcript — and this method's
|
|
683
|
+
* `inFlight.finally` below emits `response.cancelled`.
|
|
635
684
|
*/
|
|
636
685
|
private cancelResponse;
|
|
637
686
|
private pushItem;
|
|
@@ -740,7 +789,7 @@ declare function realtimeModelOf(req: IncomingMessage): string | undefined;
|
|
|
740
789
|
* and the bridge opens — a refused upgrade admits nothing. On an stt row
|
|
741
790
|
* the intent is recorded on the binding (a transcription session).
|
|
742
791
|
*/
|
|
743
|
-
declare function realtimeBindingFor(clients: Pick<ProxyClients, 'sessionHandle' | 'createResponseOn'> & Partial<Pick<ProxyClients, 'supportsAudio' | 'openAudioOn' | 'openVideoOn' | 'supportsTranscription' | 'openTurnsOn' | 'transcriptStreamFor' | 'realtimeCompanionsFor' | 'releaseSessionHandle' | 'dedicatedSessionHandle' | 'endDedicatedSession' | 'realtimeBillingIdentityFor'>>, model: string | undefined, signal?: AbortSignal, intent?: string, onAdmission?: RealtimeAdmissionNotifier): Promise<RealtimeBinding<ProxyClients>>;
|
|
792
|
+
declare function realtimeBindingFor(clients: Pick<ProxyClients, 'sessionHandle' | 'createResponseOn'> & Partial<Pick<ProxyClients, 'supportsAudio' | 'openAudioOn' | 'openVideoOn' | 'supportsTranscription' | 'openTurnsOn' | 'transcriptStreamFor' | 'realtimeCompanionsFor' | 'releaseSessionHandle' | 'dedicatedSessionHandle' | 'endDedicatedSession' | 'onSessionEnd' | 'realtimeBillingIdentityFor'>>, model: string | undefined, signal?: AbortSignal, intent?: string, onAdmission?: RealtimeAdmissionNotifier): Promise<RealtimeBinding<ProxyClients>>;
|
|
744
793
|
/**
|
|
745
794
|
* The LOCAL lane resolver: fixed pooled clients, optional fixed apiKey (the
|
|
746
795
|
* same shared-secret rule the local Gemini Live lane applies — a mismatched
|
package/dist/proxy/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Server, IncomingMessage } from 'node:http';
|
|
2
|
-
import { h as ProxyHandlerOptions, P as ProxyClients, l as RealtimeCompanionsFor, k as RealtimeBinding, R as RealtimeAdmissionNotifier } from '../composite-
|
|
3
|
-
export { D as DialObserver, a as DialReport, O as OPENAI_REALTIME_PATH, f as OpenAIRealtimeOptions, g as OpenAIRealtimeResolver, i as ProxyIdentity, j as ProxyVideoOutLane, S as SessionGoneError, U as UnknownModelError, o as attachOpenAIRealtime } from '../composite-
|
|
2
|
+
import { h as ProxyHandlerOptions, P as ProxyClients, l as RealtimeCompanionsFor, k as RealtimeBinding, R as RealtimeAdmissionNotifier } from '../composite-D0ivH65M.js';
|
|
3
|
+
export { D as DialObserver, a as DialReport, O as OPENAI_REALTIME_PATH, f as OpenAIRealtimeOptions, g as OpenAIRealtimeResolver, i as ProxyIdentity, j as ProxyVideoOutLane, S as SessionGoneError, U as UnknownModelError, o as attachOpenAIRealtime } from '../composite-D0ivH65M.js';
|
|
4
4
|
export { h as GEMINI_LIVE_PATH, V as VIDEO_OUT_SETUP_KEY } from '../translator-CaOqL-V8.js';
|
|
5
5
|
import { WebSocket } from 'ws';
|
|
6
6
|
import '../models-D7F0bLJ3.js';
|
|
@@ -65,6 +65,8 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
65
65
|
private readonly operatorLog;
|
|
66
66
|
|
|
67
67
|
private readonly turnStallMs;
|
|
68
|
+
|
|
69
|
+
private readonly responseDeadlineMs;
|
|
68
70
|
private config;
|
|
69
71
|
private readonly sessionId;
|
|
70
72
|
private readonly conversationId;
|
|
@@ -84,6 +86,11 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
84
86
|
private turnCancelled;
|
|
85
87
|
private wakeTurnCancelled;
|
|
86
88
|
|
|
89
|
+
private turnDialGate;
|
|
90
|
+
private wakeTurnDialGate;
|
|
91
|
+
|
|
92
|
+
private deadlineFired;
|
|
93
|
+
|
|
87
94
|
private responseFlushed;
|
|
88
95
|
private cancelled;
|
|
89
96
|
|
|
@@ -119,6 +126,8 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
119
126
|
operatorLog?: (line: string) => void;
|
|
120
127
|
|
|
121
128
|
turnStallMs?: number;
|
|
129
|
+
|
|
130
|
+
responseDeadlineMs?: number;
|
|
122
131
|
});
|
|
123
132
|
|
|
124
133
|
private startTurnLane;
|
|
@@ -177,11 +186,15 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
177
186
|
private doneResponse;
|
|
178
187
|
private upstreamErrorBody;
|
|
179
188
|
|
|
189
|
+
|
|
190
|
+
private failInsufficientCredits;
|
|
180
191
|
private failSessionGone;
|
|
181
192
|
|
|
182
193
|
private upstreamTurnFault;
|
|
183
194
|
private emitUpstreamFault;
|
|
184
195
|
|
|
196
|
+
private cutThroughTurnWaits;
|
|
197
|
+
|
|
185
198
|
private cancelResponse;
|
|
186
199
|
private pushItem;
|
|
187
200
|
|
|
@@ -197,7 +210,7 @@ declare class OpenAIRealtimeConnection<S = unknown> {
|
|
|
197
210
|
|
|
198
211
|
declare function realtimeModelOf(req: IncomingMessage): string | undefined;
|
|
199
212
|
|
|
200
|
-
declare function realtimeBindingFor(clients: Pick<ProxyClients, 'sessionHandle' | 'createResponseOn'> & Partial<Pick<ProxyClients, 'supportsAudio' | 'openAudioOn' | 'openVideoOn' | 'supportsTranscription' | 'openTurnsOn' | 'transcriptStreamFor' | 'realtimeCompanionsFor' | 'releaseSessionHandle' | 'dedicatedSessionHandle' | 'endDedicatedSession' | 'realtimeBillingIdentityFor'>>, model: string | undefined, signal?: AbortSignal, intent?: string, onAdmission?: RealtimeAdmissionNotifier): Promise<RealtimeBinding<ProxyClients>>;
|
|
213
|
+
declare function realtimeBindingFor(clients: Pick<ProxyClients, 'sessionHandle' | 'createResponseOn'> & Partial<Pick<ProxyClients, 'supportsAudio' | 'openAudioOn' | 'openVideoOn' | 'supportsTranscription' | 'openTurnsOn' | 'transcriptStreamFor' | 'realtimeCompanionsFor' | 'releaseSessionHandle' | 'dedicatedSessionHandle' | 'endDedicatedSession' | 'onSessionEnd' | 'realtimeBillingIdentityFor'>>, model: string | undefined, signal?: AbortSignal, intent?: string, onAdmission?: RealtimeAdmissionNotifier): Promise<RealtimeBinding<ProxyClients>>;
|
|
201
214
|
|
|
202
215
|
declare function fixedClientsResolver(clients: ProxyClients, apiKey?: string, realtimeCompanions?: RealtimeCompanionsFor): {
|
|
203
216
|
resolve(req: IncomingMessage, signal?: AbortSignal, onAdmission?: RealtimeAdmissionNotifier): Promise<RealtimeBinding<ProxyClients>>;
|
package/dist/proxy/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as I,a as n,b as p,c as m,k as l,l as a,m as x,o as s,r as O,s as f}from"../chunk-
|
|
1
|
+
import{F as I,a as n,b as p,c as m,k as l,l as a,m as x,o as s,r as O,s as f}from"../chunk-P2YVKUSQ.js";import{a as o,h as t}from"../chunk-X5BLQXHK.js";import"../chunk-64VO62LW.js";import"../chunk-5D7TVOAX.js";import{i as r,j as i}from"../chunk-C452ZIU5.js";import{c as e}from"../chunk-YSFSRI3D.js";e();export{o as GEMINI_LIVE_PATH,a as OPENAI_REALTIME_PATH,l as OpenAIRealtimeConnection,n as ResumptionRegistry,i as SessionGoneError,r as UnknownModelError,t as VIDEO_OUT_SETUP_KEY,p as attachGeminiLive,x as attachOpenAIRealtime,I as createOpenAIProxy,f as fixedClientsResolver,O as realtimeBindingFor,s as realtimeModelOf,m as serveGeminiLiveSocket};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@urun-sh/openai",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.47",
|
|
4
4
|
"description": "OpenAI-compatible Realtime + Responses SDK over uRun session primitives (not websockets).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"build:bin": "bun build --compile --external @roamhq/wrtc src/proxy/bin.ts --outfile dist/bin/urun-openai && node scripts/assert-bin-transport.mjs"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@urun-sh/core": "^0.6.
|
|
73
|
+
"@urun-sh/core": "^0.6.47"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@prometheus-io/client": "^0.16.1",
|