@urun-sh/openai 0.6.51 → 0.6.53

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-D7icObdD.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-D7icObdD.cjs';
2
+ import { h as ProxyHandlerOptions, P as ProxyClients, l as RealtimeCompanionsFor, k as RealtimeBinding, R as RealtimeAdmissionNotifier } from '../composite-4ppY0Kv6.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-4ppY0Kv6.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';
@@ -310,6 +310,8 @@ declare class OpenAIRealtimeConnection<S = unknown> {
310
310
  * Each chunk may carry the client's `capture_wall_ms` staleness stamp (optional; absent = unstamped). */
311
311
  private pendingAudioBytes;
312
312
  private pendingAudioTotalBytes;
313
+ /** Once-per-connection flag for the past-the-bound shed log (the hold's loud mark). */
314
+ private heldShedWarned;
313
315
  /**
314
316
  * The rt-video-in media lane (the binding's video seam), opened LAZILY on
315
317
  * the first `input_image` frame (the Gemini Live pattern) and cached for
@@ -345,6 +347,28 @@ declare class OpenAIRealtimeConnection<S = unknown> {
345
347
  private wakeTurnDialGate;
346
348
  /** 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
349
  private deadlineFired;
350
+ /**
351
+ * Set when THIS adapter's own seam ended the turn — the lifetime deadline
352
+ * (`'deadline'`) or the turn-stall bound (`'stall'`) — as opposed to the
353
+ * upstream finishing naturally or the client cancelling. The turn body's
354
+ * finally consults it for the standing-cadence auto-continue (the
355
+ * continuous decision stream must not go dark because a backstop fired;
356
+ * the 2026-11-18 32-session hold lost every session past 300 s to exactly
357
+ * this). Reset at each {@link startResponse}.
358
+ */
359
+ private seamEndedTurn;
360
+ /** Set by a client `response.cancel` — the auto-continue must never fight an explicit cancel. */
361
+ private clientCancel;
362
+ /** Consecutive seam-ended turns with no delivered content (see {@link SEAM_END_EMPTY_LIMIT}). */
363
+ private seamEmptyStreak;
364
+ /** Any upstream OUTPUT flowed for the active turn — audio deltas included (the streak's content test). */
365
+ private turnOutputFlowed;
366
+ /** The in-flight turn was opened by the standing-cadence continuation, not by a client `response.create`. */
367
+ private continuationTurnInFlight;
368
+ /** The response params of the most recent client `response.create` — the continuation carries them over. */
369
+ private lastTurnParams;
370
+ /** Once-per-connection log for a client create colliding with the continuation turn. */
371
+ private collidingCreateWarned;
348
372
  /** Output events already flowed for the active response (post-flush faults → error event, pre-flush → response.failed). */
349
373
  private responseFlushed;
350
374
  private cancelled;
@@ -358,6 +382,10 @@ declare class OpenAIRealtimeConnection<S = unknown> {
358
382
  private audioLaneOwner;
359
383
  private audioUnsubscribe;
360
384
  private outOfTurnAudioWarned;
385
+ /** Contiguous quiet-track audio (ms) inside the open duplex reply. */
386
+ private duplexSilenceMs;
387
+ /** Transcript length when the open duplex reply opened (its output boundary). */
388
+ private duplexInputCount;
361
389
  private audioOnlyTranscriptGapWarned;
362
390
  private closed;
363
391
  /** The backend's turn/transcript lane consumer (binding.turns), if wired. */
@@ -536,6 +564,40 @@ declare class OpenAIRealtimeConnection<S = unknown> {
536
564
  private stallBoundedTurn;
537
565
  private upstreamStream;
538
566
  private startResponse;
567
+ /**
568
+ * THE STANDING-CADENCE CONTINUATION (prod 2026-11-18, the 32×15 min hold:
569
+ * 13 of 26 sessions dead by ~10.5 min): a session running the standing
570
+ * decision schema (the Sense continuous-streaming contract) must not go
571
+ * dark because one of THIS adapter's own backstops ended the turn. The
572
+ * lifetime deadline (300 s) and the turn-stall bound both end the turn
573
+ * VISIBLY on the assumption that "the client's own re-open resumes the
574
+ * loop" — but the GA contract puts re-open on the CLIENT, a client that
575
+ * streams continuously never sends one, and the hub's fallback (lane
576
+ * re-dial replaying the original `response.create`) costs a 15 s dead gap
577
+ * (REARM_MIN_INTERVAL_MS) plus a fresh member whose conversation context
578
+ * is empty. When the seam end was OURS (not a client cancel, not a normal
579
+ * upstream completion) and the session is a standing-cadence session with
580
+ * the client still attached, re-open the turn HERE: same member, no gap,
581
+ * held audio state untouched. Self-limiting: a dead upstream re-arms at
582
+ * worst once per stall/deadline period, never a hot loop.
583
+ */
584
+ private maybeAutoContinue;
585
+ /**
586
+ * The bounded dead-member terminal: the client gets a loud `error` event
587
+ * naming `member_unresponsive` (the SDKs parse it, the bench/real clients
588
+ * fail the session on it) and the socket closes — never a silent
589
+ * forever-idle stream.
590
+ */
591
+ private failMemberUnresponsive;
592
+ /**
593
+ * True when the session's instructions carry the standing decision schema
594
+ * (the cadence contract: a JSON object with `questions`/`question` and an
595
+ * `hz`/`cadence_ms` — exactly what {@link withRealtimeCadenceDefault}
596
+ * stamps and what the Sense/realtime clients send). Plain-text
597
+ * instructions and non-cadence JSON never auto-continue: a normal
598
+ * voice/chat turn belongs to the client or the VAD, not to a backstop.
599
+ */
600
+ private isStandingCadenceSession;
539
601
  /**
540
602
  * The composite turn's tts-leg control keys (ENG-451): the effective
541
603
  * output-modality ask — the turn's `output_modalities`/`modalities` when it
@@ -559,6 +621,10 @@ declare class OpenAIRealtimeConnection<S = unknown> {
559
621
  * `out_of_turn_audio` error that caught the speak-lane bug class.
560
622
  */
561
623
  private onOutputAudioFrame;
624
+ /** Open a server-initiated reply for duplex engine speech (no upstream turn). */
625
+ private openDuplexResponse;
626
+ /** Close the open duplex reply: its audio item, then `response.done`. */
627
+ private closeDuplexResponse;
562
628
  /** One assistant message item per turn (text and audio parts share it). */
563
629
  private messageItemAdded;
564
630
  /** true when an audio delta opened the message item this turn. */
@@ -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-DyRe-KRu.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-DyRe-KRu.js';
2
+ import { h as ProxyHandlerOptions, P as ProxyClients, l as RealtimeCompanionsFor, k as RealtimeBinding, R as RealtimeAdmissionNotifier } from '../composite-BKEde6hP.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-BKEde6hP.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';
@@ -75,6 +75,8 @@ declare class OpenAIRealtimeConnection<S = unknown> {
75
75
  private pendingAudioBytes;
76
76
  private pendingAudioTotalBytes;
77
77
 
78
+ private heldShedWarned;
79
+
78
80
  private videoLane;
79
81
 
80
82
  private frozenAudio;
@@ -91,6 +93,20 @@ declare class OpenAIRealtimeConnection<S = unknown> {
91
93
 
92
94
  private deadlineFired;
93
95
 
96
+ private seamEndedTurn;
97
+
98
+ private clientCancel;
99
+
100
+ private seamEmptyStreak;
101
+
102
+ private turnOutputFlowed;
103
+
104
+ private continuationTurnInFlight;
105
+
106
+ private lastTurnParams;
107
+
108
+ private collidingCreateWarned;
109
+
94
110
  private responseFlushed;
95
111
  private cancelled;
96
112
 
@@ -99,6 +115,10 @@ declare class OpenAIRealtimeConnection<S = unknown> {
99
115
  private audioLaneOwner;
100
116
  private audioUnsubscribe;
101
117
  private outOfTurnAudioWarned;
118
+
119
+ private duplexSilenceMs;
120
+
121
+ private duplexInputCount;
102
122
  private audioOnlyTranscriptGapWarned;
103
123
  private closed;
104
124
 
@@ -163,10 +183,20 @@ declare class OpenAIRealtimeConnection<S = unknown> {
163
183
  private upstreamStream;
164
184
  private startResponse;
165
185
 
186
+ private maybeAutoContinue;
187
+
188
+ private failMemberUnresponsive;
189
+
190
+ private isStandingCadenceSession;
191
+
166
192
  private compositeTurnAsk;
167
193
 
168
194
  private onOutputAudioFrame;
169
195
 
196
+ private openDuplexResponse;
197
+
198
+ private closeDuplexResponse;
199
+
170
200
  private messageItemAdded;
171
201
 
172
202
  private messageItemOpenForAudio;
@@ -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-AW5X2PRN.js";import{a as o,h as t}from"../chunk-X5BLQXHK.js";import"../chunk-64VO62LW.js";import"../chunk-H4KFMIEV.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};
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-7IT4XK2K.js";import{a as o,h as t}from"../chunk-X5BLQXHK.js";import"../chunk-64VO62LW.js";import"../chunk-ZWDQPTSH.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.51",
3
+ "version": "0.6.53",
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.51"
73
+ "@urun-sh/core": "^0.6.53"
74
74
  },
75
75
  "dependencies": {
76
76
  "@prometheus-io/client": "^0.16.1",