@urun-sh/openai 0.6.51 → 0.6.52

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.
@@ -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;
@@ -536,6 +560,40 @@ declare class OpenAIRealtimeConnection<S = unknown> {
536
560
  private stallBoundedTurn;
537
561
  private upstreamStream;
538
562
  private startResponse;
563
+ /**
564
+ * THE STANDING-CADENCE CONTINUATION (prod 2026-11-18, the 32×15 min hold:
565
+ * 13 of 26 sessions dead by ~10.5 min): a session running the standing
566
+ * decision schema (the Sense continuous-streaming contract) must not go
567
+ * dark because one of THIS adapter's own backstops ended the turn. The
568
+ * lifetime deadline (300 s) and the turn-stall bound both end the turn
569
+ * VISIBLY on the assumption that "the client's own re-open resumes the
570
+ * loop" — but the GA contract puts re-open on the CLIENT, a client that
571
+ * streams continuously never sends one, and the hub's fallback (lane
572
+ * re-dial replaying the original `response.create`) costs a 15 s dead gap
573
+ * (REARM_MIN_INTERVAL_MS) plus a fresh member whose conversation context
574
+ * is empty. When the seam end was OURS (not a client cancel, not a normal
575
+ * upstream completion) and the session is a standing-cadence session with
576
+ * the client still attached, re-open the turn HERE: same member, no gap,
577
+ * held audio state untouched. Self-limiting: a dead upstream re-arms at
578
+ * worst once per stall/deadline period, never a hot loop.
579
+ */
580
+ private maybeAutoContinue;
581
+ /**
582
+ * The bounded dead-member terminal: the client gets a loud `error` event
583
+ * naming `member_unresponsive` (the SDKs parse it, the bench/real clients
584
+ * fail the session on it) and the socket closes — never a silent
585
+ * forever-idle stream.
586
+ */
587
+ private failMemberUnresponsive;
588
+ /**
589
+ * True when the session's instructions carry the standing decision schema
590
+ * (the cadence contract: a JSON object with `questions`/`question` and an
591
+ * `hz`/`cadence_ms` — exactly what {@link withRealtimeCadenceDefault}
592
+ * stamps and what the Sense/realtime clients send). Plain-text
593
+ * instructions and non-cadence JSON never auto-continue: a normal
594
+ * voice/chat turn belongs to the client or the VAD, not to a backstop.
595
+ */
596
+ private isStandingCadenceSession;
539
597
  /**
540
598
  * The composite turn's tts-leg control keys (ENG-451): the effective
541
599
  * output-modality ask — the turn's `output_modalities`/`modalities` when it
@@ -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
 
@@ -163,6 +179,12 @@ declare class OpenAIRealtimeConnection<S = unknown> {
163
179
  private upstreamStream;
164
180
  private startResponse;
165
181
 
182
+ private maybeAutoContinue;
183
+
184
+ private failMemberUnresponsive;
185
+
186
+ private isStandingCadenceSession;
187
+
166
188
  private compositeTurnAsk;
167
189
 
168
190
  private onOutputAudioFrame;
@@ -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-ONFTTWZH.js";import{a as o,h as t}from"../chunk-X5BLQXHK.js";import"../chunk-64VO62LW.js";import"../chunk-JR5TNOMP.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.52",
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.52"
74
74
  },
75
75
  "dependencies": {
76
76
  "@prometheus-io/client": "^0.16.1",