@urun-sh/openai 0.6.25 → 0.6.27
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-PPPJ42Z7.js → chunk-4MQCXL73.js} +1 -1
- package/dist/{chunk-SOAZAPCO.js → chunk-BGAV27A5.js} +2 -2
- package/dist/chunk-VHWL6HP5.js +8 -0
- package/dist/hosted/bin.cjs +28 -27
- package/dist/hosted/bin.js +1 -1
- package/dist/hosted/index.cjs +31 -30
- package/dist/hosted/index.d.cts +77 -22
- package/dist/hosted/index.d.ts +13 -1
- package/dist/hosted/index.js +1 -1
- package/dist/pi-extension/standalone.cjs +54 -54
- package/dist/proxy/cli.cjs +2 -2
- package/dist/proxy/cli.js +1 -1
- package/dist/proxy/index.cjs +1 -1
- 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-C0PBaF29.d.cts → responses-turn-BFURb0jK.d.cts} +16 -3
- package/dist/{responses-turn-2UJImii3.d.ts → responses-turn-Cxfv-oXb.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-VY333OKA.js +0 -7
package/dist/hosted/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Server } from 'node:http';
|
|
2
2
|
import * as _prometheus_io_client from '@prometheus-io/client';
|
|
3
3
|
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-
|
|
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-BFURb0jK.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';
|
|
@@ -795,7 +795,11 @@ declare class UsageClient {
|
|
|
795
795
|
*
|
|
796
796
|
* The proxy holds no database credential and no standing platform secret
|
|
797
797
|
* (hosted/auth.ts: "NO STANDING CREDENTIAL... every upstream call it makes
|
|
798
|
-
* rides the CALLER'S OWN key")
|
|
798
|
+
* rides the CALLER'S OWN key") — with the ONE deliberate ENG-410 exception:
|
|
799
|
+
* the pod-held ledger SIGNING key (URUN_LEDGER_SIGNING_KEY) below, which signs
|
|
800
|
+
* the row's CONTENT and never authenticates a request; the caller's own org
|
|
801
|
+
* key still derives tenancy — ADDITIVE, never a replacement (the ENG-409
|
|
802
|
+
* ruling stands verbatim). So the ledger write rides the caller's own org
|
|
799
803
|
* API key to the control plane's `inference-ledger` function — the same
|
|
800
804
|
* mechanism and the same credential the ENG-318 read already uses — and the
|
|
801
805
|
* control plane derives the org AND the api_key_id from that key server-side
|
|
@@ -808,7 +812,9 @@ declare class UsageClient {
|
|
|
808
812
|
* the bill: a caller can read its `Inference-Id` off a streaming response head
|
|
809
813
|
* and race a fabricated row in ahead of this one. The control plane refuses
|
|
810
814
|
* the second write rather than upserting, so the attempt is LOUD instead of
|
|
811
|
-
* silent — see {@link LedgerDuplicateError}.
|
|
815
|
+
* silent — see {@link LedgerDuplicateError}. Since ENG-410 the row's CONTENT
|
|
816
|
+
* is also signed (see the ruling below), so a fabricated row that arrives
|
|
817
|
+
* WITHOUT the proxy's signature is refused on sight as well.
|
|
812
818
|
*
|
|
813
819
|
* ============================ THE ENG-410 RULING ============================
|
|
814
820
|
*
|
|
@@ -845,26 +851,30 @@ declare class UsageClient {
|
|
|
845
851
|
* `inference_id` is minted here. Authenticating the id would not help either —
|
|
846
852
|
* the attacker holds a LEGITIMATE id, read from its own response head.
|
|
847
853
|
*
|
|
848
|
-
*
|
|
849
|
-
* signs the row's CONTENT, verified
|
|
850
|
-
* caller's key so tenancy is untouched).
|
|
851
|
-
*
|
|
852
|
-
*
|
|
853
|
-
*
|
|
854
|
-
*
|
|
855
|
-
* 100% OF LEDGER ROWS TO ZERO ACROSS EVERY ORG
|
|
856
|
-
*
|
|
857
|
-
*
|
|
858
|
-
*
|
|
854
|
+
* BUILT (ENG-410, owner ruling 2026-10-02, option 2 — the signed row) — MAKE
|
|
855
|
+
* THE ROW UNFORGEABLE (a proxy-held key that signs the row's CONTENT, verified
|
|
856
|
+
* by the control plane, ADDITIVE to the caller's key so tenancy is untouched).
|
|
857
|
+
* The deferral's reasoning is kept because it is what shaped the build: the
|
|
858
|
+
* blast radius is small — a stolen signing key only restores today's position,
|
|
859
|
+
* because the row still lands in whatever org the thief's own key names. The
|
|
860
|
+
* residual risk is exactly the one the deferral feared: a misconfigured or
|
|
861
|
+
* badly-rotated key takes 100% OF LEDGER ROWS TO ZERO ACROSS EVERY ORG. That
|
|
862
|
+
* is why the refusal has its OWN NAMED REASON (`ledger_signature_invalid`,
|
|
863
|
+
* {@link LedgerSignatureError}) rather than folding into `surface` — the
|
|
864
|
+
* ENG-419 alert must be a field match — and why the enforcement flip is an
|
|
865
|
+
* EXPLICIT control-plane decision (`URUN_LEDGER_SIGNATURE_REQUIRED`): until
|
|
866
|
+
* the flip the control plane's tolerance window accepts unsigned rows, so the
|
|
867
|
+
* deploy order is verify-side, sign-side, flip, and nothing on this side can
|
|
868
|
+
* zero the table by itself.
|
|
859
869
|
*
|
|
860
|
-
* THE TRIGGER,
|
|
861
|
-
* `public.inference_requests`.
|
|
862
|
-
* org
|
|
863
|
-
*
|
|
864
|
-
*
|
|
865
|
-
* stops being true, and it must not be the moment this is discovered.
|
|
870
|
+
* THE TRIGGER, HONOURED: build it BEFORE ANY PRODUCT BILLS OFF
|
|
871
|
+
* `public.inference_requests`. HF traffic still authenticates as HF's own
|
|
872
|
+
* org and self-serve is still billed off `usage_events`, but the credits /
|
|
873
|
+
* concurrency-tier / retention-tier product is coming — the signature is in
|
|
874
|
+
* place before that moment arrives, which is what the ruling required.
|
|
866
875
|
*
|
|
867
|
-
*
|
|
876
|
+
* WHILE THE TOLERANCE WINDOW STANDS, THE DETECTION REMAINS THE CONTROL, so it
|
|
877
|
+
* is built to be OPERATED
|
|
868
878
|
* rather than merely to exist: the refusal carries a machine-readable
|
|
869
879
|
* `ledgerFailureReason` (`proxy/ledger.ts` {@link LedgerFailure}) that reaches
|
|
870
880
|
* both the structured log line and a Prometheus counter, so the alert is a
|
|
@@ -924,11 +934,30 @@ declare class LedgerSurfaceError extends Error implements LedgerFailure {
|
|
|
924
934
|
readonly ledgerFailureReason: "surface";
|
|
925
935
|
constructor(message: string);
|
|
926
936
|
}
|
|
937
|
+
/**
|
|
938
|
+
* ENG-410 BUILT: the pod-held key that signs the billable ledger row's
|
|
939
|
+
* CONTENT — the hosted service's FIRST standing secret, and deliberately only
|
|
940
|
+
* a content signature: it never authenticates a request, and the caller's own
|
|
941
|
+
* org key still derives tenancy (ADDITIVE, never a replacement — ENG-409).
|
|
942
|
+
* Resolved from URUN_LEDGER_SIGNING_KEY + URUN_LEDGER_SIGNING_KEY_ID
|
|
943
|
+
* (`hosted/config.ts`, both-or-neither).
|
|
944
|
+
*/
|
|
945
|
+
interface LedgerSigning {
|
|
946
|
+
keyId: string;
|
|
947
|
+
key: string;
|
|
948
|
+
}
|
|
927
949
|
interface LedgerClientOptions {
|
|
928
950
|
/** The org control-plane API base (`{apiUrl}`) the function is mounted under. */
|
|
929
951
|
apiUrl: string;
|
|
930
952
|
/** Injected in tests; production uses the platform fetch. */
|
|
931
953
|
fetchImpl?: typeof fetch;
|
|
954
|
+
/**
|
|
955
|
+
* ENG-410 BUILT: when present, EVERY row is signed the same way — no
|
|
956
|
+
* audience branch, distributor and platform traffic ride one write path.
|
|
957
|
+
* Absent, the body is sent UNCHANGED (the control plane's tolerance window
|
|
958
|
+
* accepts unsigned rows until the URUN_LEDGER_SIGNATURE_REQUIRED flip).
|
|
959
|
+
*/
|
|
960
|
+
signing?: LedgerSigning;
|
|
932
961
|
}
|
|
933
962
|
/**
|
|
934
963
|
* Validate the control plane's answer into the record the caller logs.
|
|
@@ -946,7 +975,7 @@ declare class LedgerClient {
|
|
|
946
975
|
private readonly fetchImpl;
|
|
947
976
|
constructor(opts: LedgerClientOptions);
|
|
948
977
|
/**
|
|
949
|
-
* Write one row.
|
|
978
|
+
* Write one row. Six outcomes, all explicit:
|
|
950
979
|
* - the control plane records it → the validated {@link LedgerRecorded},
|
|
951
980
|
* priced or with an `unpriced_reason`;
|
|
952
981
|
* - the id is already there AND the stored row is OURS (409) →
|
|
@@ -955,6 +984,8 @@ declare class LedgerClient {
|
|
|
955
984
|
* - the id is already there and the row is NOT ours, or cannot be read
|
|
956
985
|
* back to check (409) → {@link LedgerDuplicateError};
|
|
957
986
|
* - it rejects the key (401/403) → {@link LedgerAuthError};
|
|
987
|
+
* - it refuses the row's SIGNATURE (ENG-410 BUILT) →
|
|
988
|
+
* {@link LedgerSignatureError};
|
|
958
989
|
* - anything else → {@link LedgerSurfaceError}.
|
|
959
990
|
*
|
|
960
991
|
* THE CALLER RETRIES, NOT THIS METHOD (ENG-415). One call is one attempt;
|
|
@@ -980,6 +1011,15 @@ declare class LedgerClient {
|
|
|
980
1011
|
* platform secret: every upstream call rides the CALLER'S own org API key
|
|
981
1012
|
* (see hosted/auth.ts), which is what lets an internet-facing shared endpoint
|
|
982
1013
|
* exist without mounting an org-wide credential onto it.
|
|
1014
|
+
*
|
|
1015
|
+
* THE ONE EXCEPTION, DELIBERATE (ENG-410, owner ruling 2026-10-02, option 2 —
|
|
1016
|
+
* the signed row): URUN_LEDGER_SIGNING_KEY + URUN_LEDGER_SIGNING_KEY_ID are
|
|
1017
|
+
* this hosted service's FIRST standing secret. They sign the CONTENT of the
|
|
1018
|
+
* billable ledger row (HMAC-SHA256, verified by the control plane) and are
|
|
1019
|
+
* used for NOTHING ELSE: they never authenticate a request, and the caller's
|
|
1020
|
+
* own org key still derives tenancy on every write — ADDITIVE to the caller's
|
|
1021
|
+
* key, never a replacement for it (the ENG-409 ruling stands verbatim). A
|
|
1022
|
+
* stolen signing key therefore only restores today's pre-ENG-410 position.
|
|
983
1023
|
*/
|
|
984
1024
|
|
|
985
1025
|
/**
|
|
@@ -1015,6 +1055,21 @@ interface HostedConfig {
|
|
|
1015
1055
|
apiUrl: string;
|
|
1016
1056
|
/** The `model_catalog` oracle for routing rule 5, or null when unconfigured. */
|
|
1017
1057
|
catalog: CatalogConfig | null;
|
|
1058
|
+
/**
|
|
1059
|
+
* ENG-410 BUILT: the pod-held key that signs the billable ledger row's
|
|
1060
|
+
* CONTENT (HMAC-SHA256 over the canonical row string, verified by the
|
|
1061
|
+
* control plane). The FIRST standing secret this service holds, and ONLY a
|
|
1062
|
+
* content signature: it never authenticates a request, and the caller's own
|
|
1063
|
+
* org key still derives tenancy — ADDITIVE, never a replacement (ENG-409).
|
|
1064
|
+
* Optional: unconfigured, rows are sent unsigned and the control plane's
|
|
1065
|
+
* tolerance window accepts them (the enforcement flip —
|
|
1066
|
+
* URUN_LEDGER_SIGNATURE_REQUIRED — is a later, explicit control-plane
|
|
1067
|
+
* decision). Both-or-neither is enforced below, loudly.
|
|
1068
|
+
*/
|
|
1069
|
+
ledgerSigning?: {
|
|
1070
|
+
keyId: string;
|
|
1071
|
+
key: string;
|
|
1072
|
+
};
|
|
1018
1073
|
}
|
|
1019
1074
|
/**
|
|
1020
1075
|
* Read and VALIDATE the deployment's external inputs. Every failure is loud
|
package/dist/hosted/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Server } from 'node:http';
|
|
2
2
|
import * as _prometheus_io_client from '@prometheus-io/client';
|
|
3
3
|
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-
|
|
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-Cxfv-oXb.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';
|
|
@@ -323,11 +323,18 @@ declare class LedgerSurfaceError extends Error implements LedgerFailure {
|
|
|
323
323
|
readonly ledgerFailureReason: "surface";
|
|
324
324
|
constructor(message: string);
|
|
325
325
|
}
|
|
326
|
+
|
|
327
|
+
interface LedgerSigning {
|
|
328
|
+
keyId: string;
|
|
329
|
+
key: string;
|
|
330
|
+
}
|
|
326
331
|
interface LedgerClientOptions {
|
|
327
332
|
|
|
328
333
|
apiUrl: string;
|
|
329
334
|
|
|
330
335
|
fetchImpl?: typeof fetch;
|
|
336
|
+
|
|
337
|
+
signing?: LedgerSigning;
|
|
331
338
|
}
|
|
332
339
|
|
|
333
340
|
declare function parseLedgerRecorded(raw: unknown, where: string): LedgerRecorded;
|
|
@@ -355,6 +362,11 @@ interface HostedConfig {
|
|
|
355
362
|
apiUrl: string;
|
|
356
363
|
|
|
357
364
|
catalog: CatalogConfig | null;
|
|
365
|
+
|
|
366
|
+
ledgerSigning?: {
|
|
367
|
+
keyId: string;
|
|
368
|
+
key: string;
|
|
369
|
+
};
|
|
358
370
|
}
|
|
359
371
|
|
|
360
372
|
declare function resolveHostedConfig(env?: NodeJS.ProcessEnv): HostedConfig;
|
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-VHWL6HP5.js";import"../chunk-4MQCXL73.js";import"../chunk-K23AZPI4.js";import"../chunk-BGAV27A5.js";import"../chunk-76BZLCGT.js";import"../chunk-CUDFHFNX.js";import"../chunk-3JWYIKHM.js";import"../chunk-6M5JK4YC.js";import"../chunk-7V2JKPIG.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};
|