@urun-sh/openai 0.6.31 → 0.6.33
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-7D2HMQFC.js +2 -0
- package/dist/chunk-CAR4AEQJ.js +1 -0
- package/dist/{chunk-76BZLCGT.js → chunk-GL7EWL3V.js} +1 -1
- package/dist/chunk-GR3UAW6P.js +60 -0
- package/dist/chunk-L6HTHDVV.js +1 -0
- package/dist/chunk-LM4E5YM2.js +19 -0
- package/dist/chunk-NL3UBLXV.js +6 -0
- package/dist/chunk-NN6TQQUG.js +1 -0
- package/dist/chunk-OOCRI7ZM.js +6 -0
- package/dist/chunk-PAYCMH5F.js +1 -0
- package/dist/chunk-PBKCUSTI.js +17 -0
- package/dist/{responses-turn-DXrwiPJh.d.cts → composite-CwfOOT0b.d.cts} +548 -309
- package/dist/{responses-turn-BGb_XPOa.d.ts → composite-D9VDruCV.d.ts} +127 -83
- package/dist/gemini-live.cjs +2 -2
- package/dist/gemini-live.d.cts +85 -105
- package/dist/gemini-live.d.ts +48 -48
- package/dist/gemini-live.js +1 -1
- package/dist/hosted/bin.cjs +56 -42
- package/dist/hosted/bin.js +4 -22
- package/dist/hosted/index.cjs +52 -38
- package/dist/hosted/index.d.cts +243 -19
- package/dist/hosted/index.d.ts +120 -4
- package/dist/hosted/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{models-DUdx_Y6X.d.cts → models-D7F0bLJ3.d.cts} +14 -0
- package/dist/{models-DUdx_Y6X.d.ts → models-D7F0bLJ3.d.ts} +6 -0
- package/dist/pi-extension/index.cjs +6 -6
- package/dist/pi-extension/index.js +1 -1
- package/dist/pi-extension/standalone.cjs +33 -33
- package/dist/pooler/bin.cjs +335 -0
- package/dist/pooler/bin.js +316 -0
- package/dist/proxy/cli.cjs +58 -53
- package/dist/proxy/cli.js +1 -1
- package/dist/proxy/conformance-probe.cjs +1 -0
- package/dist/proxy/conformance-probe.js +1 -0
- package/dist/proxy/index.cjs +31 -28
- package/dist/proxy/index.d.cts +315 -167
- package/dist/proxy/index.d.ts +85 -53
- package/dist/proxy/index.js +1 -1
- package/package.json +14 -4
- package/dist/chunk-4MI2TNQS.js +0 -62
- package/dist/chunk-7SAW4IL4.js +0 -2
- package/dist/chunk-7V2JKPIG.js +0 -1
- package/dist/chunk-CUDFHFNX.js +0 -4
- package/dist/chunk-HZC2SKKI.js +0 -8
- package/dist/chunk-K23AZPI4.js +0 -1
package/dist/hosted/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Server } from 'node:http';
|
|
2
|
+
import { c as LedgerOutcome, I as InferenceRecord, i as RouteTarget, S as SessionGoneError, k as billingIdentityOf, P as ProxyClients, M as ModelRouter, j as UsageRowReporter, b as InferenceUsageRecord, e as LedgerWrite, d as LedgerRecorded, L as LedgerFailure, R as RealtimeCompanionsFor } from '../composite-CwfOOT0b.cjs';
|
|
2
3
|
import * as _prometheus_io_client from '@prometheus-io/client';
|
|
3
4
|
import { Registry } from '@prometheus-io/client';
|
|
4
|
-
import { c as LedgerOutcome, I as InferenceRecord, S as SessionGoneError, j as billingIdentityOf, P as ProxyClients, M as ModelRouter, i as UsageRowReporter, b as InferenceUsageRecord, e as LedgerWrite, d as LedgerRecorded, L as LedgerFailure } from '../responses-turn-DXrwiPJh.cjs';
|
|
5
5
|
import { createClientToken, SessionPhaseName } from '@urun-sh/core';
|
|
6
6
|
import { U as UrunResponses } from '../ResponsesClient-_OZERUjH.cjs';
|
|
7
7
|
import { b as UrunSessionLike } from '../types-CHPtJx6d.cjs';
|
|
8
|
-
import '../models-
|
|
8
|
+
import { C as CatalogRow } from '../models-D7F0bLJ3.cjs';
|
|
9
9
|
import '../video-out-BsuLqlID.cjs';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -106,6 +106,25 @@ declare class InferenceMetrics {
|
|
|
106
106
|
private readonly ledgerQueue;
|
|
107
107
|
private readonly labelCardinality;
|
|
108
108
|
private readonly labelOverflows;
|
|
109
|
+
private readonly lanesReady;
|
|
110
|
+
private readonly lanePickMs;
|
|
111
|
+
private readonly laneFirstEventMs;
|
|
112
|
+
private readonly lane503Fast;
|
|
113
|
+
/**
|
|
114
|
+
* ORG BINDING: tenant-bearing /doc tokens accepted WITHOUT a lane record to
|
|
115
|
+
* bind against (lane_tenant key absent, or its lookup threw). Fail-open by
|
|
116
|
+
* design (the strict derived-key ladder is the primary gate), but a climbing
|
|
117
|
+
* series means the runtime's lane_tenant writer regressed — alert on it
|
|
118
|
+
* (Main ruling), never let the fence silently degrade.
|
|
119
|
+
*/
|
|
120
|
+
private readonly laneDocTenantMissing;
|
|
121
|
+
/**
|
|
122
|
+
* THE BUILD STAMP (lane 30, PLAN B.5): always 1, labels naming the image
|
|
123
|
+
* commit this process was built from (`URUN_BUILD_COMMIT`, baked by the
|
|
124
|
+
* image workflow — 'unknown' when unset). A pod still serving an old
|
|
125
|
+
* image after a roll is otherwise invisible on the metrics surface.
|
|
126
|
+
*/
|
|
127
|
+
private readonly buildInfo;
|
|
109
128
|
constructor(options?: {
|
|
110
129
|
defaultMetrics?: boolean;
|
|
111
130
|
});
|
|
@@ -119,6 +138,13 @@ declare class InferenceMetrics {
|
|
|
119
138
|
* disagreement would be invisible.
|
|
120
139
|
*/
|
|
121
140
|
observeLedger(outcome: LedgerOutcome): void;
|
|
141
|
+
/** THE LANE PLANE's observation surface (fed by proxy/lane-registry.ts). */
|
|
142
|
+
observeLaneReady(model: string, count: number): void;
|
|
143
|
+
observeLanePick(model: string, durationMs: number): void;
|
|
144
|
+
observeLaneFirstEvent(model: string, durationMs: number): void;
|
|
145
|
+
observeLane503Fast(model: string): void;
|
|
146
|
+
/** ORG BINDING: a tenant-bearing /doc token accepted with NO lane record. */
|
|
147
|
+
observeLaneDocTenantMissing(): void;
|
|
122
148
|
/**
|
|
123
149
|
* Count ONE completed `/v1` request. Takes the very record
|
|
124
150
|
* `inferenceRequestLine` serializes, so the counters and the billing log can
|
|
@@ -174,14 +200,38 @@ declare class ProxyAuthError extends Error {
|
|
|
174
200
|
readonly status: number;
|
|
175
201
|
constructor(message: string, status?: number);
|
|
176
202
|
}
|
|
177
|
-
/**
|
|
203
|
+
/**
|
|
204
|
+
* The control plane could not be reached/asked. Loud 502, never a pass.
|
|
205
|
+
*
|
|
206
|
+
* THE CALLER-MESSAGE BOUNDARY (ENG-538, final review round 5): `message` is
|
|
207
|
+
* the CALLER's line — short, honest, actionable, no internals. The operator's
|
|
208
|
+
* evidence (the gateway URL, the underlying failure text) rides `detail`,
|
|
209
|
+
* which the classified relay branches send to the operator sink — never to
|
|
210
|
+
* the caller. Before this split the constructor embedded the gateway URL and
|
|
211
|
+
* the raw underlying text into `message` itself, and every classified relay
|
|
212
|
+
* position passed them straight to the wire.
|
|
213
|
+
*/
|
|
178
214
|
declare class ControlPlaneUnavailableError extends Error {
|
|
179
|
-
|
|
215
|
+
/** Operator-only evidence: the gateway URL and/or the underlying failure text. */
|
|
216
|
+
readonly detail?: string;
|
|
217
|
+
constructor(message: string, detail?: string);
|
|
180
218
|
}
|
|
181
|
-
/** The verified caller: their key,
|
|
219
|
+
/** The verified caller: their key, the org the control plane bound it to, and
|
|
220
|
+
* the ENG-509 request-lane admission verdict the binding carries.
|
|
221
|
+
*
|
|
222
|
+
* The verdict fields are UNDEFINED on a cache hit from an older control
|
|
223
|
+
* plane (or a failed best-effort verdict read) — every consumer treats
|
|
224
|
+
* absent fields as ADMIT; the gate must never brick the endpoint on a
|
|
225
|
+
* control plane that does not speak the fields. */
|
|
182
226
|
interface CallerIdentity {
|
|
183
227
|
apiKey: string;
|
|
184
228
|
orgId: string;
|
|
229
|
+
/** 'platform' | 'distributor' — organizations.billing_audience (ENG-490). */
|
|
230
|
+
billingAudience?: string;
|
|
231
|
+
/** False = refuse NEW /v1 requests (402); in-flight requests always finish. */
|
|
232
|
+
creditsAdmissionOk?: boolean;
|
|
233
|
+
/** 'spend_cap_reached' | 'insufficient_credits' — present only on a refusal. */
|
|
234
|
+
creditsRefusalReason?: string;
|
|
185
235
|
}
|
|
186
236
|
/**
|
|
187
237
|
* Pull the raw key off `Authorization: Bearer <key>`. Missing, malformed, or
|
|
@@ -219,17 +269,6 @@ declare class OrgResolver {
|
|
|
219
269
|
private readonly mint;
|
|
220
270
|
private readonly now;
|
|
221
271
|
constructor(opts: OrgResolverOptions);
|
|
222
|
-
/**
|
|
223
|
-
* Verify a Bearer key against the control plane and return its org binding.
|
|
224
|
-
*
|
|
225
|
-
* Three outcomes, all explicit:
|
|
226
|
-
* - the control plane binds the key to an org → {@link CallerIdentity};
|
|
227
|
-
* - the control plane rejects the key (401/403) → {@link ProxyAuthError};
|
|
228
|
-
* - the control plane cannot be asked → loud
|
|
229
|
-
* {@link ControlPlaneUnavailableError} (502). NEVER a pass: a proxy that
|
|
230
|
-
* admitted requests while it could not verify keys would be an open
|
|
231
|
-
* relay into every org.
|
|
232
|
-
*/
|
|
233
272
|
resolve(apiKey: string): Promise<CallerIdentity>;
|
|
234
273
|
/** Test/ops seam: forget every cached binding. */
|
|
235
274
|
clear(): void;
|
|
@@ -258,6 +297,89 @@ interface DecisionPoolStats {
|
|
|
258
297
|
lastMissAgeMs: number | null;
|
|
259
298
|
}
|
|
260
299
|
|
|
300
|
+
/** One advertised registry row, read back as status (no secrets, no demand). */
|
|
301
|
+
interface LaneRegistryStatusRow {
|
|
302
|
+
laneId: string;
|
|
303
|
+
occupantId: string;
|
|
304
|
+
capacity: number;
|
|
305
|
+
/** ms since the runtime's last heartbeat; null when the row is malformed. */
|
|
306
|
+
heartbeatAgeMs: number | null;
|
|
307
|
+
/** Advertised with THIS region's docHostUrl (a peer region's row is listed but flagged). */
|
|
308
|
+
advertisedHere: boolean;
|
|
309
|
+
/** A `lane_hosts:` lease exists — the runtime doc-connected somewhere. */
|
|
310
|
+
hosted: boolean;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* THE LANE REGISTRY — pick, reuse, and join lanes (plan A4.2/A5.2).
|
|
315
|
+
*
|
|
316
|
+
* OWNERSHIP (owner ruling 2026-10-12): the `lanes:*` / `lane_hosts:*`
|
|
317
|
+
* registry reads and the dispatch-queue demand live in the POOLER
|
|
318
|
+
* (`pooler/lane-demand.ts`) — ONE minter per region, never a Queue per
|
|
319
|
+
* proxy replica. This module is the proxy's remnant: the entry cache and
|
|
320
|
+
* the doc-session join. A dial asks the pooler's lane plane for the ready
|
|
321
|
+
* candidates (registry read + demand + cold-wake hold behind it), then
|
|
322
|
+
* picks SELF-hosted first (in-process bridge, honest in-flight counts),
|
|
323
|
+
* least-loaded; a lane hosted on a PEER replica is joined pod-to-pod as a
|
|
324
|
+
* y-websocket CLIENT over the library's own `createWebsocketDocConnector`
|
|
325
|
+
* — never a hand-rolled sync.
|
|
326
|
+
*
|
|
327
|
+
* Lanes are REUSED across requests (that is the point): one lane serves
|
|
328
|
+
* many concurrent turns; the entry cache is keyed by laneId and only a gone
|
|
329
|
+
* verdict (host room empty / remote doc plane failed) retires an entry.
|
|
330
|
+
*/
|
|
331
|
+
|
|
332
|
+
interface LanePoolPick {
|
|
333
|
+
app: string;
|
|
334
|
+
entry: PoolEntry;
|
|
335
|
+
identity: {
|
|
336
|
+
kind: 'catalog';
|
|
337
|
+
model_id: string;
|
|
338
|
+
variant: string;
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
/** Read-only per-pool lane facts — the "why 503" surface (owner 2026-10-07). */
|
|
342
|
+
interface LaneStatusRow extends LaneRegistryStatusRow {
|
|
343
|
+
}
|
|
344
|
+
/** Read-only per-pool lane facts — the "why 503" surface (owner 2026-10-07). */
|
|
345
|
+
interface LanePoolStatus {
|
|
346
|
+
pool: string;
|
|
347
|
+
lanes: LaneStatusRow[];
|
|
348
|
+
/** This replica's open entries (picked lanes with live doc sessions). */
|
|
349
|
+
local: Array<{
|
|
350
|
+
laneId: string;
|
|
351
|
+
inFlight: number;
|
|
352
|
+
self: boolean;
|
|
353
|
+
host: string;
|
|
354
|
+
}>;
|
|
355
|
+
lastRefusalAt: number | null;
|
|
356
|
+
lastDemandAt: number | null;
|
|
357
|
+
}
|
|
358
|
+
interface LanePools {
|
|
359
|
+
/**
|
|
360
|
+
* The rehome seam's sessionFor for ONE resolved SHARED target: least-loaded
|
|
361
|
+
* ready lane (self-hosted first, in-process in-flight count), reuse-first.
|
|
362
|
+
* None ready (the pooler's demand + cold-wake hold expired) ⇒ demand
|
|
363
|
+
* already submitted pooler-side + `LaneCapacityError`.
|
|
364
|
+
*/
|
|
365
|
+
sessionFor(model: string | undefined, target: RouteTarget): Promise<LanePoolPick>;
|
|
366
|
+
/** Stream-end release of one lane lease (no-op for foreign entries). */
|
|
367
|
+
release(entry: PoolEntry): void;
|
|
368
|
+
owns(entry: PoolEntry): boolean;
|
|
369
|
+
/** The live entry for a lane id (a handle's key), or null once evicted. */
|
|
370
|
+
entryFor(laneId: string): PoolEntry | null;
|
|
371
|
+
/** Read-only per-pool facts for the status endpoint; NEVER mints a demand. */
|
|
372
|
+
status(): Promise<LanePoolStatus[]>;
|
|
373
|
+
/** The lane's host vanished (conns == 0 / remote plane failed): retire it. */
|
|
374
|
+
evict(entry: PoolEntry): void;
|
|
375
|
+
close(): Promise<void>;
|
|
376
|
+
stats(): Array<{
|
|
377
|
+
pool: string;
|
|
378
|
+
laneId: string;
|
|
379
|
+
inFlight: number;
|
|
380
|
+
}>;
|
|
381
|
+
}
|
|
382
|
+
|
|
261
383
|
/**
|
|
262
384
|
* SESSION GONE for the proxy serve lane — level-triggered, keyed off the
|
|
263
385
|
* transport's OWN close/rejection signals (live defect, prod-usw2 2026-08-12).
|
|
@@ -439,9 +561,11 @@ interface DecisionPools {
|
|
|
439
561
|
boot(): Promise<void>;
|
|
440
562
|
/** The rehome seam's sessionFor: least-loaded attached slot lease.
|
|
441
563
|
*
|
|
442
|
-
* THE
|
|
443
|
-
*
|
|
444
|
-
*
|
|
564
|
+
* THE SYNC WARM-WAIT CONTRACT (owner ruling 2026-10-08, superseding the
|
|
565
|
+
* 2026-10-03 no-wait ruling): the dial HOLDS up to the model's warm-wait
|
|
566
|
+
* bound (20s default) against an already-submitted slot open, then throws
|
|
567
|
+
* the typed retryable {@link DecisionPoolCapacityError} with the warming
|
|
568
|
+
* phase split. */
|
|
445
569
|
sessionFor(model: string | undefined): Promise<{
|
|
446
570
|
app: string;
|
|
447
571
|
entry: PoolEntry;
|
|
@@ -457,6 +581,14 @@ interface DecisionPools {
|
|
|
457
581
|
end(entry: PoolEntry): void;
|
|
458
582
|
/** A pool entry's runtime detached: PAUSED + re-submit (re-adopt). */
|
|
459
583
|
evict(entry: PoolEntry): void;
|
|
584
|
+
/**
|
|
585
|
+
* A pool entry's session died a TERMINAL death (410 `reaped_orphaned_request`
|
|
586
|
+
* class — the platform reaped the corpse; see isWedgingVerdict's 410
|
|
587
|
+
* branch): the slot's identity ROTATES (generation bump) so the next
|
|
588
|
+
* acquire mints exactly ONE FRESH logical session instead of re-adopting
|
|
589
|
+
* the corpse and 410-looping until restart (#631).
|
|
590
|
+
*/
|
|
591
|
+
markSessionDead(entry: PoolEntry): void;
|
|
460
592
|
/** Idle scale-down, above min. Owner-driven cadence (the 5s reap tick). */
|
|
461
593
|
reap(): void;
|
|
462
594
|
stats(): Array<{
|
|
@@ -473,6 +605,16 @@ interface DecisionPools {
|
|
|
473
605
|
close(): Promise<void>;
|
|
474
606
|
}
|
|
475
607
|
|
|
608
|
+
/** The pooler channel's auth fence: the in-cluster shared secret. */
|
|
609
|
+
interface PoolerClientConfig {
|
|
610
|
+
/** The pooler service's in-cluster base (`http://pooler.urun.svc:8080`). */
|
|
611
|
+
baseUrl: string;
|
|
612
|
+
/** The shared bearer the proxies present (`URUN_POOLER_TOKEN`). */
|
|
613
|
+
token: string;
|
|
614
|
+
/** The region this proxy serves (`region` in the submit body). */
|
|
615
|
+
region: string;
|
|
616
|
+
}
|
|
617
|
+
|
|
476
618
|
/**
|
|
477
619
|
* PER-CALLER BACKHAULS — the multi-tenant half of the hosted endpoint.
|
|
478
620
|
*
|
|
@@ -544,6 +686,18 @@ interface TenantRegistryOptions {
|
|
|
544
686
|
apiUrl: string;
|
|
545
687
|
/** The model-catalog oracle for routing rule 5, or null. */
|
|
546
688
|
catalog: CatalogConfig | null;
|
|
689
|
+
/**
|
|
690
|
+
* THE VALKEY CATALOG rows (owner ruling: the proxy never touches
|
|
691
|
+
* Supabase). Present ⇒ every tenant's router reads these and `catalog`
|
|
692
|
+
* MUST be null (the two are mutually exclusive on this surface).
|
|
693
|
+
*/
|
|
694
|
+
catalogRows?: () => Promise<CatalogRow[]>;
|
|
695
|
+
/**
|
|
696
|
+
* THE REPLICA'S LANE POOLS (plan A5.2) — one per replica, shared across
|
|
697
|
+
* tenants (a lane belongs to the shared org's app, never to a caller).
|
|
698
|
+
* Present ⇒ every shared req/resp target acquires through the lane pick.
|
|
699
|
+
*/
|
|
700
|
+
lanes?: LanePools;
|
|
547
701
|
/** Injected in tests; production builds real uRun backhauls. A stub may
|
|
548
702
|
* also carry its own `decision` pool (tests drive the readiness ping). */
|
|
549
703
|
build?: (caller: CallerIdentity) => {
|
|
@@ -551,6 +705,14 @@ interface TenantRegistryOptions {
|
|
|
551
705
|
clients: ProxyClients;
|
|
552
706
|
decision?: DecisionPools;
|
|
553
707
|
};
|
|
708
|
+
/**
|
|
709
|
+
* THE POOLER CUTOVER (design ref-shared-endpoint-pooler-design.md):
|
|
710
|
+
* present ⇒ every tenant's `createResponse` routes through the pooler's
|
|
711
|
+
* internal HTTP surface and the proxy holds no pool state — auth +
|
|
712
|
+
* translation only. Absent ⇒ the proxy keeps its own backhaul behavior,
|
|
713
|
+
* byte-identical to before.
|
|
714
|
+
*/
|
|
715
|
+
pooler?: PoolerClientConfig;
|
|
554
716
|
}
|
|
555
717
|
/**
|
|
556
718
|
* A stable, non-secret `subject` for one caller's client tokens. Derived from
|
|
@@ -648,6 +810,10 @@ interface ConversationBackhaulOptions {
|
|
|
648
810
|
apiUrl: string;
|
|
649
811
|
/** The model-catalog oracle for routing rule 5, or null. */
|
|
650
812
|
catalog: CatalogConfig | null;
|
|
813
|
+
/** The Valkey catalog mirror (lane mode) — exclusive with `catalog`. */
|
|
814
|
+
catalogRows?: () => Promise<CatalogRow[]>;
|
|
815
|
+
/** The replica's lane pools: a SHARED model's realtime binding attaches to its lane. */
|
|
816
|
+
lanes?: LanePools;
|
|
651
817
|
/** Injected in tests; production builds real uRun backhauls. */
|
|
652
818
|
build?: (caller: CallerIdentity, conversation: {
|
|
653
819
|
id: string;
|
|
@@ -1070,6 +1236,49 @@ interface HostedConfig {
|
|
|
1070
1236
|
keyId: string;
|
|
1071
1237
|
key: string;
|
|
1072
1238
|
};
|
|
1239
|
+
/**
|
|
1240
|
+
* THE LANE PLANE (plan A5.2) — launcher-injected external inputs; ABSENT ⇒
|
|
1241
|
+
* lane mode is OFF and the proxy's behavior is byte-identical to before.
|
|
1242
|
+
* All four values are required together (half-configured is the
|
|
1243
|
+
* silent-degradation shape — refuse to start).
|
|
1244
|
+
*
|
|
1245
|
+
* URUN_LANE_DOC_HOST_URL the region's PUBLIC doc-host URL the runtime
|
|
1246
|
+
* dials and the registry's proxy_url carries
|
|
1247
|
+
* (e.g. wss://inference.urun.sh);
|
|
1248
|
+
* URUN_LANE_VALKEY_URL the regional Valkey (registry + demand);
|
|
1249
|
+
* URUN_SESSION_TOKEN_SECRET the shared control-plane secret the runtime's
|
|
1250
|
+
* per-dial doc token is minted with (the SAME
|
|
1251
|
+
* value session-server-ts's upgrade auth uses)
|
|
1252
|
+
* — doc upgrades 401 when absent;
|
|
1253
|
+
* URUN_LANE_SELF_ADDRESS this replica's pod-to-pod address
|
|
1254
|
+
* ("<pod ip>:<port>", downward-API injected) —
|
|
1255
|
+
* the lane_hosts self check.
|
|
1256
|
+
*/
|
|
1257
|
+
lane?: {
|
|
1258
|
+
docHostUrl: string;
|
|
1259
|
+
valkeyUrl: string;
|
|
1260
|
+
tokenSecret: string;
|
|
1261
|
+
selfAddress: string;
|
|
1262
|
+
};
|
|
1263
|
+
/**
|
|
1264
|
+
* THE POOLER CUTOVER (shared-endpoint pooler design, owner-DECIDED
|
|
1265
|
+
* 2026-10-10): launcher-injected external inputs; ABSENT ⇒ the proxy keeps
|
|
1266
|
+
* its own backhaul/pool behavior, byte-identical to before. PRESENT ⇒ the
|
|
1267
|
+
* proxy's `createResponse` seam routes through the pooler's internal HTTP
|
|
1268
|
+
* surface and the proxy holds NO pool state (auth + translation only).
|
|
1269
|
+
* All three values are required together (half-configured is the
|
|
1270
|
+
* silent-degradation shape — refuse to start).
|
|
1271
|
+
*
|
|
1272
|
+
* URUN_POOLER_URL the pooler service's in-cluster base
|
|
1273
|
+
* (e.g. http://pooler.urun.svc:8080);
|
|
1274
|
+
* URUN_POOLER_TOKEN the in-cluster shared secret the proxies present;
|
|
1275
|
+
* URUN_POOLER_REGION the region this proxy serves (`region` in submits).
|
|
1276
|
+
*/
|
|
1277
|
+
pooler?: {
|
|
1278
|
+
baseUrl: string;
|
|
1279
|
+
token: string;
|
|
1280
|
+
region: string;
|
|
1281
|
+
};
|
|
1073
1282
|
}
|
|
1074
1283
|
/**
|
|
1075
1284
|
* Read and VALIDATE the deployment's external inputs. Every failure is loud
|
|
@@ -1099,6 +1308,11 @@ declare function resolveHostedConfig(env?: NodeJS.ProcessEnv): HostedConfig;
|
|
|
1099
1308
|
* reachable, because a replica that cannot verify API keys
|
|
1100
1309
|
* or list apps can serve nothing and must be pulled out of
|
|
1101
1310
|
* the Service rather than answering 502s.
|
|
1311
|
+
* GET /lanez the per-pool lane status line (owner hardening
|
|
1312
|
+
* 2026-10-07): which occupant/lane is advertised, whether
|
|
1313
|
+
* its doc host lease is live, this replica's in-flight
|
|
1314
|
+
* counts, the last no-ready refusal. READ-ONLY — it never
|
|
1315
|
+
* mints a demand or wakes compute.
|
|
1102
1316
|
* * /v1/... the compat surface, org-scoped by the Bearer key, including
|
|
1103
1317
|
* the canonical usage-query lane POST /v1/usage/requests
|
|
1104
1318
|
* (proxy/usage.ts — a batch read of the per-request
|
|
@@ -1180,6 +1394,16 @@ interface HostedProxyOptions extends HostedConfig {
|
|
|
1180
1394
|
* assertion on the exposition text is not swamped by process noise.
|
|
1181
1395
|
*/
|
|
1182
1396
|
defaultMetrics?: boolean;
|
|
1397
|
+
/**
|
|
1398
|
+
* THE COMPOSITE REALTIME LANE'S PAIRING SOURCE (ENG-451,
|
|
1399
|
+
* openai-realtime/composite.ts): for each chat-row `?model=`, the pinned
|
|
1400
|
+
* `{stt, tts, voice?}` trio that makes it realtime-capable on
|
|
1401
|
+
* `WS /v1/realtime`. Absent ⇒ the seam answers `null` ⇒ chat models keep
|
|
1402
|
+
* today's loud 404 (behaviour on main, unchanged). The PRODUCTION source
|
|
1403
|
+
* of the pairing (catalog field vs proxy config) is an open owner
|
|
1404
|
+
* decision — this option is the seam the eventual source wires into.
|
|
1405
|
+
*/
|
|
1406
|
+
realtimeCompanions?: RealtimeCompanionsFor;
|
|
1183
1407
|
}
|
|
1184
1408
|
/**
|
|
1185
1409
|
* Build (not listen) the hosted endpoint. The caller owns listen/close,
|
package/dist/hosted/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Server } from 'node:http';
|
|
2
|
+
import { c as LedgerOutcome, I as InferenceRecord, i as RouteTarget, S as SessionGoneError, k as billingIdentityOf, P as ProxyClients, M as ModelRouter, j as UsageRowReporter, b as InferenceUsageRecord, e as LedgerWrite, d as LedgerRecorded, L as LedgerFailure, R as RealtimeCompanionsFor } from '../composite-D9VDruCV.js';
|
|
2
3
|
import * as _prometheus_io_client from '@prometheus-io/client';
|
|
3
4
|
import { Registry } from '@prometheus-io/client';
|
|
4
|
-
import { c as LedgerOutcome, I as InferenceRecord, S as SessionGoneError, j as billingIdentityOf, P as ProxyClients, M as ModelRouter, i as UsageRowReporter, b as InferenceUsageRecord, e as LedgerWrite, d as LedgerRecorded, L as LedgerFailure } from '../responses-turn-BGb_XPOa.js';
|
|
5
5
|
import { createClientToken, SessionPhaseName } from '@urun-sh/core';
|
|
6
6
|
import { U as UrunResponses } from '../ResponsesClient-CSSrOYD8.js';
|
|
7
7
|
import { b as UrunSessionLike } from '../types-CHPtJx6d.js';
|
|
8
|
-
import '../models-
|
|
8
|
+
import { C as CatalogRow } from '../models-D7F0bLJ3.js';
|
|
9
9
|
import '../video-out-Cawtm7SF.js';
|
|
10
10
|
|
|
11
11
|
declare const METRICS_PORT = 9464;
|
|
@@ -50,12 +50,27 @@ declare class InferenceMetrics {
|
|
|
50
50
|
private readonly ledgerQueue;
|
|
51
51
|
private readonly labelCardinality;
|
|
52
52
|
private readonly labelOverflows;
|
|
53
|
+
private readonly lanesReady;
|
|
54
|
+
private readonly lanePickMs;
|
|
55
|
+
private readonly laneFirstEventMs;
|
|
56
|
+
private readonly lane503Fast;
|
|
57
|
+
|
|
58
|
+
private readonly laneDocTenantMissing;
|
|
59
|
+
|
|
60
|
+
private readonly buildInfo;
|
|
53
61
|
constructor(options?: {
|
|
54
62
|
defaultMetrics?: boolean;
|
|
55
63
|
});
|
|
56
64
|
|
|
57
65
|
observeLedger(outcome: LedgerOutcome): void;
|
|
58
66
|
|
|
67
|
+
observeLaneReady(model: string, count: number): void;
|
|
68
|
+
observeLanePick(model: string, durationMs: number): void;
|
|
69
|
+
observeLaneFirstEvent(model: string, durationMs: number): void;
|
|
70
|
+
observeLane503Fast(model: string): void;
|
|
71
|
+
|
|
72
|
+
observeLaneDocTenantMissing(): void;
|
|
73
|
+
|
|
59
74
|
observe(record: InferenceRecord): void;
|
|
60
75
|
|
|
61
76
|
scrape(): Promise<string>;
|
|
@@ -71,12 +86,20 @@ declare class ProxyAuthError extends Error {
|
|
|
71
86
|
}
|
|
72
87
|
|
|
73
88
|
declare class ControlPlaneUnavailableError extends Error {
|
|
74
|
-
|
|
89
|
+
|
|
90
|
+
readonly detail?: string;
|
|
91
|
+
constructor(message: string, detail?: string);
|
|
75
92
|
}
|
|
76
93
|
|
|
77
94
|
interface CallerIdentity {
|
|
78
95
|
apiKey: string;
|
|
79
96
|
orgId: string;
|
|
97
|
+
|
|
98
|
+
billingAudience?: string;
|
|
99
|
+
|
|
100
|
+
creditsAdmissionOk?: boolean;
|
|
101
|
+
|
|
102
|
+
creditsRefusalReason?: string;
|
|
80
103
|
}
|
|
81
104
|
|
|
82
105
|
declare function bearerFrom(headerValue: string | undefined): string;
|
|
@@ -99,7 +122,6 @@ declare class OrgResolver {
|
|
|
99
122
|
private readonly mint;
|
|
100
123
|
private readonly now;
|
|
101
124
|
constructor(opts: OrgResolverOptions);
|
|
102
|
-
|
|
103
125
|
resolve(apiKey: string): Promise<CallerIdentity>;
|
|
104
126
|
|
|
105
127
|
clear(): void;
|
|
@@ -123,6 +145,64 @@ interface DecisionPoolStats {
|
|
|
123
145
|
lastMissAgeMs: number | null;
|
|
124
146
|
}
|
|
125
147
|
|
|
148
|
+
interface LaneRegistryStatusRow {
|
|
149
|
+
laneId: string;
|
|
150
|
+
occupantId: string;
|
|
151
|
+
capacity: number;
|
|
152
|
+
|
|
153
|
+
heartbeatAgeMs: number | null;
|
|
154
|
+
|
|
155
|
+
advertisedHere: boolean;
|
|
156
|
+
|
|
157
|
+
hosted: boolean;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
interface LanePoolPick {
|
|
161
|
+
app: string;
|
|
162
|
+
entry: PoolEntry;
|
|
163
|
+
identity: {
|
|
164
|
+
kind: 'catalog';
|
|
165
|
+
model_id: string;
|
|
166
|
+
variant: string;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
interface LaneStatusRow extends LaneRegistryStatusRow {
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
interface LanePoolStatus {
|
|
174
|
+
pool: string;
|
|
175
|
+
lanes: LaneStatusRow[];
|
|
176
|
+
|
|
177
|
+
local: Array<{
|
|
178
|
+
laneId: string;
|
|
179
|
+
inFlight: number;
|
|
180
|
+
self: boolean;
|
|
181
|
+
host: string;
|
|
182
|
+
}>;
|
|
183
|
+
lastRefusalAt: number | null;
|
|
184
|
+
lastDemandAt: number | null;
|
|
185
|
+
}
|
|
186
|
+
interface LanePools {
|
|
187
|
+
|
|
188
|
+
sessionFor(model: string | undefined, target: RouteTarget): Promise<LanePoolPick>;
|
|
189
|
+
|
|
190
|
+
release(entry: PoolEntry): void;
|
|
191
|
+
owns(entry: PoolEntry): boolean;
|
|
192
|
+
|
|
193
|
+
entryFor(laneId: string): PoolEntry | null;
|
|
194
|
+
|
|
195
|
+
status(): Promise<LanePoolStatus[]>;
|
|
196
|
+
|
|
197
|
+
evict(entry: PoolEntry): void;
|
|
198
|
+
close(): Promise<void>;
|
|
199
|
+
stats(): Array<{
|
|
200
|
+
pool: string;
|
|
201
|
+
laneId: string;
|
|
202
|
+
inFlight: number;
|
|
203
|
+
}>;
|
|
204
|
+
}
|
|
205
|
+
|
|
126
206
|
interface SessionGoneWatch {
|
|
127
207
|
|
|
128
208
|
gone(): SessionGoneError | null;
|
|
@@ -188,6 +268,8 @@ interface DecisionPools {
|
|
|
188
268
|
|
|
189
269
|
evict(entry: PoolEntry): void;
|
|
190
270
|
|
|
271
|
+
markSessionDead(entry: PoolEntry): void;
|
|
272
|
+
|
|
191
273
|
reap(): void;
|
|
192
274
|
stats(): Array<{
|
|
193
275
|
poolKey: string;
|
|
@@ -197,6 +279,15 @@ interface DecisionPools {
|
|
|
197
279
|
close(): Promise<void>;
|
|
198
280
|
}
|
|
199
281
|
|
|
282
|
+
interface PoolerClientConfig {
|
|
283
|
+
|
|
284
|
+
baseUrl: string;
|
|
285
|
+
|
|
286
|
+
token: string;
|
|
287
|
+
|
|
288
|
+
region: string;
|
|
289
|
+
}
|
|
290
|
+
|
|
200
291
|
declare const MAX_TENANTS = 512;
|
|
201
292
|
interface TenantRegistryOptions {
|
|
202
293
|
|
|
@@ -206,11 +297,17 @@ interface TenantRegistryOptions {
|
|
|
206
297
|
|
|
207
298
|
catalog: CatalogConfig | null;
|
|
208
299
|
|
|
300
|
+
catalogRows?: () => Promise<CatalogRow[]>;
|
|
301
|
+
|
|
302
|
+
lanes?: LanePools;
|
|
303
|
+
|
|
209
304
|
build?: (caller: CallerIdentity) => {
|
|
210
305
|
router: ModelRouter<PoolEntry>;
|
|
211
306
|
clients: ProxyClients;
|
|
212
307
|
decision?: DecisionPools;
|
|
213
308
|
};
|
|
309
|
+
|
|
310
|
+
pooler?: PoolerClientConfig;
|
|
214
311
|
}
|
|
215
312
|
|
|
216
313
|
declare function tenantSubject(apiKey: string): string;
|
|
@@ -258,6 +355,10 @@ interface ConversationBackhaulOptions {
|
|
|
258
355
|
|
|
259
356
|
catalog: CatalogConfig | null;
|
|
260
357
|
|
|
358
|
+
catalogRows?: () => Promise<CatalogRow[]>;
|
|
359
|
+
|
|
360
|
+
lanes?: LanePools;
|
|
361
|
+
|
|
261
362
|
build?: (caller: CallerIdentity, conversation: {
|
|
262
363
|
id: string;
|
|
263
364
|
subject: string;
|
|
@@ -367,6 +468,19 @@ interface HostedConfig {
|
|
|
367
468
|
keyId: string;
|
|
368
469
|
key: string;
|
|
369
470
|
};
|
|
471
|
+
|
|
472
|
+
lane?: {
|
|
473
|
+
docHostUrl: string;
|
|
474
|
+
valkeyUrl: string;
|
|
475
|
+
tokenSecret: string;
|
|
476
|
+
selfAddress: string;
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
pooler?: {
|
|
480
|
+
baseUrl: string;
|
|
481
|
+
token: string;
|
|
482
|
+
region: string;
|
|
483
|
+
};
|
|
370
484
|
}
|
|
371
485
|
|
|
372
486
|
declare function resolveHostedConfig(env?: NodeJS.ProcessEnv): HostedConfig;
|
|
@@ -396,6 +510,8 @@ interface HostedProxyOptions extends HostedConfig {
|
|
|
396
510
|
requestLog?: (line: string) => void;
|
|
397
511
|
|
|
398
512
|
defaultMetrics?: boolean;
|
|
513
|
+
|
|
514
|
+
realtimeCompanions?: RealtimeCompanionsFor;
|
|
399
515
|
}
|
|
400
516
|
|
|
401
517
|
declare function createHostedProxy(options: HostedProxyOptions): {
|
package/dist/hosted/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as x,B as v,C as m,D as y,E as B,F as H,G as P,H as u,I as G,J as U,K as F,L as X,M as Y,N as b,O as h,P as k,Q as K,R as V,S as j,T as W,U as q,a as r,b as o,c as t,d as E,e as n,f as _,g as a,h as T,i as O,j as i,k as s,l as I,m as p,n as A,o as R,p as S,q as N,r as C,s as D,t as L,u as M,v as d,w as f,x as l,y as c,z as g}from"../chunk-
|
|
1
|
+
import{A as x,B as v,C as m,D as y,E as B,F as H,G as P,H as u,I as G,J as U,K as F,L as X,M as Y,N as b,O as h,P as k,Q as K,R as V,S as j,T as W,U as q,a as r,b as o,c as t,d as E,e as n,f as _,g as a,h as T,i as O,j as i,k as s,l as I,m as p,n as A,o as R,p as S,q as N,r as C,s as D,t as L,u as M,v as d,w as f,x as l,y as c,z as g}from"../chunk-PBKCUSTI.js";import"../chunk-7D2HMQFC.js";import"../chunk-CAR4AEQJ.js";import"../chunk-GR3UAW6P.js";import"../chunk-3JWYIKHM.js";import"../chunk-6M5JK4YC.js";import"../chunk-PAYCMH5F.js";import"../chunk-L6HTHDVV.js";import"../chunk-NL3UBLXV.js";import"../chunk-GL7EWL3V.js";import"../chunk-NN6TQQUG.js";import"../chunk-OOCRI7ZM.js";import{c as e}from"../chunk-YSFSRI3D.js";e();export{N as ANONYMOUS_KEY_ID,y as BIND_HOST,R as BUCKET_DOMAIN,O as BoundedLabel,f as ControlPlaneUnavailableError,X as ConversationBackhauls,F as ConversationCapacityError,v as DEFAULT_PORT,I as EDGE_IDENTITY_PORT,A as EDGE_KEY_FINGERPRINT_HEADER,p as EDGE_KEY_ID_HEADER,i as InferenceMetrics,Y as LEDGER_FUNCTION_PATH,b as LEDGER_WRITE_TIMEOUT_MS,V as LedgerClient,h as LedgerDuplicateError,k as LedgerSurfaceError,g as MAX_CACHED_KEYS,G as MAX_CONVERSATIONS,U as MAX_CONVERSATION_HANDLES,n as MAX_MODEL_LABELS,_ as MAX_ORG_LABELS,H as MAX_TENANTS,o as METRICS_PATH,r as METRICS_PORT,E as NO_MODEL_LABEL,c as ORG_BINDING_TTL_MS,t as OTHER_LABEL,x as OrgResolver,d as ProxyAuthError,W as READINESS_TIMEOUT_MS,j as READINESS_TTL_MS,m as SERVE_FUNCTION,S as TIER_DOMAIN,u as TenantRegistry,l as bearerFrom,L as bearerTokenOf,M as createEdgeIdentityServer,q as createHostedProxy,s as createMetricsServer,C as edgeBucketId,D as edgeTierFingerprint,a as laneOf,K as parseLedgerRecorded,B as resolveHostedConfig,T as statusClassOf,P as tenantSubject};
|