@omnicross/core 0.1.7 → 0.1.9
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/{ProviderProxy-C-xqrkKi.d.ts → ProviderProxy--ROec6VI.d.ts} +22 -3
- package/dist/{ProviderProxy-CnMQYN59.d.cts → ProviderProxy-QdwNV6l1.d.cts} +22 -3
- package/dist/auth/GeminiCodeAssistProjectResolver.cjs +5 -3
- package/dist/auth/GeminiCodeAssistProjectResolver.js +4 -2
- package/dist/{chunk-N5T4M4GU.js → chunk-2UTGX6FM.js} +2 -2
- package/dist/{chunk-32O35CIF.js → chunk-45FHEOKW.js} +22 -7
- package/dist/{chunk-LVUCAWMK.js → chunk-55FMGZ3L.js} +13 -5
- package/dist/{chunk-OF3BECU2.cjs → chunk-56QD3YW6.cjs} +18 -5
- package/dist/{chunk-V4TXMEJS.cjs → chunk-5LNYGCIW.cjs} +15 -7
- package/dist/chunk-77USGNRW.cjs +37 -0
- package/dist/chunk-AOFWNWLT.cjs +203 -0
- package/dist/{chunk-LB6EBS6Y.js → chunk-CCVRRJOX.js} +17 -4
- package/dist/{chunk-OVQBNVSV.cjs → chunk-CMVXX7ON.cjs} +42 -27
- package/dist/{chunk-E3COOKUP.js → chunk-CQIJCPMF.js} +1108 -271
- package/dist/{chunk-OJGQKHN5.cjs → chunk-EPN67EGP.cjs} +3 -0
- package/dist/{chunk-PEGTIPB3.js → chunk-HKB656B4.js} +37 -43
- package/dist/chunk-N2EIM2XJ.js +203 -0
- package/dist/{chunk-MYYR3HZL.js → chunk-NGYOO5TO.js} +5 -5
- package/dist/{chunk-OKMJLEXX.cjs → chunk-OC6DOOFX.cjs} +5 -5
- package/dist/{chunk-2Z4XM3H5.cjs → chunk-P7EM6BND.cjs} +10 -10
- package/dist/{chunk-KBM2W6UY.cjs → chunk-RICPANBY.cjs} +41 -24
- package/dist/{chunk-TOVPMMHM.js → chunk-S3DYFEBE.js} +37 -20
- package/dist/{chunk-SOO562NM.js → chunk-UAPBLNN2.js} +3 -0
- package/dist/chunk-WYVGULTQ.js +37 -0
- package/dist/{chunk-4BB343BI.cjs → chunk-XELFM7KL.cjs} +1381 -544
- package/dist/{chunk-OXHNSZ53.cjs → chunk-ZQQUD66M.cjs} +54 -60
- package/dist/completion/ApiKeyPoolService.cjs +32 -1
- package/dist/completion/ApiKeyPoolService.d.cts +17 -1
- package/dist/completion/ApiKeyPoolService.d.ts +17 -1
- package/dist/completion/ApiKeyPoolService.js +31 -0
- package/dist/completion/CompletionService.cjs +13 -11
- package/dist/completion/CompletionService.js +12 -10
- package/dist/completion.cjs +13 -11
- package/dist/completion.js +12 -10
- package/dist/index.cjs +69 -11
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +68 -10
- package/dist/outbound-api/routeResolver.d.cts +4 -4
- package/dist/outbound-api/routeResolver.d.ts +4 -4
- package/dist/outbound-api/types.d.cts +3 -3
- package/dist/outbound-api/types.d.ts +3 -3
- package/dist/outbound-api.cjs +13 -11
- package/dist/outbound-api.d.cts +5 -5
- package/dist/outbound-api.d.ts +5 -5
- package/dist/outbound-api.js +12 -10
- package/dist/pipeline/AccountAllowanceScheduling.d.cts +3 -3
- package/dist/pipeline/AccountAllowanceScheduling.d.ts +3 -3
- package/dist/pipeline/executeProviderCall.d.cts +2 -0
- package/dist/pipeline/executeProviderCall.d.ts +2 -0
- package/dist/pipeline/resolveProviderChain.d.cts +1 -0
- package/dist/pipeline/resolveProviderChain.d.ts +1 -0
- package/dist/pipeline/resolveSubscriptionChain.d.cts +2 -0
- package/dist/pipeline/resolveSubscriptionChain.d.ts +2 -0
- package/dist/ports/provider-config-source.d.cts +1 -0
- package/dist/ports/provider-config-source.d.ts +1 -0
- package/dist/ports.d.cts +3 -3
- package/dist/ports.d.ts +3 -3
- package/dist/provider-proxy/ProviderProxy.cjs +13 -11
- package/dist/provider-proxy/ProviderProxy.d.cts +1 -1
- package/dist/provider-proxy/ProviderProxy.d.ts +1 -1
- package/dist/provider-proxy/ProviderProxy.js +12 -10
- package/dist/provider-proxy/ingress/providerProxyShared.cjs +13 -11
- package/dist/provider-proxy/ingress/providerProxyShared.js +12 -10
- package/dist/provider-proxy/types.d.cts +15 -1
- package/dist/provider-proxy/types.d.ts +15 -1
- package/dist/provider-proxy.cjs +69 -11
- package/dist/provider-proxy.d.cts +254 -8
- package/dist/provider-proxy.d.ts +254 -8
- package/dist/provider-proxy.js +70 -12
- package/dist/{routeResolver-BxOfunbm.d.ts → routeResolver-C0mkkZaM.d.ts} +1 -1
- package/dist/{routeResolver-D5OzD0iM.d.cts → routeResolver-CVFE8KKe.d.cts} +1 -1
- package/dist/transformer/TransformerChainExecutor.d.cts +2 -0
- package/dist/transformer/TransformerChainExecutor.d.ts +2 -0
- package/dist/transformer/TransformerService.d.cts +2 -0
- package/dist/transformer/TransformerService.d.ts +2 -0
- package/dist/transformer/transformers/AnthropicTransformer.cjs +4 -2
- package/dist/transformer/transformers/AnthropicTransformer.d.cts +7 -2
- package/dist/transformer/transformers/AnthropicTransformer.d.ts +7 -2
- package/dist/transformer/transformers/AnthropicTransformer.js +3 -1
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +5 -3
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.d.cts +2 -0
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.d.ts +2 -0
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +4 -2
- package/dist/transformer/transformers/GeminiTransformer.cjs +5 -3
- package/dist/transformer/transformers/GeminiTransformer.d.cts +4 -2
- package/dist/transformer/transformers/GeminiTransformer.d.ts +4 -2
- package/dist/transformer/transformers/GeminiTransformer.js +4 -2
- package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +3 -2
- package/dist/transformer/transformers/OpenAIResponseTransformer.d.cts +4 -2
- package/dist/transformer/transformers/OpenAIResponseTransformer.d.ts +4 -2
- package/dist/transformer/transformers/OpenAIResponseTransformer.js +2 -1
- package/dist/transformer/transformers/OpenAITransformer.cjs +3 -2
- package/dist/transformer/transformers/OpenAITransformer.d.cts +3 -1
- package/dist/transformer/transformers/OpenAITransformer.d.ts +3 -1
- package/dist/transformer/transformers/OpenAITransformer.js +2 -1
- package/dist/transformer/transformers.cjs +10 -8
- package/dist/transformer/transformers.d.cts +2 -0
- package/dist/transformer/transformers.d.ts +2 -0
- package/dist/transformer/transformers.js +9 -7
- package/dist/transformer/types.d.cts +16 -5
- package/dist/transformer/types.d.ts +16 -5
- package/dist/transformer.cjs +28 -9
- package/dist/transformer.d.cts +76 -1
- package/dist/transformer.d.ts +76 -1
- package/dist/transformer.js +28 -9
- package/dist/{types-CqZD77rS.d.ts → types-BB8pxk_3.d.ts} +1 -1
- package/dist/{types-gjJ5lJ5n.d.cts → types-C2MwkLah.d.cts} +1 -1
- package/dist/usage/usage-recorder.cjs +2 -2
- package/dist/usage/usage-recorder.d.cts +6 -0
- package/dist/usage/usage-recorder.d.ts +6 -0
- package/dist/usage/usage-recorder.js +1 -1
- package/dist/usage.cjs +2 -2
- package/dist/usage.js +1 -1
- package/package.json +1 -1
- /package/dist/{chunk-FZ46M34D.cjs → chunk-QVOB2DNX.cjs} +0 -0
- /package/dist/{chunk-46RLHI7D.js → chunk-WTQMX2Q6.js} +0 -0
package/dist/provider-proxy.cjs
CHANGED
|
@@ -5,18 +5,46 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
var _chunkXELFM7KLcjs = require('./chunk-XELFM7KL.cjs');
|
|
9
37
|
require('./chunk-HQP3K7PU.cjs');
|
|
10
|
-
require('./chunk-
|
|
11
|
-
require('./chunk-
|
|
12
|
-
require('./chunk-
|
|
13
|
-
require('./chunk-
|
|
14
|
-
require('./chunk-
|
|
38
|
+
require('./chunk-QVOB2DNX.cjs');
|
|
39
|
+
require('./chunk-P7EM6BND.cjs');
|
|
40
|
+
require('./chunk-ZQQUD66M.cjs');
|
|
41
|
+
require('./chunk-5LNYGCIW.cjs');
|
|
42
|
+
require('./chunk-CMVXX7ON.cjs');
|
|
15
43
|
require('./chunk-5RSZYQJH.cjs');
|
|
16
|
-
require('./chunk-
|
|
44
|
+
require('./chunk-56QD3YW6.cjs');
|
|
17
45
|
require('./chunk-EYZYXJTJ.cjs');
|
|
18
46
|
require('./chunk-2E42SAW3.cjs');
|
|
19
|
-
require('./chunk-
|
|
47
|
+
require('./chunk-EPN67EGP.cjs');
|
|
20
48
|
require('./chunk-IIRPUVPH.cjs');
|
|
21
49
|
require('./chunk-GBHYAGX3.cjs');
|
|
22
50
|
require('./chunk-3OPYJG76.cjs');
|
|
@@ -48,8 +76,10 @@ require('./chunk-FCR77GYM.cjs');
|
|
|
48
76
|
require('./chunk-AEOZIDEB.cjs');
|
|
49
77
|
require('./chunk-XSVNC2UD.cjs');
|
|
50
78
|
require('./chunk-GDIXXKF2.cjs');
|
|
51
|
-
require('./chunk-
|
|
52
|
-
require('./chunk-
|
|
79
|
+
require('./chunk-OC6DOOFX.cjs');
|
|
80
|
+
require('./chunk-RICPANBY.cjs');
|
|
81
|
+
require('./chunk-77USGNRW.cjs');
|
|
82
|
+
require('./chunk-AOFWNWLT.cjs');
|
|
53
83
|
require('./chunk-RJUONLUQ.cjs');
|
|
54
84
|
require('./chunk-235MXAGX.cjs');
|
|
55
85
|
require('./chunk-HVBBDBS3.cjs');
|
|
@@ -65,4 +95,32 @@ require('./chunk-UNEFIWXI.cjs');
|
|
|
65
95
|
|
|
66
96
|
|
|
67
97
|
|
|
68
|
-
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
exports.DEFAULT_ROUTE_IDLE_MS = _chunkXELFM7KLcjs.DEFAULT_ROUTE_IDLE_MS; exports.ProviderProxy = _chunkXELFM7KLcjs.ProviderProxy; exports.ProviderProxyRouteMap = _chunkXELFM7KLcjs.ProviderProxyRouteMap; exports.ROUTE_LEASE_API_VERSION = _chunkXELFM7KLcjs.ROUTE_LEASE_API_VERSION; exports.ROUTE_LEASE_CAPABILITIES = _chunkXELFM7KLcjs.ROUTE_LEASE_CAPABILITIES; exports.ROUTE_LEASE_CAPABILITIES_SCHEMA = _chunkXELFM7KLcjs.ROUTE_LEASE_CAPABILITIES_SCHEMA; exports.ROUTE_LEASE_CODEX_TOKEN_ENV = _chunkXELFM7KLcjs.ROUTE_LEASE_CODEX_TOKEN_ENV; exports.ROUTE_LEASE_DEFAULT_TTL_SECONDS = _chunkXELFM7KLcjs.ROUTE_LEASE_DEFAULT_TTL_SECONDS; exports.ROUTE_LEASE_MAX_CONSUMER_BYTES = _chunkXELFM7KLcjs.ROUTE_LEASE_MAX_CONSUMER_BYTES; exports.ROUTE_LEASE_MAX_EXECUTION_ID_BYTES = _chunkXELFM7KLcjs.ROUTE_LEASE_MAX_EXECUTION_ID_BYTES; exports.ROUTE_LEASE_MAX_IDEMPOTENCY_BYTES = _chunkXELFM7KLcjs.ROUTE_LEASE_MAX_IDEMPOTENCY_BYTES; exports.ROUTE_LEASE_MAX_MODEL_BYTES = _chunkXELFM7KLcjs.ROUTE_LEASE_MAX_MODEL_BYTES; exports.ROUTE_LEASE_MAX_SESSION_ID_BYTES = _chunkXELFM7KLcjs.ROUTE_LEASE_MAX_SESSION_ID_BYTES; exports.ROUTE_LEASE_MAX_TTL_SECONDS = _chunkXELFM7KLcjs.ROUTE_LEASE_MAX_TTL_SECONDS; exports.ROUTE_LEASE_REQUEST_SCHEMA = _chunkXELFM7KLcjs.ROUTE_LEASE_REQUEST_SCHEMA; exports.ROUTE_LEASE_RESULT_SCHEMA = _chunkXELFM7KLcjs.ROUTE_LEASE_RESULT_SCHEMA; exports.ROUTE_LEASE_RUNTIMES = _chunkXELFM7KLcjs.ROUTE_LEASE_RUNTIMES; exports.ROUTE_LEASE_RUNTIME_TABLE = _chunkXELFM7KLcjs.ROUTE_LEASE_RUNTIME_TABLE; exports.ROUTE_LEASE_SESSION_HASH_DOMAIN = _chunkXELFM7KLcjs.ROUTE_LEASE_SESSION_HASH_DOMAIN; exports.RouteLeaseError = _chunkXELFM7KLcjs.RouteLeaseError; exports.RouteLeaseManager = _chunkXELFM7KLcjs.RouteLeaseManager; exports.RouteLeaseTargetResolver = _chunkXELFM7KLcjs.RouteLeaseTargetResolver; exports.SYSTEM_ROUTE_LEASE_CLOCK = _chunkXELFM7KLcjs.SYSTEM_ROUTE_LEASE_CLOCK; exports.__resetProviderProxyForTests = _chunkXELFM7KLcjs.__resetProviderProxyForTests; exports.canonicalizeRouteLeasePayload = _chunkXELFM7KLcjs.canonicalizeRouteLeasePayload; exports.extractRouteToken = _chunkXELFM7KLcjs.extractRouteToken; exports.getProviderProxy = _chunkXELFM7KLcjs.getProviderProxy; exports.hashRouteLeasePayload = _chunkXELFM7KLcjs.hashRouteLeasePayload; exports.hashRouteLeaseSessionId = _chunkXELFM7KLcjs.hashRouteLeaseSessionId; exports.isLoopbackAddress = _chunkXELFM7KLcjs.isLoopbackAddress; exports.normalizeRouteLeaseIdempotencyKey = _chunkXELFM7KLcjs.normalizeRouteLeaseIdempotencyKey; exports.normalizeRouteLeaseTtl = _chunkXELFM7KLcjs.normalizeRouteLeaseTtl; exports.parseRouteLeaseCreate = _chunkXELFM7KLcjs.parseRouteLeaseCreate; exports.routeLeaseRuntime = _chunkXELFM7KLcjs.routeLeaseRuntime;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { P as ProviderProxy } from './ProviderProxy-
|
|
2
|
-
export { D as DEFAULT_ROUTE_IDLE_MS, a as ProviderProxyRouteMap } from './ProviderProxy-
|
|
3
|
-
import { ProviderProxyDeps } from './provider-proxy/types.cjs';
|
|
4
|
-
export { AnthropicIngressHandler, AnthropicIngressHandlerFactory, AnthropicRouteHandlerParams, AnthropicSdkHints, ExtendedContextHint,
|
|
1
|
+
import { b as RouteRegistrationOptions, P as ProviderProxy } from './ProviderProxy-QdwNV6l1.cjs';
|
|
2
|
+
export { D as DEFAULT_ROUTE_IDLE_MS, a as ProviderProxyRouteMap, R as RouteEvictionReason, i as isLoopbackAddress } from './ProviderProxy-QdwNV6l1.cjs';
|
|
3
|
+
import { IngressFormat, RouteContext, ProviderProxyDeps } from './provider-proxy/types.cjs';
|
|
4
|
+
export { AnthropicIngressHandler, AnthropicIngressHandlerFactory, AnthropicRouteHandlerParams, AnthropicSdkHints, ExtendedContextHint, ProxyAttribution, RetryCallback, RouteAuthMode, RouteLeaseUsageAttribution, StreamEventCallback, SubscriptionDispatchProfile, SubscriptionRequestSummary, TargetProviderFormat } from './provider-proxy/types.cjs';
|
|
5
|
+
import { g as GatewayBindingTarget } from './types-C2MwkLah.cjs';
|
|
6
|
+
import { ProviderConfigSource } from './ports/provider-config-source.cjs';
|
|
5
7
|
import 'node:http';
|
|
6
8
|
import '@omnicross/contracts/completion-types';
|
|
7
9
|
import '@omnicross/contracts/usage-stats-types';
|
|
@@ -14,11 +16,255 @@ import './pipeline/AuthSource.cjs';
|
|
|
14
16
|
import './pipeline/BoundAccountSelectionError.cjs';
|
|
15
17
|
import './pipeline/SubscriptionAuthSource.cjs';
|
|
16
18
|
import './pipeline/SubscriptionAuthStrategy.cjs';
|
|
17
|
-
import './ports/provider-config-source.cjs';
|
|
18
|
-
import './transformer/types.cjs';
|
|
19
|
-
import './transformer/TransformerService.cjs';
|
|
20
19
|
import './ports/web-search-backend.cjs';
|
|
21
20
|
import '@omnicross/contracts/websearch-types';
|
|
21
|
+
import './transformer/types.cjs';
|
|
22
|
+
import './transformer/TransformerService.cjs';
|
|
23
|
+
import '@omnicross/contracts/account-tokens-types';
|
|
24
|
+
import '@omnicross/contracts/audit-types';
|
|
25
|
+
import '@omnicross/contracts/billing-types';
|
|
26
|
+
import '@omnicross/contracts/health-logging-types';
|
|
27
|
+
import '@omnicross/contracts/voucher-types';
|
|
28
|
+
import '@omnicross/contracts/webhook-types';
|
|
29
|
+
import './keyPolicy-zdWTu3CQ.cjs';
|
|
30
|
+
|
|
31
|
+
declare const ROUTE_LEASE_REQUEST_SCHEMA: "omnicross.route-lease.request/1";
|
|
32
|
+
declare const ROUTE_LEASE_RESULT_SCHEMA: "omnicross.route-lease/1";
|
|
33
|
+
declare const ROUTE_LEASE_CAPABILITIES_SCHEMA: "omnicross.route-lease.capabilities/1";
|
|
34
|
+
declare const ROUTE_LEASE_API_VERSION: 1;
|
|
35
|
+
declare const ROUTE_LEASE_DEFAULT_TTL_SECONDS = 600;
|
|
36
|
+
declare const ROUTE_LEASE_MAX_TTL_SECONDS = 3600;
|
|
37
|
+
declare const ROUTE_LEASE_MAX_IDEMPOTENCY_BYTES = 256;
|
|
38
|
+
declare const ROUTE_LEASE_MAX_CONSUMER_BYTES = 64;
|
|
39
|
+
declare const ROUTE_LEASE_MAX_EXECUTION_ID_BYTES = 128;
|
|
40
|
+
declare const ROUTE_LEASE_MAX_SESSION_ID_BYTES = 512;
|
|
41
|
+
declare const ROUTE_LEASE_MAX_MODEL_BYTES = 256;
|
|
42
|
+
declare const ROUTE_LEASE_SESSION_HASH_DOMAIN = "omnicross.route-lease.session/v1";
|
|
43
|
+
declare const ROUTE_LEASE_CODEX_TOKEN_ENV = "OMNICROSS_CODEX_ROUTE_TOKEN";
|
|
44
|
+
declare const ROUTE_LEASE_RUNTIMES: readonly ["claude", "codex"];
|
|
45
|
+
type RouteLeaseRuntime = (typeof ROUTE_LEASE_RUNTIMES)[number];
|
|
46
|
+
type RouteLeaseUpstream = GatewayBindingTarget;
|
|
47
|
+
type RouteLeaseStatus = 'active' | 'released' | 'expired';
|
|
48
|
+
interface RuntimeLaunchDescriptor {
|
|
49
|
+
readonly env: Record<string, string>;
|
|
50
|
+
readonly extraArgs: string[];
|
|
51
|
+
}
|
|
52
|
+
interface RouteLeaseExecutionRequest {
|
|
53
|
+
readonly runId?: string;
|
|
54
|
+
readonly stageId?: string;
|
|
55
|
+
readonly attempt?: number;
|
|
56
|
+
readonly sessionId?: string;
|
|
57
|
+
}
|
|
58
|
+
interface RouteLeaseExecutionMetadata {
|
|
59
|
+
readonly runId?: string;
|
|
60
|
+
readonly stageId?: string;
|
|
61
|
+
readonly attempt?: number;
|
|
62
|
+
readonly sessionIdHash?: string;
|
|
63
|
+
}
|
|
64
|
+
interface RouteLeaseRequest {
|
|
65
|
+
readonly schemaVersion: typeof ROUTE_LEASE_REQUEST_SCHEMA;
|
|
66
|
+
readonly consumer: string;
|
|
67
|
+
readonly runtime: RouteLeaseRuntime;
|
|
68
|
+
readonly upstream: RouteLeaseUpstream;
|
|
69
|
+
readonly model: string;
|
|
70
|
+
readonly execution?: RouteLeaseExecutionRequest;
|
|
71
|
+
readonly ttlSeconds?: number;
|
|
72
|
+
}
|
|
73
|
+
interface NormalizedRouteLeaseRequest {
|
|
74
|
+
readonly schemaVersion: typeof ROUTE_LEASE_REQUEST_SCHEMA;
|
|
75
|
+
readonly consumer: string;
|
|
76
|
+
readonly runtime: RouteLeaseRuntime;
|
|
77
|
+
readonly upstream: RouteLeaseUpstream;
|
|
78
|
+
readonly model: string;
|
|
79
|
+
readonly execution?: RouteLeaseExecutionMetadata;
|
|
80
|
+
readonly ttlSeconds: number;
|
|
81
|
+
}
|
|
82
|
+
interface NormalizedRouteLeaseCreate {
|
|
83
|
+
readonly request: NormalizedRouteLeaseRequest;
|
|
84
|
+
readonly idempotencyKey: string;
|
|
85
|
+
readonly payloadHash: string;
|
|
86
|
+
}
|
|
87
|
+
interface RouteLeaseMetadata {
|
|
88
|
+
readonly leaseId: string;
|
|
89
|
+
readonly consumer: string;
|
|
90
|
+
readonly runtime: RouteLeaseRuntime;
|
|
91
|
+
readonly upstream: RouteLeaseUpstream;
|
|
92
|
+
readonly model: string;
|
|
93
|
+
readonly createdAt: string;
|
|
94
|
+
readonly expiresAt: string;
|
|
95
|
+
readonly lastActivityAt?: string;
|
|
96
|
+
readonly status: RouteLeaseStatus;
|
|
97
|
+
readonly execution?: RouteLeaseExecutionMetadata;
|
|
98
|
+
}
|
|
99
|
+
interface RouteLeaseCreateResult extends RouteLeaseMetadata {
|
|
100
|
+
readonly schemaVersion: typeof ROUTE_LEASE_RESULT_SCHEMA;
|
|
101
|
+
readonly status: 'active';
|
|
102
|
+
readonly launch: RuntimeLaunchDescriptor;
|
|
103
|
+
}
|
|
104
|
+
interface RouteLeaseRenewResult {
|
|
105
|
+
readonly leaseId: string;
|
|
106
|
+
readonly expiresAt: string;
|
|
107
|
+
readonly status: 'active';
|
|
108
|
+
}
|
|
109
|
+
interface RouteLeaseReleaseResult {
|
|
110
|
+
readonly leaseId: string;
|
|
111
|
+
readonly released: boolean;
|
|
112
|
+
}
|
|
113
|
+
interface RouteLeaseCapabilities {
|
|
114
|
+
readonly schemaVersion: typeof ROUTE_LEASE_CAPABILITIES_SCHEMA;
|
|
115
|
+
readonly runtimes: readonly ['claude', 'codex'];
|
|
116
|
+
readonly upstreamKinds: readonly ['provider', 'account', 'account-group', 'account-pool'];
|
|
117
|
+
readonly leaseApiVersion: 1;
|
|
118
|
+
readonly codexAuthMode: 'env_key';
|
|
119
|
+
readonly maxTtlSeconds: 3600;
|
|
120
|
+
}
|
|
121
|
+
declare const ROUTE_LEASE_CAPABILITIES: RouteLeaseCapabilities;
|
|
122
|
+
declare const ROUTE_LEASE_RUNTIME_TABLE: Readonly<Record<RouteLeaseRuntime, {
|
|
123
|
+
readonly endpoint: 'messages' | 'responses';
|
|
124
|
+
readonly ingressFormat: IngressFormat;
|
|
125
|
+
readonly wirePath: '/v1/messages' | '/openai/responses';
|
|
126
|
+
}>>;
|
|
127
|
+
type RouteLeaseErrorCode = 'invalid_request' | 'runtime_unsupported' | 'model_not_configured' | 'format_unsupported' | 'control_unauthorized' | 'upstream_not_found' | 'lease_not_found' | 'idempotency_conflict' | 'upstream_unavailable' | 'lease_expired' | 'upstream_exhausted' | 'daemon_not_ready';
|
|
128
|
+
declare class RouteLeaseError extends Error {
|
|
129
|
+
readonly code: RouteLeaseErrorCode;
|
|
130
|
+
readonly type: "route_lease_error";
|
|
131
|
+
readonly status: number;
|
|
132
|
+
readonly retryable: boolean;
|
|
133
|
+
readonly retryAfterSeconds?: number;
|
|
134
|
+
constructor(code: RouteLeaseErrorCode, message: string, options?: {
|
|
135
|
+
status?: number;
|
|
136
|
+
retryable?: boolean;
|
|
137
|
+
retryAfterSeconds?: number;
|
|
138
|
+
cause?: unknown;
|
|
139
|
+
});
|
|
140
|
+
toResponse(): {
|
|
141
|
+
error: {
|
|
142
|
+
type: 'route_lease_error';
|
|
143
|
+
code: RouteLeaseErrorCode;
|
|
144
|
+
message: string;
|
|
145
|
+
retryable: boolean;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
declare function normalizeRouteLeaseIdempotencyKey(value: unknown): string;
|
|
150
|
+
declare function normalizeRouteLeaseTtl(value: unknown): number;
|
|
151
|
+
declare function hashRouteLeaseSessionId(sessionId: string, hmacKey?: Uint8Array): string;
|
|
152
|
+
/** Stable JSON form with recursive object-key sorting and JSON array ordering. */
|
|
153
|
+
declare function canonicalizeRouteLeasePayload(value: unknown): string;
|
|
154
|
+
declare function hashRouteLeasePayload(value: unknown): string;
|
|
155
|
+
declare function parseRouteLeaseCreate(raw: unknown, idempotencyHeader: unknown, hmacKey?: Uint8Array): NormalizedRouteLeaseCreate;
|
|
156
|
+
declare function routeLeaseRuntime(runtime: RouteLeaseRuntime): (typeof ROUTE_LEASE_RUNTIME_TABLE)[RouteLeaseRuntime];
|
|
157
|
+
interface RouteLeaseTargetResolverPort {
|
|
158
|
+
resolve(request: NormalizedRouteLeaseRequest): Promise<RouteContext>;
|
|
159
|
+
}
|
|
160
|
+
interface RouteLeaseDescriptorPort {
|
|
161
|
+
has(runtime: RouteLeaseRuntime): boolean;
|
|
162
|
+
build(runtime: RouteLeaseRuntime, input: {
|
|
163
|
+
readonly proxyBaseUrl: string;
|
|
164
|
+
readonly model: string;
|
|
165
|
+
readonly routeToken: string;
|
|
166
|
+
}): RuntimeLaunchDescriptor;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface RouteLeaseClock {
|
|
170
|
+
now(): number;
|
|
171
|
+
setTimeout(callback: () => void, delayMs: number): unknown;
|
|
172
|
+
clearTimeout(handle: unknown): void;
|
|
173
|
+
}
|
|
174
|
+
declare const SYSTEM_ROUTE_LEASE_CLOCK: RouteLeaseClock;
|
|
175
|
+
interface RouteLeaseRoutePort {
|
|
176
|
+
isReady(): boolean;
|
|
177
|
+
getBaseUrl(): string;
|
|
178
|
+
addRoute(context: RouteContext, options?: number | RouteRegistrationOptions): string;
|
|
179
|
+
renewRoute(token: string, idleMs?: number): boolean;
|
|
180
|
+
removeRoute(token: string): boolean;
|
|
181
|
+
}
|
|
182
|
+
interface RouteLeaseLogger {
|
|
183
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
184
|
+
}
|
|
185
|
+
interface RouteLeaseManagerOptions {
|
|
186
|
+
readonly clock?: RouteLeaseClock;
|
|
187
|
+
readonly hmacKey?: Uint8Array;
|
|
188
|
+
readonly tombstoneMaxCount?: number;
|
|
189
|
+
readonly tombstoneMaxAgeMs?: number;
|
|
190
|
+
readonly logger?: RouteLeaseLogger;
|
|
191
|
+
/** Test-only fault seam after records are published but before create returns. */
|
|
192
|
+
readonly afterPublish?: () => void;
|
|
193
|
+
}
|
|
194
|
+
interface RouteLeaseCreateOutcome {
|
|
195
|
+
readonly created: boolean;
|
|
196
|
+
readonly result: RouteLeaseCreateResult;
|
|
197
|
+
}
|
|
198
|
+
declare class RouteLeaseManager {
|
|
199
|
+
private readonly routePort;
|
|
200
|
+
private readonly targetResolver;
|
|
201
|
+
private readonly descriptors;
|
|
202
|
+
private readonly active;
|
|
203
|
+
private readonly idempotency;
|
|
204
|
+
private readonly pendingCreates;
|
|
205
|
+
private readonly tombstones;
|
|
206
|
+
private readonly clock;
|
|
207
|
+
private readonly hmacKey;
|
|
208
|
+
private readonly tombstoneMaxCount;
|
|
209
|
+
private readonly tombstoneMaxAgeMs;
|
|
210
|
+
private readonly logger?;
|
|
211
|
+
private readonly afterPublish?;
|
|
212
|
+
private closed;
|
|
213
|
+
constructor(routePort: RouteLeaseRoutePort, targetResolver: RouteLeaseTargetResolverPort, descriptors: RouteLeaseDescriptorPort, options?: RouteLeaseManagerOptions);
|
|
214
|
+
parse(raw: unknown, idempotencyKey: unknown): NormalizedRouteLeaseCreate;
|
|
215
|
+
createFromRequest(raw: unknown, idempotencyKey: unknown): Promise<RouteLeaseCreateOutcome>;
|
|
216
|
+
create(input: NormalizedRouteLeaseCreate): Promise<RouteLeaseCreateOutcome>;
|
|
217
|
+
private createNew;
|
|
218
|
+
list(): RouteLeaseMetadata[];
|
|
219
|
+
get(leaseId: string): RouteLeaseMetadata;
|
|
220
|
+
renew(leaseId: string, ttlSeconds: number): RouteLeaseRenewResult;
|
|
221
|
+
release(leaseId: string): RouteLeaseReleaseResult;
|
|
222
|
+
shutdown(): void;
|
|
223
|
+
activeCount(): number;
|
|
224
|
+
private assertOpen;
|
|
225
|
+
private noteActivity;
|
|
226
|
+
private onRouteEvicted;
|
|
227
|
+
private expire;
|
|
228
|
+
private finalize;
|
|
229
|
+
private safeRemoveRoute;
|
|
230
|
+
private pruneTombstones;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
interface RouteLeaseProviderKeyPreflight {
|
|
234
|
+
hasUsableKey(providerId: string, keyId: string): Promise<boolean>;
|
|
235
|
+
hasUsableKeys(providerId: string): Promise<boolean>;
|
|
236
|
+
getKeyAvailability?(providerId: string, keyId: string): Promise<'usable' | 'unavailable' | 'not-found'>;
|
|
237
|
+
getPoolAvailability?(providerId: string): Promise<{
|
|
238
|
+
readonly outcome: 'usable';
|
|
239
|
+
} | {
|
|
240
|
+
readonly outcome: 'empty' | 'unavailable';
|
|
241
|
+
} | {
|
|
242
|
+
readonly outcome: 'exhausted';
|
|
243
|
+
readonly retryAfterSeconds: number;
|
|
244
|
+
}>;
|
|
245
|
+
}
|
|
246
|
+
interface RouteLeaseSubscriptionPreflight {
|
|
247
|
+
assertAvailable(upstream: Exclude<RouteLeaseUpstream, {
|
|
248
|
+
kind: 'provider';
|
|
249
|
+
}>, model: string): Promise<void>;
|
|
250
|
+
}
|
|
251
|
+
interface RouteLeaseTargetResolverOptions {
|
|
252
|
+
readonly providerKeys?: RouteLeaseProviderKeyPreflight;
|
|
253
|
+
readonly subscriptions?: RouteLeaseSubscriptionPreflight;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Reuses the outbound GatewayBinding projection and route resolver with a
|
|
257
|
+
* non-persistent, strict binding. Host-only credential/account checks arrive
|
|
258
|
+
* through narrow secret-free preflight ports.
|
|
259
|
+
*/
|
|
260
|
+
declare class RouteLeaseTargetResolver implements RouteLeaseTargetResolverPort {
|
|
261
|
+
private readonly llmConfig;
|
|
262
|
+
private readonly options;
|
|
263
|
+
constructor(llmConfig: ProviderConfigSource, options?: RouteLeaseTargetResolverOptions);
|
|
264
|
+
resolve(request: NormalizedRouteLeaseRequest): Promise<RouteContext>;
|
|
265
|
+
private preflightTarget;
|
|
266
|
+
private preflightSubscription;
|
|
267
|
+
}
|
|
22
268
|
|
|
23
269
|
/**
|
|
24
270
|
* providerProxyRouter — method+path dispatch + route-token auth for the resident
|
|
@@ -72,4 +318,4 @@ declare function getProviderProxy(deps?: ProviderProxyDeps): ProviderProxy;
|
|
|
72
318
|
/** Reset the singleton (tests / teardown only). */
|
|
73
319
|
declare function __resetProviderProxyForTests(): void;
|
|
74
320
|
|
|
75
|
-
export { ProviderProxy, ProviderProxyDeps, __resetProviderProxyForTests, extractRouteToken, getProviderProxy };
|
|
321
|
+
export { IngressFormat, type NormalizedRouteLeaseCreate, type NormalizedRouteLeaseRequest, ProviderProxy, ProviderProxyDeps, ROUTE_LEASE_API_VERSION, ROUTE_LEASE_CAPABILITIES, ROUTE_LEASE_CAPABILITIES_SCHEMA, ROUTE_LEASE_CODEX_TOKEN_ENV, ROUTE_LEASE_DEFAULT_TTL_SECONDS, ROUTE_LEASE_MAX_CONSUMER_BYTES, ROUTE_LEASE_MAX_EXECUTION_ID_BYTES, ROUTE_LEASE_MAX_IDEMPOTENCY_BYTES, ROUTE_LEASE_MAX_MODEL_BYTES, ROUTE_LEASE_MAX_SESSION_ID_BYTES, ROUTE_LEASE_MAX_TTL_SECONDS, ROUTE_LEASE_REQUEST_SCHEMA, ROUTE_LEASE_RESULT_SCHEMA, ROUTE_LEASE_RUNTIMES, ROUTE_LEASE_RUNTIME_TABLE, ROUTE_LEASE_SESSION_HASH_DOMAIN, RouteContext, type RouteLeaseCapabilities, type RouteLeaseClock, type RouteLeaseCreateOutcome, type RouteLeaseCreateResult, type RouteLeaseDescriptorPort, RouteLeaseError, type RouteLeaseErrorCode, type RouteLeaseExecutionMetadata, type RouteLeaseExecutionRequest, type RouteLeaseLogger, RouteLeaseManager, type RouteLeaseManagerOptions, type RouteLeaseMetadata, type RouteLeaseProviderKeyPreflight, type RouteLeaseReleaseResult, type RouteLeaseRenewResult, type RouteLeaseRequest, type RouteLeaseRoutePort, type RouteLeaseRuntime, type RouteLeaseStatus, type RouteLeaseSubscriptionPreflight, RouteLeaseTargetResolver, type RouteLeaseTargetResolverOptions, type RouteLeaseTargetResolverPort, type RouteLeaseUpstream, RouteRegistrationOptions, type RuntimeLaunchDescriptor, SYSTEM_ROUTE_LEASE_CLOCK, __resetProviderProxyForTests, canonicalizeRouteLeasePayload, extractRouteToken, getProviderProxy, hashRouteLeasePayload, hashRouteLeaseSessionId, normalizeRouteLeaseIdempotencyKey, normalizeRouteLeaseTtl, parseRouteLeaseCreate, routeLeaseRuntime };
|
package/dist/provider-proxy.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { P as ProviderProxy } from './ProviderProxy
|
|
2
|
-
export { D as DEFAULT_ROUTE_IDLE_MS, a as ProviderProxyRouteMap } from './ProviderProxy
|
|
3
|
-
import { ProviderProxyDeps } from './provider-proxy/types.js';
|
|
4
|
-
export { AnthropicIngressHandler, AnthropicIngressHandlerFactory, AnthropicRouteHandlerParams, AnthropicSdkHints, ExtendedContextHint,
|
|
1
|
+
import { b as RouteRegistrationOptions, P as ProviderProxy } from './ProviderProxy--ROec6VI.js';
|
|
2
|
+
export { D as DEFAULT_ROUTE_IDLE_MS, a as ProviderProxyRouteMap, R as RouteEvictionReason, i as isLoopbackAddress } from './ProviderProxy--ROec6VI.js';
|
|
3
|
+
import { IngressFormat, RouteContext, ProviderProxyDeps } from './provider-proxy/types.js';
|
|
4
|
+
export { AnthropicIngressHandler, AnthropicIngressHandlerFactory, AnthropicRouteHandlerParams, AnthropicSdkHints, ExtendedContextHint, ProxyAttribution, RetryCallback, RouteAuthMode, RouteLeaseUsageAttribution, StreamEventCallback, SubscriptionDispatchProfile, SubscriptionRequestSummary, TargetProviderFormat } from './provider-proxy/types.js';
|
|
5
|
+
import { g as GatewayBindingTarget } from './types-BB8pxk_3.js';
|
|
6
|
+
import { ProviderConfigSource } from './ports/provider-config-source.js';
|
|
5
7
|
import 'node:http';
|
|
6
8
|
import '@omnicross/contracts/completion-types';
|
|
7
9
|
import '@omnicross/contracts/usage-stats-types';
|
|
@@ -14,11 +16,255 @@ import './pipeline/AuthSource.js';
|
|
|
14
16
|
import './pipeline/BoundAccountSelectionError.js';
|
|
15
17
|
import './pipeline/SubscriptionAuthSource.js';
|
|
16
18
|
import './pipeline/SubscriptionAuthStrategy.js';
|
|
17
|
-
import './ports/provider-config-source.js';
|
|
18
|
-
import './transformer/types.js';
|
|
19
|
-
import './transformer/TransformerService.js';
|
|
20
19
|
import './ports/web-search-backend.js';
|
|
21
20
|
import '@omnicross/contracts/websearch-types';
|
|
21
|
+
import './transformer/types.js';
|
|
22
|
+
import './transformer/TransformerService.js';
|
|
23
|
+
import '@omnicross/contracts/account-tokens-types';
|
|
24
|
+
import '@omnicross/contracts/audit-types';
|
|
25
|
+
import '@omnicross/contracts/billing-types';
|
|
26
|
+
import '@omnicross/contracts/health-logging-types';
|
|
27
|
+
import '@omnicross/contracts/voucher-types';
|
|
28
|
+
import '@omnicross/contracts/webhook-types';
|
|
29
|
+
import './keyPolicy-zdWTu3CQ.js';
|
|
30
|
+
|
|
31
|
+
declare const ROUTE_LEASE_REQUEST_SCHEMA: "omnicross.route-lease.request/1";
|
|
32
|
+
declare const ROUTE_LEASE_RESULT_SCHEMA: "omnicross.route-lease/1";
|
|
33
|
+
declare const ROUTE_LEASE_CAPABILITIES_SCHEMA: "omnicross.route-lease.capabilities/1";
|
|
34
|
+
declare const ROUTE_LEASE_API_VERSION: 1;
|
|
35
|
+
declare const ROUTE_LEASE_DEFAULT_TTL_SECONDS = 600;
|
|
36
|
+
declare const ROUTE_LEASE_MAX_TTL_SECONDS = 3600;
|
|
37
|
+
declare const ROUTE_LEASE_MAX_IDEMPOTENCY_BYTES = 256;
|
|
38
|
+
declare const ROUTE_LEASE_MAX_CONSUMER_BYTES = 64;
|
|
39
|
+
declare const ROUTE_LEASE_MAX_EXECUTION_ID_BYTES = 128;
|
|
40
|
+
declare const ROUTE_LEASE_MAX_SESSION_ID_BYTES = 512;
|
|
41
|
+
declare const ROUTE_LEASE_MAX_MODEL_BYTES = 256;
|
|
42
|
+
declare const ROUTE_LEASE_SESSION_HASH_DOMAIN = "omnicross.route-lease.session/v1";
|
|
43
|
+
declare const ROUTE_LEASE_CODEX_TOKEN_ENV = "OMNICROSS_CODEX_ROUTE_TOKEN";
|
|
44
|
+
declare const ROUTE_LEASE_RUNTIMES: readonly ["claude", "codex"];
|
|
45
|
+
type RouteLeaseRuntime = (typeof ROUTE_LEASE_RUNTIMES)[number];
|
|
46
|
+
type RouteLeaseUpstream = GatewayBindingTarget;
|
|
47
|
+
type RouteLeaseStatus = 'active' | 'released' | 'expired';
|
|
48
|
+
interface RuntimeLaunchDescriptor {
|
|
49
|
+
readonly env: Record<string, string>;
|
|
50
|
+
readonly extraArgs: string[];
|
|
51
|
+
}
|
|
52
|
+
interface RouteLeaseExecutionRequest {
|
|
53
|
+
readonly runId?: string;
|
|
54
|
+
readonly stageId?: string;
|
|
55
|
+
readonly attempt?: number;
|
|
56
|
+
readonly sessionId?: string;
|
|
57
|
+
}
|
|
58
|
+
interface RouteLeaseExecutionMetadata {
|
|
59
|
+
readonly runId?: string;
|
|
60
|
+
readonly stageId?: string;
|
|
61
|
+
readonly attempt?: number;
|
|
62
|
+
readonly sessionIdHash?: string;
|
|
63
|
+
}
|
|
64
|
+
interface RouteLeaseRequest {
|
|
65
|
+
readonly schemaVersion: typeof ROUTE_LEASE_REQUEST_SCHEMA;
|
|
66
|
+
readonly consumer: string;
|
|
67
|
+
readonly runtime: RouteLeaseRuntime;
|
|
68
|
+
readonly upstream: RouteLeaseUpstream;
|
|
69
|
+
readonly model: string;
|
|
70
|
+
readonly execution?: RouteLeaseExecutionRequest;
|
|
71
|
+
readonly ttlSeconds?: number;
|
|
72
|
+
}
|
|
73
|
+
interface NormalizedRouteLeaseRequest {
|
|
74
|
+
readonly schemaVersion: typeof ROUTE_LEASE_REQUEST_SCHEMA;
|
|
75
|
+
readonly consumer: string;
|
|
76
|
+
readonly runtime: RouteLeaseRuntime;
|
|
77
|
+
readonly upstream: RouteLeaseUpstream;
|
|
78
|
+
readonly model: string;
|
|
79
|
+
readonly execution?: RouteLeaseExecutionMetadata;
|
|
80
|
+
readonly ttlSeconds: number;
|
|
81
|
+
}
|
|
82
|
+
interface NormalizedRouteLeaseCreate {
|
|
83
|
+
readonly request: NormalizedRouteLeaseRequest;
|
|
84
|
+
readonly idempotencyKey: string;
|
|
85
|
+
readonly payloadHash: string;
|
|
86
|
+
}
|
|
87
|
+
interface RouteLeaseMetadata {
|
|
88
|
+
readonly leaseId: string;
|
|
89
|
+
readonly consumer: string;
|
|
90
|
+
readonly runtime: RouteLeaseRuntime;
|
|
91
|
+
readonly upstream: RouteLeaseUpstream;
|
|
92
|
+
readonly model: string;
|
|
93
|
+
readonly createdAt: string;
|
|
94
|
+
readonly expiresAt: string;
|
|
95
|
+
readonly lastActivityAt?: string;
|
|
96
|
+
readonly status: RouteLeaseStatus;
|
|
97
|
+
readonly execution?: RouteLeaseExecutionMetadata;
|
|
98
|
+
}
|
|
99
|
+
interface RouteLeaseCreateResult extends RouteLeaseMetadata {
|
|
100
|
+
readonly schemaVersion: typeof ROUTE_LEASE_RESULT_SCHEMA;
|
|
101
|
+
readonly status: 'active';
|
|
102
|
+
readonly launch: RuntimeLaunchDescriptor;
|
|
103
|
+
}
|
|
104
|
+
interface RouteLeaseRenewResult {
|
|
105
|
+
readonly leaseId: string;
|
|
106
|
+
readonly expiresAt: string;
|
|
107
|
+
readonly status: 'active';
|
|
108
|
+
}
|
|
109
|
+
interface RouteLeaseReleaseResult {
|
|
110
|
+
readonly leaseId: string;
|
|
111
|
+
readonly released: boolean;
|
|
112
|
+
}
|
|
113
|
+
interface RouteLeaseCapabilities {
|
|
114
|
+
readonly schemaVersion: typeof ROUTE_LEASE_CAPABILITIES_SCHEMA;
|
|
115
|
+
readonly runtimes: readonly ['claude', 'codex'];
|
|
116
|
+
readonly upstreamKinds: readonly ['provider', 'account', 'account-group', 'account-pool'];
|
|
117
|
+
readonly leaseApiVersion: 1;
|
|
118
|
+
readonly codexAuthMode: 'env_key';
|
|
119
|
+
readonly maxTtlSeconds: 3600;
|
|
120
|
+
}
|
|
121
|
+
declare const ROUTE_LEASE_CAPABILITIES: RouteLeaseCapabilities;
|
|
122
|
+
declare const ROUTE_LEASE_RUNTIME_TABLE: Readonly<Record<RouteLeaseRuntime, {
|
|
123
|
+
readonly endpoint: 'messages' | 'responses';
|
|
124
|
+
readonly ingressFormat: IngressFormat;
|
|
125
|
+
readonly wirePath: '/v1/messages' | '/openai/responses';
|
|
126
|
+
}>>;
|
|
127
|
+
type RouteLeaseErrorCode = 'invalid_request' | 'runtime_unsupported' | 'model_not_configured' | 'format_unsupported' | 'control_unauthorized' | 'upstream_not_found' | 'lease_not_found' | 'idempotency_conflict' | 'upstream_unavailable' | 'lease_expired' | 'upstream_exhausted' | 'daemon_not_ready';
|
|
128
|
+
declare class RouteLeaseError extends Error {
|
|
129
|
+
readonly code: RouteLeaseErrorCode;
|
|
130
|
+
readonly type: "route_lease_error";
|
|
131
|
+
readonly status: number;
|
|
132
|
+
readonly retryable: boolean;
|
|
133
|
+
readonly retryAfterSeconds?: number;
|
|
134
|
+
constructor(code: RouteLeaseErrorCode, message: string, options?: {
|
|
135
|
+
status?: number;
|
|
136
|
+
retryable?: boolean;
|
|
137
|
+
retryAfterSeconds?: number;
|
|
138
|
+
cause?: unknown;
|
|
139
|
+
});
|
|
140
|
+
toResponse(): {
|
|
141
|
+
error: {
|
|
142
|
+
type: 'route_lease_error';
|
|
143
|
+
code: RouteLeaseErrorCode;
|
|
144
|
+
message: string;
|
|
145
|
+
retryable: boolean;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
declare function normalizeRouteLeaseIdempotencyKey(value: unknown): string;
|
|
150
|
+
declare function normalizeRouteLeaseTtl(value: unknown): number;
|
|
151
|
+
declare function hashRouteLeaseSessionId(sessionId: string, hmacKey?: Uint8Array): string;
|
|
152
|
+
/** Stable JSON form with recursive object-key sorting and JSON array ordering. */
|
|
153
|
+
declare function canonicalizeRouteLeasePayload(value: unknown): string;
|
|
154
|
+
declare function hashRouteLeasePayload(value: unknown): string;
|
|
155
|
+
declare function parseRouteLeaseCreate(raw: unknown, idempotencyHeader: unknown, hmacKey?: Uint8Array): NormalizedRouteLeaseCreate;
|
|
156
|
+
declare function routeLeaseRuntime(runtime: RouteLeaseRuntime): (typeof ROUTE_LEASE_RUNTIME_TABLE)[RouteLeaseRuntime];
|
|
157
|
+
interface RouteLeaseTargetResolverPort {
|
|
158
|
+
resolve(request: NormalizedRouteLeaseRequest): Promise<RouteContext>;
|
|
159
|
+
}
|
|
160
|
+
interface RouteLeaseDescriptorPort {
|
|
161
|
+
has(runtime: RouteLeaseRuntime): boolean;
|
|
162
|
+
build(runtime: RouteLeaseRuntime, input: {
|
|
163
|
+
readonly proxyBaseUrl: string;
|
|
164
|
+
readonly model: string;
|
|
165
|
+
readonly routeToken: string;
|
|
166
|
+
}): RuntimeLaunchDescriptor;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
interface RouteLeaseClock {
|
|
170
|
+
now(): number;
|
|
171
|
+
setTimeout(callback: () => void, delayMs: number): unknown;
|
|
172
|
+
clearTimeout(handle: unknown): void;
|
|
173
|
+
}
|
|
174
|
+
declare const SYSTEM_ROUTE_LEASE_CLOCK: RouteLeaseClock;
|
|
175
|
+
interface RouteLeaseRoutePort {
|
|
176
|
+
isReady(): boolean;
|
|
177
|
+
getBaseUrl(): string;
|
|
178
|
+
addRoute(context: RouteContext, options?: number | RouteRegistrationOptions): string;
|
|
179
|
+
renewRoute(token: string, idleMs?: number): boolean;
|
|
180
|
+
removeRoute(token: string): boolean;
|
|
181
|
+
}
|
|
182
|
+
interface RouteLeaseLogger {
|
|
183
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
184
|
+
}
|
|
185
|
+
interface RouteLeaseManagerOptions {
|
|
186
|
+
readonly clock?: RouteLeaseClock;
|
|
187
|
+
readonly hmacKey?: Uint8Array;
|
|
188
|
+
readonly tombstoneMaxCount?: number;
|
|
189
|
+
readonly tombstoneMaxAgeMs?: number;
|
|
190
|
+
readonly logger?: RouteLeaseLogger;
|
|
191
|
+
/** Test-only fault seam after records are published but before create returns. */
|
|
192
|
+
readonly afterPublish?: () => void;
|
|
193
|
+
}
|
|
194
|
+
interface RouteLeaseCreateOutcome {
|
|
195
|
+
readonly created: boolean;
|
|
196
|
+
readonly result: RouteLeaseCreateResult;
|
|
197
|
+
}
|
|
198
|
+
declare class RouteLeaseManager {
|
|
199
|
+
private readonly routePort;
|
|
200
|
+
private readonly targetResolver;
|
|
201
|
+
private readonly descriptors;
|
|
202
|
+
private readonly active;
|
|
203
|
+
private readonly idempotency;
|
|
204
|
+
private readonly pendingCreates;
|
|
205
|
+
private readonly tombstones;
|
|
206
|
+
private readonly clock;
|
|
207
|
+
private readonly hmacKey;
|
|
208
|
+
private readonly tombstoneMaxCount;
|
|
209
|
+
private readonly tombstoneMaxAgeMs;
|
|
210
|
+
private readonly logger?;
|
|
211
|
+
private readonly afterPublish?;
|
|
212
|
+
private closed;
|
|
213
|
+
constructor(routePort: RouteLeaseRoutePort, targetResolver: RouteLeaseTargetResolverPort, descriptors: RouteLeaseDescriptorPort, options?: RouteLeaseManagerOptions);
|
|
214
|
+
parse(raw: unknown, idempotencyKey: unknown): NormalizedRouteLeaseCreate;
|
|
215
|
+
createFromRequest(raw: unknown, idempotencyKey: unknown): Promise<RouteLeaseCreateOutcome>;
|
|
216
|
+
create(input: NormalizedRouteLeaseCreate): Promise<RouteLeaseCreateOutcome>;
|
|
217
|
+
private createNew;
|
|
218
|
+
list(): RouteLeaseMetadata[];
|
|
219
|
+
get(leaseId: string): RouteLeaseMetadata;
|
|
220
|
+
renew(leaseId: string, ttlSeconds: number): RouteLeaseRenewResult;
|
|
221
|
+
release(leaseId: string): RouteLeaseReleaseResult;
|
|
222
|
+
shutdown(): void;
|
|
223
|
+
activeCount(): number;
|
|
224
|
+
private assertOpen;
|
|
225
|
+
private noteActivity;
|
|
226
|
+
private onRouteEvicted;
|
|
227
|
+
private expire;
|
|
228
|
+
private finalize;
|
|
229
|
+
private safeRemoveRoute;
|
|
230
|
+
private pruneTombstones;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
interface RouteLeaseProviderKeyPreflight {
|
|
234
|
+
hasUsableKey(providerId: string, keyId: string): Promise<boolean>;
|
|
235
|
+
hasUsableKeys(providerId: string): Promise<boolean>;
|
|
236
|
+
getKeyAvailability?(providerId: string, keyId: string): Promise<'usable' | 'unavailable' | 'not-found'>;
|
|
237
|
+
getPoolAvailability?(providerId: string): Promise<{
|
|
238
|
+
readonly outcome: 'usable';
|
|
239
|
+
} | {
|
|
240
|
+
readonly outcome: 'empty' | 'unavailable';
|
|
241
|
+
} | {
|
|
242
|
+
readonly outcome: 'exhausted';
|
|
243
|
+
readonly retryAfterSeconds: number;
|
|
244
|
+
}>;
|
|
245
|
+
}
|
|
246
|
+
interface RouteLeaseSubscriptionPreflight {
|
|
247
|
+
assertAvailable(upstream: Exclude<RouteLeaseUpstream, {
|
|
248
|
+
kind: 'provider';
|
|
249
|
+
}>, model: string): Promise<void>;
|
|
250
|
+
}
|
|
251
|
+
interface RouteLeaseTargetResolverOptions {
|
|
252
|
+
readonly providerKeys?: RouteLeaseProviderKeyPreflight;
|
|
253
|
+
readonly subscriptions?: RouteLeaseSubscriptionPreflight;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Reuses the outbound GatewayBinding projection and route resolver with a
|
|
257
|
+
* non-persistent, strict binding. Host-only credential/account checks arrive
|
|
258
|
+
* through narrow secret-free preflight ports.
|
|
259
|
+
*/
|
|
260
|
+
declare class RouteLeaseTargetResolver implements RouteLeaseTargetResolverPort {
|
|
261
|
+
private readonly llmConfig;
|
|
262
|
+
private readonly options;
|
|
263
|
+
constructor(llmConfig: ProviderConfigSource, options?: RouteLeaseTargetResolverOptions);
|
|
264
|
+
resolve(request: NormalizedRouteLeaseRequest): Promise<RouteContext>;
|
|
265
|
+
private preflightTarget;
|
|
266
|
+
private preflightSubscription;
|
|
267
|
+
}
|
|
22
268
|
|
|
23
269
|
/**
|
|
24
270
|
* providerProxyRouter — method+path dispatch + route-token auth for the resident
|
|
@@ -72,4 +318,4 @@ declare function getProviderProxy(deps?: ProviderProxyDeps): ProviderProxy;
|
|
|
72
318
|
/** Reset the singleton (tests / teardown only). */
|
|
73
319
|
declare function __resetProviderProxyForTests(): void;
|
|
74
320
|
|
|
75
|
-
export { ProviderProxy, ProviderProxyDeps, __resetProviderProxyForTests, extractRouteToken, getProviderProxy };
|
|
321
|
+
export { IngressFormat, type NormalizedRouteLeaseCreate, type NormalizedRouteLeaseRequest, ProviderProxy, ProviderProxyDeps, ROUTE_LEASE_API_VERSION, ROUTE_LEASE_CAPABILITIES, ROUTE_LEASE_CAPABILITIES_SCHEMA, ROUTE_LEASE_CODEX_TOKEN_ENV, ROUTE_LEASE_DEFAULT_TTL_SECONDS, ROUTE_LEASE_MAX_CONSUMER_BYTES, ROUTE_LEASE_MAX_EXECUTION_ID_BYTES, ROUTE_LEASE_MAX_IDEMPOTENCY_BYTES, ROUTE_LEASE_MAX_MODEL_BYTES, ROUTE_LEASE_MAX_SESSION_ID_BYTES, ROUTE_LEASE_MAX_TTL_SECONDS, ROUTE_LEASE_REQUEST_SCHEMA, ROUTE_LEASE_RESULT_SCHEMA, ROUTE_LEASE_RUNTIMES, ROUTE_LEASE_RUNTIME_TABLE, ROUTE_LEASE_SESSION_HASH_DOMAIN, RouteContext, type RouteLeaseCapabilities, type RouteLeaseClock, type RouteLeaseCreateOutcome, type RouteLeaseCreateResult, type RouteLeaseDescriptorPort, RouteLeaseError, type RouteLeaseErrorCode, type RouteLeaseExecutionMetadata, type RouteLeaseExecutionRequest, type RouteLeaseLogger, RouteLeaseManager, type RouteLeaseManagerOptions, type RouteLeaseMetadata, type RouteLeaseProviderKeyPreflight, type RouteLeaseReleaseResult, type RouteLeaseRenewResult, type RouteLeaseRequest, type RouteLeaseRoutePort, type RouteLeaseRuntime, type RouteLeaseStatus, type RouteLeaseSubscriptionPreflight, RouteLeaseTargetResolver, type RouteLeaseTargetResolverOptions, type RouteLeaseTargetResolverPort, type RouteLeaseUpstream, RouteRegistrationOptions, type RuntimeLaunchDescriptor, SYSTEM_ROUTE_LEASE_CLOCK, __resetProviderProxyForTests, canonicalizeRouteLeasePayload, extractRouteToken, getProviderProxy, hashRouteLeasePayload, hashRouteLeaseSessionId, normalizeRouteLeaseIdempotencyKey, normalizeRouteLeaseTtl, parseRouteLeaseCreate, routeLeaseRuntime };
|