@urun-sh/openai 0.6.18 → 0.6.20
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-64WZRHYB.js +6 -0
- package/dist/chunk-7ZH2UHK6.js +1 -0
- package/dist/{chunk-NYSZ3RGB.js → chunk-BAKPG5S3.js} +3 -3
- package/dist/chunk-TF2IMK3T.js +62 -0
- package/dist/hosted/bin.cjs +37 -38
- package/dist/hosted/bin.js +1 -1
- package/dist/hosted/index.cjs +34 -35
- package/dist/hosted/index.d.cts +11 -61
- package/dist/hosted/index.d.ts +1 -14
- package/dist/hosted/index.js +1 -1
- package/dist/pi-extension/index.js +1 -1
- package/dist/pi-extension/standalone.cjs +42 -42
- package/dist/proxy/cli.cjs +40 -41
- package/dist/proxy/cli.js +14 -15
- package/dist/proxy/index.cjs +25 -25
- package/dist/proxy/index.d.cts +2 -2
- package/dist/proxy/index.d.ts +2 -2
- package/dist/proxy/index.js +1 -1
- package/dist/{responses-turn-B91w2YKn.d.cts → responses-turn-Cb1qQBA7.d.cts} +4 -135
- package/dist/{responses-turn-FcEDaymF.d.ts → responses-turn-DmzWIpmO.d.ts} +0 -71
- package/package.json +2 -2
- package/dist/chunk-3U7YQ7LE.js +0 -62
- package/dist/chunk-MLJ66LPI.js +0 -1
- package/dist/chunk-O4TKY7NE.js +0 -7
package/dist/proxy/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Server, IncomingMessage } from 'node:http';
|
|
2
|
-
import { f as ProxyHandlerOptions, P as ProxyClients } from '../responses-turn-
|
|
3
|
-
export { D as DialObserver, a as DialReport, g as ProxyIdentity, h as ProxyVideoOutLane, S as SessionGoneError, U as UnknownModelError } from '../responses-turn-
|
|
2
|
+
import { f as ProxyHandlerOptions, P as ProxyClients } from '../responses-turn-Cb1qQBA7.cjs';
|
|
3
|
+
export { D as DialObserver, a as DialReport, g as ProxyIdentity, h as ProxyVideoOutLane, S as SessionGoneError, U as UnknownModelError } from '../responses-turn-Cb1qQBA7.cjs';
|
|
4
4
|
export { h as GEMINI_LIVE_PATH, V as VIDEO_OUT_SETUP_KEY } from '../translator-CO8W_hmJ.cjs';
|
|
5
5
|
import { WebSocket } from 'ws';
|
|
6
6
|
import '../models-DUdx_Y6X.cjs';
|
package/dist/proxy/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Server, IncomingMessage } from 'node:http';
|
|
2
|
-
import { f as ProxyHandlerOptions, P as ProxyClients } from '../responses-turn-
|
|
3
|
-
export { D as DialObserver, a as DialReport, g as ProxyIdentity, h as ProxyVideoOutLane, S as SessionGoneError, U as UnknownModelError } from '../responses-turn-
|
|
2
|
+
import { f as ProxyHandlerOptions, P as ProxyClients } from '../responses-turn-DmzWIpmO.js';
|
|
3
|
+
export { D as DialObserver, a as DialReport, g as ProxyIdentity, h as ProxyVideoOutLane, S as SessionGoneError, U as UnknownModelError } from '../responses-turn-DmzWIpmO.js';
|
|
4
4
|
export { h as GEMINI_LIVE_PATH, V as VIDEO_OUT_SETUP_KEY } from '../translator-Ddd65sXR.js';
|
|
5
5
|
import { WebSocket } from 'ws';
|
|
6
6
|
import '../models-DUdx_Y6X.js';
|
package/dist/proxy/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as l,C as a,D as x,E as s,G as O,H as f,
|
|
1
|
+
import{B as l,C as a,D as x,E as s,G as O,H as f,S as I,a as n,b as p,c as m}from"../chunk-TF2IMK3T.js";import{f as r,g as i}from"../chunk-BAKPG5S3.js";import{a as o,h as t}from"../chunk-3JWYIKHM.js";import"../chunk-6M5JK4YC.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};
|
|
@@ -712,12 +712,10 @@ interface RouteTarget {
|
|
|
712
712
|
variant?: string;
|
|
713
713
|
/**
|
|
714
714
|
* Shared lanes only: the pod org (`shared.shared_org_id` of the block that
|
|
715
|
-
* resolved the lane).
|
|
716
|
-
*
|
|
717
|
-
*
|
|
718
|
-
*
|
|
719
|
-
* lane, never a second env spelling, so key and pod-org identity cannot
|
|
720
|
-
* drift.
|
|
715
|
+
* resolved the lane). On a shared pod the caller-org tenant differs from
|
|
716
|
+
* the shared-org pod, and the org identity of the lane must come from the
|
|
717
|
+
* SAME block that resolved it — never a second env spelling, so key and
|
|
718
|
+
* pod-org identity cannot drift.
|
|
721
719
|
*/
|
|
722
720
|
sharedOrgId?: string;
|
|
723
721
|
}
|
|
@@ -982,15 +980,6 @@ declare class ModelRouter<S> {
|
|
|
982
980
|
* Rides {@link resolveTarget}'s cached listings and OPENS NO SESSION.
|
|
983
981
|
*/
|
|
984
982
|
servingAppSlugFor(model: string | undefined): Promise<string>;
|
|
985
|
-
/**
|
|
986
|
-
* THE STATELESS DIRECT PATH's resolution seam: the dial target for a
|
|
987
|
-
* model — the pure resolution (app slug, fn, shared flag) with NO session
|
|
988
|
-
* opened. The stateless decision dial (stateless-dispatch.ts) uses it to
|
|
989
|
-
* discover ready replicas for the resolved (org, app, fn) instead of
|
|
990
|
-
* minting a session; every public no-dial accessor above rides this same
|
|
991
|
-
* private resolution.
|
|
992
|
-
*/
|
|
993
|
-
targetFor(model: string | undefined): Promise<RouteTarget>;
|
|
994
983
|
/**
|
|
995
984
|
* Resolve a request's `model` to its POOL KEY — the app slug for a
|
|
996
985
|
* caller-org app, `shared:<slug>` for a shared-lane dial (the two never
|
|
@@ -1327,117 +1316,6 @@ interface SessionTurnLaneEvent {
|
|
|
1327
1316
|
startMs?: number;
|
|
1328
1317
|
}
|
|
1329
1318
|
|
|
1330
|
-
/** One ready replica row from the presence read. */
|
|
1331
|
-
interface RuntimePresenceRow {
|
|
1332
|
-
runtime_id: string;
|
|
1333
|
-
/** Base URL of the runtime's :8099 endpoint, e.g. `http://10.0.1.5:8099`. */
|
|
1334
|
-
address: string;
|
|
1335
|
-
ready: boolean;
|
|
1336
|
-
/** ISO 8601 instant of the runtime's last presence heartbeat. */
|
|
1337
|
-
last_seen: string;
|
|
1338
|
-
status?: string | null;
|
|
1339
|
-
}
|
|
1340
|
-
/** One resolved dial target — the router's pure resolution (no session).
|
|
1341
|
-
* The shared arm's fields ride through so the dial can mint the
|
|
1342
|
-
* provider-aware token and the handlers can repin the CATALOG billing pair:
|
|
1343
|
-
* `sharedOrgId` is the shared block's `shared_org_id` (the pod org). */
|
|
1344
|
-
interface DialTarget {
|
|
1345
|
-
appSlug: string;
|
|
1346
|
-
fnName?: string;
|
|
1347
|
-
sharedApp?: boolean;
|
|
1348
|
-
modelId?: string;
|
|
1349
|
-
variant?: string;
|
|
1350
|
-
sharedOrgId?: string;
|
|
1351
|
-
}
|
|
1352
|
-
interface StatelessDecisionDialOptions {
|
|
1353
|
-
/** Resolve a request's model to its dial target WITHOUT opening a session. */
|
|
1354
|
-
targetFor: (model: string | undefined) => Promise<DialTarget>;
|
|
1355
|
-
apiUrl: string;
|
|
1356
|
-
apiKey: string;
|
|
1357
|
-
/** The caller org's id — the minted token's `tenant` claim. */
|
|
1358
|
-
orgId: string;
|
|
1359
|
-
/** The serve function name the resolved app must expose (the backhaul's
|
|
1360
|
-
* URUN_FUNCTION default, 'serve'). */
|
|
1361
|
-
fnName: string;
|
|
1362
|
-
/** The shared secret render injects (URUN_SESSION_TOKEN_SECRET). */
|
|
1363
|
-
secret: string;
|
|
1364
|
-
/** THE SHARED LANE'S credential (URUN_SHARED_ORG_API_KEY): the shared
|
|
1365
|
-
* org's API key, so discovery and decisions can reach the SHARED org's
|
|
1366
|
-
* pods too. The provider org id comes from the resolved target's
|
|
1367
|
-
* `sharedOrgId` (the block's `shared_org_id`), never a second env spelling
|
|
1368
|
-
* of it — key and pod-org identity cannot drift apart. Absent ⇒ shared
|
|
1369
|
-
* models keep the session lane (the v1 boundary narrows to "no shared
|
|
1370
|
-
* credential mounted" instead of "shared never"). */
|
|
1371
|
-
shared?: {
|
|
1372
|
-
apiKey: string;
|
|
1373
|
-
};
|
|
1374
|
-
fetchImpl?: typeof fetch;
|
|
1375
|
-
nowMs?: () => number;
|
|
1376
|
-
/** Per-attempt POST budget override (test seam; production rides
|
|
1377
|
-
* DECISION_TIMEOUT_MS). */
|
|
1378
|
-
timeoutMs?: number;
|
|
1379
|
-
}
|
|
1380
|
-
/**
|
|
1381
|
-
* The stateless decision dial. `decide` resolves the target, discovers ready
|
|
1382
|
-
* replicas, picks the least-outstanding one, mints the scoped token and POSTs
|
|
1383
|
-
* the flat body to the runtime's `/v1/decision` intake.
|
|
1384
|
-
*/
|
|
1385
|
-
declare class StatelessDecisionDial {
|
|
1386
|
-
private readonly opts;
|
|
1387
|
-
private readonly replicas;
|
|
1388
|
-
private readonly nowMs;
|
|
1389
|
-
/** Per-(presence key, app, fn) fresh listing, TTL-bounded to
|
|
1390
|
-
* PRESENCE_FRESH_S. A per-DECISION control-plane read would be the same
|
|
1391
|
-
* design error the session dial was — a network round-trip for state the
|
|
1392
|
-
* runtime plane re-proves every ~5s heartbeat. The cache serves the
|
|
1393
|
-
* caller from memory, refreshes in the BACKGROUND past half the TTL, and
|
|
1394
|
-
* evicts a replica (or the whole entry) the moment a dial to its cached
|
|
1395
|
-
* address fails. */
|
|
1396
|
-
private readonly presenceCache;
|
|
1397
|
-
constructor(opts: StatelessDecisionDialOptions);
|
|
1398
|
-
/** Enabled = the pod secret is configured. Absent ⇒ the session lane serves
|
|
1399
|
-
* (byte-for-byte behavior). */
|
|
1400
|
-
get enabled(): boolean;
|
|
1401
|
-
/**
|
|
1402
|
-
* Resolve a request's lane target WITHOUT dialing: `null` for a SHARED-lane
|
|
1403
|
-
* model when the dial holds NO shared credential — the caller keeps the
|
|
1404
|
-
* session lane. WITH the shared key, a shared target is dialable and rides
|
|
1405
|
-
* through with its full identity (modelId/variant for the billing repin,
|
|
1406
|
-
* `sharedOrgId` for the provider-aware token). The HTTP handlers call this
|
|
1407
|
-
* FIRST and route non-null targets into decide; decide re-resolves its own
|
|
1408
|
-
* target so the one it reports is the one it actually dialed.
|
|
1409
|
-
*/
|
|
1410
|
-
targetFor(model: string | undefined): Promise<DialTarget | null>;
|
|
1411
|
-
/**
|
|
1412
|
-
* One decision. Returns the intake's `(status, body)` plus the SYNTHESIZED
|
|
1413
|
-
* completed body the lane stamps its billing receipt from — the runtime's
|
|
1414
|
-
* chat body carries `usage` (OpenAI shape) and `urun_timing`; both are the
|
|
1415
|
-
* exact fields the ledger's receipt stamper reads, mapped once here so the
|
|
1416
|
-
* stateless lane prices identically to the session lane. The RESOLVED
|
|
1417
|
-
* target rides along: the handlers repin the billing identity from it
|
|
1418
|
-
* (the dial's own answer, handed out — never asked for again) before
|
|
1419
|
-
* stamping.
|
|
1420
|
-
*/
|
|
1421
|
-
decide(body: Record<string, unknown>, model: string | undefined): Promise<{
|
|
1422
|
-
status: number;
|
|
1423
|
-
body: unknown;
|
|
1424
|
-
completed: unknown;
|
|
1425
|
-
target: DialTarget & {
|
|
1426
|
-
fnName: string;
|
|
1427
|
-
};
|
|
1428
|
-
}>;
|
|
1429
|
-
/** Serve the caller from the cache; a MISS (or a TTL-expired entry) reads
|
|
1430
|
-
* synchronously — the cold path is the one decision that pays the hop —
|
|
1431
|
-
* and an entry past half the TTL fires a single-flight BACKGROUND refresh
|
|
1432
|
-
* that never blocks this caller. */
|
|
1433
|
-
private ensureRows;
|
|
1434
|
-
private readPresence;
|
|
1435
|
-
/** LEAST-OUTSTANDING: pick the ready replica with the fewest in-flight
|
|
1436
|
-
* decisions (ties → the first), skipping replicas in failure cooldown. */
|
|
1437
|
-
pick(rows: RuntimePresenceRow[]): string | null;
|
|
1438
|
-
private post;
|
|
1439
|
-
}
|
|
1440
|
-
|
|
1441
1319
|
/**
|
|
1442
1320
|
* THE CANONICAL USAGE-QUERY LANE — `POST /v1/usage/requests`.
|
|
1443
1321
|
*
|
|
@@ -2464,15 +2342,6 @@ interface ProxyClients {
|
|
|
2464
2342
|
* the unsubscribe.
|
|
2465
2343
|
*/
|
|
2466
2344
|
onSessionEnd(handle: string, cb: (end: SessionEndInfo) => void): Promise<() => void>;
|
|
2467
|
-
/**
|
|
2468
|
-
* THE STATELESS DIRECT PATH (stateless-dispatch.ts): the decision dial to
|
|
2469
|
-
* the serving pods' `POST /v1/decision` intake, present only when the
|
|
2470
|
-
* deployment carries the runtime scoped-token secret. Absent ⇒ every
|
|
2471
|
-
* decision rides the session lane exactly as before (the staged rollout).
|
|
2472
|
-
* Per-org: the HOSTED registry builds one per tenant so the minted token's
|
|
2473
|
-
* tenant claim is always the CALLER's org.
|
|
2474
|
-
*/
|
|
2475
|
-
readonly stateless?: StatelessDecisionDial;
|
|
2476
2345
|
}
|
|
2477
2346
|
/**
|
|
2478
2347
|
* The audio lane handle `openAudio` returns — structurally the transport
|
|
@@ -290,8 +290,6 @@ declare class ModelRouter<S> {
|
|
|
290
290
|
|
|
291
291
|
servingAppSlugFor(model: string | undefined): Promise<string>;
|
|
292
292
|
|
|
293
|
-
targetFor(model: string | undefined): Promise<RouteTarget>;
|
|
294
|
-
|
|
295
293
|
resolveApp(model: string | undefined): Promise<string>;
|
|
296
294
|
|
|
297
295
|
sessionFor(model: string | undefined): Promise<{
|
|
@@ -357,73 +355,6 @@ interface SessionTurnLaneEvent {
|
|
|
357
355
|
startMs?: number;
|
|
358
356
|
}
|
|
359
357
|
|
|
360
|
-
interface RuntimePresenceRow {
|
|
361
|
-
runtime_id: string;
|
|
362
|
-
|
|
363
|
-
address: string;
|
|
364
|
-
ready: boolean;
|
|
365
|
-
|
|
366
|
-
last_seen: string;
|
|
367
|
-
status?: string | null;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
interface DialTarget {
|
|
371
|
-
appSlug: string;
|
|
372
|
-
fnName?: string;
|
|
373
|
-
sharedApp?: boolean;
|
|
374
|
-
modelId?: string;
|
|
375
|
-
variant?: string;
|
|
376
|
-
sharedOrgId?: string;
|
|
377
|
-
}
|
|
378
|
-
interface StatelessDecisionDialOptions {
|
|
379
|
-
|
|
380
|
-
targetFor: (model: string | undefined) => Promise<DialTarget>;
|
|
381
|
-
apiUrl: string;
|
|
382
|
-
apiKey: string;
|
|
383
|
-
|
|
384
|
-
orgId: string;
|
|
385
|
-
|
|
386
|
-
fnName: string;
|
|
387
|
-
|
|
388
|
-
secret: string;
|
|
389
|
-
|
|
390
|
-
shared?: {
|
|
391
|
-
apiKey: string;
|
|
392
|
-
};
|
|
393
|
-
fetchImpl?: typeof fetch;
|
|
394
|
-
nowMs?: () => number;
|
|
395
|
-
|
|
396
|
-
timeoutMs?: number;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
declare class StatelessDecisionDial {
|
|
400
|
-
private readonly opts;
|
|
401
|
-
private readonly replicas;
|
|
402
|
-
private readonly nowMs;
|
|
403
|
-
|
|
404
|
-
private readonly presenceCache;
|
|
405
|
-
constructor(opts: StatelessDecisionDialOptions);
|
|
406
|
-
|
|
407
|
-
get enabled(): boolean;
|
|
408
|
-
|
|
409
|
-
targetFor(model: string | undefined): Promise<DialTarget | null>;
|
|
410
|
-
|
|
411
|
-
decide(body: Record<string, unknown>, model: string | undefined): Promise<{
|
|
412
|
-
status: number;
|
|
413
|
-
body: unknown;
|
|
414
|
-
completed: unknown;
|
|
415
|
-
target: DialTarget & {
|
|
416
|
-
fnName: string;
|
|
417
|
-
};
|
|
418
|
-
}>;
|
|
419
|
-
|
|
420
|
-
private ensureRows;
|
|
421
|
-
private readPresence;
|
|
422
|
-
|
|
423
|
-
pick(rows: RuntimePresenceRow[]): string | null;
|
|
424
|
-
private post;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
358
|
interface InferenceUsageRecord {
|
|
428
359
|
|
|
429
360
|
inference_id: string;
|
|
@@ -634,8 +565,6 @@ interface ProxyClients {
|
|
|
634
565
|
createResponseOn(handle: string, params: ResponsesCreateParams): Promise<AsyncIterable<unknown>> | AsyncIterable<unknown>;
|
|
635
566
|
|
|
636
567
|
onSessionEnd(handle: string, cb: (end: SessionEndInfo) => void): Promise<() => void>;
|
|
637
|
-
|
|
638
|
-
readonly stateless?: StatelessDecisionDial;
|
|
639
568
|
}
|
|
640
569
|
|
|
641
570
|
type ProxyAudioLane = Pick<AudioBridge, 'appendInputAudio' | 'onOutputAudio'> & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@urun-sh/openai",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.20",
|
|
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.20"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@prometheus-io/client": "^0.16.1",
|