@urun-sh/openai 0.6.45 → 0.6.46

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,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-n3axzdCh.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-n3axzdCh.cjs';
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';
@@ -593,6 +593,19 @@ declare class OpenAIRealtimeConnection<S = unknown> {
593
593
  * the turn is never retried on another session behind the bridge's back —
594
594
  * the only honest moves are to say why and close.
595
595
  */
596
+ /**
597
+ * THE CREDITS CUTOFF TERMINAL CLOSE (2026-11): ONE `error` event naming
598
+ * `insufficient_credits` with the authored caller line, then the 1011
599
+ * close carrying the SAME code as its reason — the wire contract
600
+ * (error-event + close + teardown, the established session-gone shape).
601
+ * The sense SDKs treat this code as TERMINAL: no reconnect, no re-dial —
602
+ * the org is drained, and the redial storm against a drained org (the
603
+ * generic `session_gone` death the DB cut used to surface) is the defect
604
+ * this replaces. No reacquire happens on this connection: the binding's
605
+ * pinned session IS the one that was parked, and nothing re-picks a lane
606
+ * behind the bridge's back.
607
+ */
608
+ private failInsufficientCredits;
596
609
  private failSessionGone;
597
610
  /**
598
611
  * Classify ONE upstream turn failure (the dial throwing, or the stream
@@ -604,6 +617,11 @@ declare class OpenAIRealtimeConnection<S = unknown> {
604
617
  * LOUDLY, pre- or post-content alike — and post-CANCEL alike: the
605
618
  * bridge is orphaned either way, and a cancelled turn must never mute
606
619
  * a dead pinned session (round-1 review, CodeRabbit + Greptile);
620
+ * the ONE special case is the CREDITS CAUSE (the structured park
621
+ * reason `credits_exhausted`, threaded from core Session.onPhase —
622
+ * the platform's own word): the terminal {@link failInsufficientCredits}
623
+ * close, so the client never sees a generic death it would redial
624
+ * into;
607
625
  * - a CANCELLED turn suppresses every OTHER late fault (round-1 review):
608
626
  * `response.cancel` does not abort a pending dial, and the dial's
609
627
  * rejection settles AFTER `cancelled` was set — the lane's pre-#511
@@ -740,7 +758,7 @@ declare function realtimeModelOf(req: IncomingMessage): string | undefined;
740
758
  * and the bridge opens — a refused upgrade admits nothing. On an stt row
741
759
  * the intent is recorded on the binding (a transcription session).
742
760
  */
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>>;
761
+ 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
762
  /**
745
763
  * The LOCAL lane resolver: fixed pooled clients, optional fixed apiKey (the
746
764
  * same shared-secret rule the local Gemini Live lane applies — a mismatched
@@ -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-BXbbnmL2.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-BXbbnmL2.js';
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';
@@ -177,6 +177,8 @@ declare class OpenAIRealtimeConnection<S = unknown> {
177
177
  private doneResponse;
178
178
  private upstreamErrorBody;
179
179
 
180
+
181
+ private failInsufficientCredits;
180
182
  private failSessionGone;
181
183
 
182
184
  private upstreamTurnFault;
@@ -197,7 +199,7 @@ declare class OpenAIRealtimeConnection<S = unknown> {
197
199
 
198
200
  declare function realtimeModelOf(req: IncomingMessage): string | undefined;
199
201
 
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>>;
202
+ 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
203
 
202
204
  declare function fixedClientsResolver(clients: ProxyClients, apiKey?: string, realtimeCompanions?: RealtimeCompanionsFor): {
203
205
  resolve(req: IncomingMessage, signal?: AbortSignal, onAdmission?: RealtimeAdmissionNotifier): Promise<RealtimeBinding<ProxyClients>>;
@@ -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-LNQW3VFC.js";import{a as o,h as t}from"../chunk-X5BLQXHK.js";import"../chunk-64VO62LW.js";import"../chunk-5JTIJPFV.js";import{i as r,j as i}from"../chunk-3QZYIRAL.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};
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-U6TUJPC3.js";import{a as o,h as t}from"../chunk-X5BLQXHK.js";import"../chunk-64VO62LW.js";import"../chunk-2AFSBZLN.js";import{i as r,j as i}from"../chunk-CUO2JOW4.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.45",
3
+ "version": "0.6.46",
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.43"
73
+ "@urun-sh/core": "^0.6.46"
74
74
  },
75
75
  "dependencies": {
76
76
  "@prometheus-io/client": "^0.16.1",