@omnicross/core 0.1.9 → 0.2.0
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/LICENSE +21 -21
- package/NOTICE +57 -57
- package/README.md +22 -15
- package/dist/{CompletionService-kNA17cfI.d.cts → CompletionService-BiJqftc-.d.cts} +1 -1
- package/dist/{CompletionService-C3BX0Ovy.d.ts → CompletionService-NXN_Av5W.d.ts} +1 -1
- package/dist/{ProviderProxy-QdwNV6l1.d.cts → ProviderProxy-CgIcCVwk.d.cts} +1 -1
- package/dist/{ProviderProxy--ROec6VI.d.ts → ProviderProxy-DYoY5XoT.d.ts} +1 -1
- package/dist/auth/GeminiCodeAssistProjectResolver.cjs +6 -6
- package/dist/auth/GeminiCodeAssistProjectResolver.js +4 -4
- package/dist/chunk-32SRZFFP.cjs +153 -0
- package/dist/chunk-4JOU54M5.js +200 -0
- package/dist/{chunk-2UTGX6FM.js → chunk-4VVCXVB7.js} +1 -1
- package/dist/{chunk-EPN67EGP.cjs → chunk-5UK3KLE2.cjs} +9 -1
- package/dist/chunk-6DDYNS2B.cjs +384 -0
- package/dist/{chunk-HKB656B4.js → chunk-6OC3ORW6.js} +55 -287
- package/dist/chunk-6OKXH2TW.js +320 -0
- package/dist/{chunk-XELFM7KL.cjs → chunk-7B56AJBB.cjs} +6275 -2421
- package/dist/{chunk-YWL7YZWS.cjs → chunk-7LRTPNFL.cjs} +5 -0
- package/dist/{chunk-CCVRRJOX.js → chunk-7PIUVCKK.js} +9 -2
- package/dist/{chunk-IIRPUVPH.cjs → chunk-7ZHBN75N.cjs} +3 -1
- package/dist/{chunk-UAPBLNN2.js → chunk-AQDON6MB.js} +8 -0
- package/dist/{chunk-RJ5ZGNI3.js → chunk-CFSGYFOZ.js} +1 -1
- package/dist/chunk-CTKM773J.cjs +3919 -0
- package/dist/chunk-DEIUR2TH.js +3919 -0
- package/dist/{chunk-WNKWAEUR.js → chunk-EYGBM2VC.js} +3 -1
- package/dist/{chunk-NGYOO5TO.js → chunk-FJNKXOWE.js} +9 -9
- package/dist/chunk-FX325I5Q.cjs +320 -0
- package/dist/chunk-G4CZIUIB.cjs +200 -0
- package/dist/chunk-HCOQQAZE.cjs +123 -0
- package/dist/{chunk-55FMGZ3L.js → chunk-HN74IGEO.js} +1 -1
- package/dist/{chunk-ZY6KU6P3.js → chunk-HOMUGKHR.js} +8 -5
- package/dist/{chunk-AOFWNWLT.cjs → chunk-IUL4VWNU.cjs} +22 -1
- package/dist/{chunk-5LNYGCIW.cjs → chunk-KIQ2HA2A.cjs} +5 -5
- package/dist/{chunk-MUHWHQVM.cjs → chunk-KQBLZMP6.cjs} +4 -3
- package/dist/chunk-LFEH7CEO.js +384 -0
- package/dist/chunk-N76KU6F5.js +123 -0
- package/dist/{chunk-CMVXX7ON.cjs → chunk-NOITAVHA.cjs} +114 -58
- package/dist/{chunk-Q27JY5RG.cjs → chunk-OIKREZVQ.cjs} +7 -4
- package/dist/{chunk-RJUONLUQ.cjs → chunk-OST5RJOJ.cjs} +1 -1
- package/dist/chunk-QIIAMBTM.js +153 -0
- package/dist/{chunk-56QD3YW6.cjs → chunk-QWNUOR7F.cjs} +11 -4
- package/dist/{chunk-S3DYFEBE.js → chunk-R4VCO2CB.js} +10 -1
- package/dist/{chunk-ZQQUD66M.cjs → chunk-SQMAEDNE.cjs} +63 -295
- package/dist/{chunk-4VZX5F4T.cjs → chunk-T6NWPIYZ.cjs} +5 -2
- package/dist/{chunk-P7EM6BND.cjs → chunk-TVYA5JSQ.cjs} +10 -10
- package/dist/{chunk-EBLFCNPY.js → chunk-U47LQXPB.js} +5 -2
- package/dist/{chunk-N7OOJI5V.js → chunk-V2UKUTJ3.js} +5 -0
- package/dist/{chunk-45FHEOKW.js → chunk-V53ZEFXC.js} +92 -36
- package/dist/{chunk-OC6DOOFX.cjs → chunk-VXRTQZF2.cjs} +5 -5
- package/dist/{chunk-CQIJCPMF.js → chunk-WSJE42SG.js} +5149 -1295
- package/dist/{chunk-RICPANBY.cjs → chunk-WX2E2G7H.cjs} +13 -4
- package/dist/{chunk-DE2SRBFZ.js → chunk-X335TJNS.js} +4 -3
- package/dist/{chunk-N2EIM2XJ.js → chunk-ZLNHPUFA.js} +22 -1
- package/dist/completion/CompletionService.cjs +30 -27
- package/dist/completion/CompletionService.d.cts +3 -2
- package/dist/completion/CompletionService.d.ts +3 -2
- package/dist/completion/CompletionService.js +29 -26
- package/dist/completion.cjs +38 -35
- package/dist/completion.d.cts +3 -2
- package/dist/completion.d.ts +3 -2
- package/dist/completion.js +37 -34
- package/dist/image-generation.cjs +52 -0
- package/dist/image-generation.d.cts +93 -0
- package/dist/image-generation.d.ts +93 -0
- package/dist/image-generation.js +52 -0
- package/dist/index.cjs +126 -31
- package/dist/index.d.cts +11 -7
- package/dist/index.d.ts +11 -7
- package/dist/index.js +143 -48
- package/dist/openai-operation.cjs +18 -0
- package/dist/openai-operation.d.cts +19 -0
- package/dist/openai-operation.d.ts +19 -0
- package/dist/openai-operation.js +18 -0
- package/dist/outbound-api/auditCapture.cjs +3 -3
- package/dist/outbound-api/auditCapture.d.cts +19 -2
- package/dist/outbound-api/auditCapture.d.ts +19 -2
- package/dist/outbound-api/auditCapture.js +2 -2
- package/dist/outbound-api/auditRedact.cjs +2 -2
- package/dist/outbound-api/auditRedact.js +1 -1
- package/dist/outbound-api/routeResolver.cjs +2 -2
- package/dist/outbound-api/routeResolver.d.cts +7 -4
- package/dist/outbound-api/routeResolver.d.ts +7 -4
- package/dist/outbound-api/routeResolver.js +1 -1
- package/dist/outbound-api/subscriptionRegistryPort.d.cts +2 -1
- package/dist/outbound-api/subscriptionRegistryPort.d.ts +2 -1
- package/dist/outbound-api/types.d.cts +6 -3
- package/dist/outbound-api/types.d.ts +6 -3
- package/dist/outbound-api.cjs +49 -32
- package/dist/outbound-api.d.cts +97 -10
- package/dist/outbound-api.d.ts +97 -10
- package/dist/outbound-api.js +48 -31
- package/dist/pipeline/AccountAllowanceScheduling.d.cts +18 -15
- package/dist/pipeline/AccountAllowanceScheduling.d.ts +18 -15
- package/dist/pipeline/LlmConfigProviderAuth.cjs +3 -3
- package/dist/pipeline/LlmConfigProviderAuth.js +2 -2
- package/dist/pipeline/SubscriptionAccountHealth.cjs +2 -2
- package/dist/pipeline/SubscriptionAccountHealth.d.cts +7 -0
- package/dist/pipeline/SubscriptionAccountHealth.d.ts +7 -0
- package/dist/pipeline/SubscriptionAccountHealth.js +1 -1
- package/dist/pipeline/executeProviderCall.cjs +2 -2
- package/dist/pipeline/executeProviderCall.d.cts +11 -6
- package/dist/pipeline/executeProviderCall.d.ts +11 -6
- package/dist/pipeline/executeProviderCall.js +1 -1
- package/dist/pipeline/upstreamFetch.cjs +2 -2
- package/dist/pipeline/upstreamFetch.d.cts +5 -0
- package/dist/pipeline/upstreamFetch.d.ts +5 -0
- package/dist/pipeline/upstreamFetch.js +1 -1
- package/dist/ports.d.cts +6 -3
- package/dist/ports.d.ts +6 -3
- package/dist/provider-proxy/ProviderProxy.cjs +30 -27
- package/dist/provider-proxy/ProviderProxy.d.cts +3 -2
- package/dist/provider-proxy/ProviderProxy.d.ts +3 -2
- package/dist/provider-proxy/ProviderProxy.js +29 -26
- package/dist/provider-proxy/identity/codexCliHeaders.cjs +4 -2
- package/dist/provider-proxy/identity/codexCliHeaders.d.cts +26 -6
- package/dist/provider-proxy/identity/codexCliHeaders.d.ts +26 -6
- package/dist/provider-proxy/identity/codexCliHeaders.js +5 -3
- package/dist/provider-proxy/ingress/providerProxyShared.cjs +32 -27
- package/dist/provider-proxy/ingress/providerProxyShared.d.cts +21 -8
- package/dist/provider-proxy/ingress/providerProxyShared.d.ts +21 -8
- package/dist/provider-proxy/ingress/providerProxyShared.js +31 -26
- package/dist/provider-proxy/types.d.cts +14 -483
- package/dist/provider-proxy/types.d.ts +14 -483
- package/dist/provider-proxy.cjs +44 -27
- package/dist/provider-proxy.d.cts +30 -8
- package/dist/provider-proxy.d.ts +30 -8
- package/dist/provider-proxy.js +43 -26
- package/dist/{routeResolver-C0mkkZaM.d.ts → routeResolver-CTCcSHWu.d.ts} +4 -2
- package/dist/{routeResolver-CVFE8KKe.d.cts → routeResolver-rpKQLyDO.d.cts} +4 -2
- package/dist/transformer/TransformerChainExecutor.cjs +2 -2
- package/dist/transformer/TransformerChainExecutor.d.cts +2 -2
- package/dist/transformer/TransformerChainExecutor.d.ts +2 -2
- package/dist/transformer/TransformerChainExecutor.js +1 -1
- package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.cjs +16 -0
- package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.d.cts +53 -0
- package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.d.ts +53 -0
- package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.js +16 -0
- package/dist/transformer/transformers/AnthropicTransformer.cjs +4 -3
- package/dist/transformer/transformers/AnthropicTransformer.js +3 -2
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +4 -4
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +3 -3
- package/dist/transformer/transformers/GeminiTransformer.cjs +4 -4
- package/dist/transformer/transformers/GeminiTransformer.js +3 -3
- package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +3 -3
- package/dist/transformer/transformers/OpenAIResponseTransformer.js +2 -2
- package/dist/transformer/transformers/OpenAITransformer.cjs +3 -3
- package/dist/transformer/transformers/OpenAITransformer.js +2 -2
- package/dist/transformer/transformers.cjs +10 -9
- package/dist/transformer/transformers.js +13 -12
- package/dist/transformer/types.d.cts +39 -4
- package/dist/transformer/types.d.ts +39 -4
- package/dist/transformer.cjs +14 -13
- package/dist/transformer.js +14 -13
- package/dist/{types-BB8pxk_3.d.ts → types-5T223WYQ.d.ts} +183 -23
- package/dist/types-Bd72H4SB.d.ts +196 -0
- package/dist/types-CVRge76p.d.ts +1115 -0
- package/dist/types-CbglB73l.d.cts +196 -0
- package/dist/types-DsHBBk3h.d.cts +1115 -0
- package/dist/{types-C2MwkLah.d.cts → types-jjU24eYG.d.cts} +183 -23
- package/dist/usage/usage-recorder.cjs +2 -2
- package/dist/usage/usage-recorder.d.cts +12 -2
- package/dist/usage/usage-recorder.d.ts +12 -2
- package/dist/usage/usage-recorder.js +1 -1
- package/dist/usage.cjs +20 -3
- package/dist/usage.d.cts +154 -0
- package/dist/usage.d.ts +154 -0
- package/dist/usage.js +20 -3
- package/package.json +69 -64
- package/dist/chunk-7C7DET6S.js +0 -154
- package/dist/chunk-7VU7V2E4.js +0 -0
- package/dist/chunk-EYZYXJTJ.cjs +0 -1
- package/dist/chunk-FCR77GYM.cjs +0 -33
- package/dist/chunk-K5NM7VAH.js +0 -33
- package/dist/chunk-XPIOJQS2.cjs +0 -154
- /package/dist/{chunk-XXFYLL7R.js → chunk-ECZ3ZE2C.js} +0 -0
- /package/dist/{chunk-3SCOLIPT.cjs → chunk-MXI2PWIC.cjs} +0 -0
package/dist/outbound-api.d.cts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { VoucherConfig } from '@omnicross/contracts/voucher-types';
|
|
2
|
-
import { c as EndpointRoutingConfig, G as GatewayBinding, U as UserMessageQueueConfig, b as ConcurrencyQueueConfig, n as OutboundApiDeps, r as OutboundApiServerStatus, t as OutboundFormatUrls, A as AccountProbeConfig, a as AllowanceSchedulingConfig, F as FingerprintConfig, q as OutboundApiServerConfig, m as ModelPrefixTargets,
|
|
3
|
-
export { C as ChatDispatchMode, E as ENDPOINT_MODEL_KINDS, d as GatewayBindingFallback, e as GatewayBindingKeyScope, f as GatewayBindingModelMode, g as GatewayBindingTarget, h as GatewayModelMapping, K as KeySpendReader, i as KeySpendSeeder, j as KeySpendTracker, M as MessagesModelKind, p as OutboundApiKeyInfo, u as OutboundKeyActivationMode, v as OutboundKeyDbRow, w as OutboundKeyPolicy,
|
|
2
|
+
import { c as EndpointRoutingConfig, G as GatewayBinding, U as UserMessageQueueConfig, b as ConcurrencyQueueConfig, W as AnthropicConfigSegment, n as OutboundApiDeps, r as OutboundApiServerStatus, t as OutboundFormatUrls, A as AccountProbeConfig, a as AllowanceSchedulingConfig, F as FingerprintConfig, q as OutboundApiServerConfig, m as ModelPrefixTargets, y as OutboundProxyConfig, I as ImagesServerConfig, s as OutboundEndpoint, R as RequestRole, T as ModelRef, k as KindMappedEndpoint, l as ModelKind, x as OutboundPermission, O as OutboundKeyDb, o as OutboundApiKeyCreated } from './types-jjU24eYG.cjs';
|
|
3
|
+
export { C as ChatDispatchMode, E as ENDPOINT_MODEL_KINDS, d as GatewayBindingFallback, e as GatewayBindingKeyScope, f as GatewayBindingModelMode, g as GatewayBindingTarget, h as GatewayModelMapping, K as KeySpendReader, i as KeySpendSeeder, j as KeySpendTracker, M as MessagesModelKind, p as OutboundApiKeyInfo, u as OutboundKeyActivationMode, v as OutboundKeyDbRow, w as OutboundKeyPolicy, z as ResponsesModelKind, V as VoucherCreateInput, B as VoucherDb, D as computeVoucherGrant, H as generateVoucherCode, J as hashVoucherCode, L as newVoucherId, N as startOfLocalDay, P as startOfLocalWeek, Q as toVoucherInfo, S as voucherCodePrefix } from './types-jjU24eYG.cjs';
|
|
4
4
|
import { ProxyConfig } from '@omnicross/contracts/account-tokens-types';
|
|
5
5
|
import { AuditConfig } from '@omnicross/contracts/audit-types';
|
|
6
6
|
import { BillingConfig } from '@omnicross/contracts/billing-types';
|
|
7
7
|
import { WebhookDestination, WebhookConfig } from '@omnicross/contracts/webhook-types';
|
|
8
|
+
import { e as ImageApiLimits } from './types-CbglB73l.cjs';
|
|
8
9
|
export { AUDIT_REDACTED, redactAuditText } from './outbound-api/auditRedact.cjs';
|
|
9
10
|
export { AuditCaptureContext, beginAuditCapture } from './outbound-api/auditCapture.cjs';
|
|
10
11
|
export { BillingCaptureContext, beginBillingCapture } from './outbound-api/billingCapture.cjs';
|
|
11
12
|
import { K as KeyCostLimits, M as ModelRestriction } from './keyPolicy-zdWTu3CQ.cjs';
|
|
12
13
|
export { a as KeyExpiryInput, b as KeyExpiryResult, c as KeySpend, Q as QuotaDecision, d as checkKeyQuota, e as computeKeyExpiry } from './keyPolicy-zdWTu3CQ.cjs';
|
|
13
14
|
import http from 'node:http';
|
|
14
|
-
import { IngressFormat } from './
|
|
15
|
-
export { S as SUBSCRIPTION_PROVIDER_IDS, e as endpointSupportsSubscription, i as isSubscriptionProviderId, p as parseModelRef, a as pickModelRefFromList, r as resolveRoute } from './routeResolver-
|
|
15
|
+
import { D as IngressFormat } from './types-DsHBBk3h.cjs';
|
|
16
|
+
export { S as SUBSCRIPTION_PROVIDER_IDS, e as endpointSupportsSubscription, i as isSubscriptionProviderId, p as parseModelRef, a as pickModelRefFromList, r as resolveRoute } from './routeResolver-rpKQLyDO.cjs';
|
|
16
17
|
export { BoundAccountFallbackPolicy, BoundAccountSelectionError, BoundAccountSelectionFailureReason, boundAccountSelectionMessage, isBoundAccountSelectionError } from './pipeline/BoundAccountSelectionError.cjs';
|
|
17
18
|
import '@omnicross/contracts/health-logging-types';
|
|
18
19
|
import './logger-4GvQNzhE.cjs';
|
|
@@ -21,7 +22,9 @@ import '@omnicross/contracts/llm-config';
|
|
|
21
22
|
import './transformer/types.cjs';
|
|
22
23
|
import '@omnicross/contracts/completion-types';
|
|
23
24
|
import './transformer/TransformerService.cjs';
|
|
24
|
-
import './ProviderProxy-
|
|
25
|
+
import './ProviderProxy-CgIcCVwk.cjs';
|
|
26
|
+
import '@omnicross/contracts/image-generation-types';
|
|
27
|
+
import 'node:fs/promises';
|
|
25
28
|
import '@omnicross/contracts/usage-stats-types';
|
|
26
29
|
import '@omnicross/contracts/subscription-types';
|
|
27
30
|
import '@omnicross/contracts/usage-types';
|
|
@@ -62,6 +65,8 @@ declare const DEFAULT_OUTBOUND_PORT = 8765;
|
|
|
62
65
|
interface ApplyConfigInput {
|
|
63
66
|
enabled: boolean;
|
|
64
67
|
networkBinding: boolean;
|
|
68
|
+
/** Additive Images URL publication; serving still depends on runtime capability. */
|
|
69
|
+
imagesEnabled?: boolean;
|
|
65
70
|
endpoints: EndpointRoutingConfig[];
|
|
66
71
|
/** Independent resource bindings; absent preserves legacy endpoint routing. */
|
|
67
72
|
bindings?: GatewayBinding[];
|
|
@@ -73,6 +78,15 @@ interface ApplyConfigInput {
|
|
|
73
78
|
/** Voucher segment (voucher-redemption #9). Read live per request; absent ⇒
|
|
74
79
|
* disabled ⇒ the `/redeem` endpoint is inert (zero regression). */
|
|
75
80
|
voucher?: VoucherConfig;
|
|
81
|
+
/** Anthropic-protocol segment (claude-api-protocol-fidelity, §10). Read live
|
|
82
|
+
* per request; the heartbeat value is hot-applied to the stream synthesizer. */
|
|
83
|
+
anthropic?: AnthropicConfigSegment;
|
|
84
|
+
}
|
|
85
|
+
/** Prepared listener/config publication used by the daemon's settings transaction. */
|
|
86
|
+
interface PreparedOutboundApiConfig {
|
|
87
|
+
publish(): Promise<void>;
|
|
88
|
+
rollback(): Promise<void>;
|
|
89
|
+
dispose(): Promise<void>;
|
|
76
90
|
}
|
|
77
91
|
declare class OutboundApiServer {
|
|
78
92
|
private readonly deps;
|
|
@@ -86,6 +100,10 @@ declare class OutboundApiServer {
|
|
|
86
100
|
private userMessageQueue;
|
|
87
101
|
private concurrencyQueue;
|
|
88
102
|
private voucherConfig;
|
|
103
|
+
private anthropicConfig;
|
|
104
|
+
private imagesEnabled;
|
|
105
|
+
/** R10 `/api/hello` switch (§10 `anthropic.apiHello`, default true). */
|
|
106
|
+
private apiHelloEnabled;
|
|
89
107
|
private readonly rateLimiter;
|
|
90
108
|
/**
|
|
91
109
|
* Redeem-attempt limiter (voucher-redemption #9, design D6) — a SEPARATE bucket
|
|
@@ -111,12 +129,35 @@ declare class OutboundApiServer {
|
|
|
111
129
|
* in place (read live per request — no restart).
|
|
112
130
|
*/
|
|
113
131
|
applyConfig(input: ApplyConfigInput): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Prepare any new listener before persistence when the target can coexist with
|
|
134
|
+
* the current socket. A live fixed-port address-only change cannot be made
|
|
135
|
+
* failure-atomic on every supported platform because the replacement cannot
|
|
136
|
+
* coexist with the old socket, so reject it before persistence instead of
|
|
137
|
+
* performing a fallible close-then-bind during publication.
|
|
138
|
+
*/
|
|
139
|
+
prepareConfig(input: ApplyConfigInput): Promise<PreparedOutboundApiConfig>;
|
|
114
140
|
/** Start the listener on `bindAddr:port`, falling back on EADDRINUSE. */
|
|
115
141
|
start(bindAddr: string, port: number): Promise<number>;
|
|
116
142
|
/** Bind once; on EADDRINUSE retry with an ephemeral port (port 0). */
|
|
117
|
-
private
|
|
143
|
+
private listenDetached;
|
|
144
|
+
private createHttpServer;
|
|
145
|
+
private installConfigSnapshot;
|
|
146
|
+
private captureRuntimeSnapshot;
|
|
147
|
+
private installRuntimeSnapshot;
|
|
148
|
+
private restoreRuntimeSnapshot;
|
|
149
|
+
private closeServer;
|
|
150
|
+
/** Publication already swapped the authoritative pointer; retirement cannot fail it. */
|
|
151
|
+
private closePublishedServer;
|
|
152
|
+
private announcePublishedListener;
|
|
118
153
|
/** Per-request handler. Auth is enforced on EVERY request (incl. loopback). */
|
|
119
154
|
private onRequest;
|
|
155
|
+
/**
|
|
156
|
+
* Serve `HEAD /api/hello` (exact path, query tolerated) with a bare 200 —
|
|
157
|
+
* returning true when it handled the request. Unauthenticated by design and
|
|
158
|
+
* gated on `anthropic.apiHello` (default true).
|
|
159
|
+
*/
|
|
160
|
+
private tryServeApiHello;
|
|
120
161
|
/**
|
|
121
162
|
* Serve `GET|HEAD /health` (+ `/healthz`) from the injected provider, returning
|
|
122
163
|
* true when it handled the request. 200 when `ok`, else 503; secret-free body.
|
|
@@ -197,7 +238,8 @@ declare function normalizeAccountProbe(raw: Partial<OutboundApiServerConfig> | u
|
|
|
197
238
|
* (request-audit-log, design D2). Lenient like the other segment normalizers:
|
|
198
239
|
* `enabled`/`captureBodies`/`trustForwardedFor` coerce to booleans (default
|
|
199
240
|
* false). `maxBodyBytes:-1` means unlimited; other finite values clamp to
|
|
200
|
-
* `[0, 1_048_576]`. `retentionDays` clamps to `[1, 365]
|
|
241
|
+
* `[0, 1_048_576]`. `retentionDays` clamps to `[1, 365]`;
|
|
242
|
+
* `compactStreamingBodies` coerces to a boolean (default false). Default (all-off) ⇒
|
|
201
243
|
* no capture ⇒ zero regression.
|
|
202
244
|
*/
|
|
203
245
|
declare function normalizeAudit(raw: Partial<OutboundApiServerConfig> | undefined | null): AuditConfig;
|
|
@@ -320,6 +362,43 @@ declare function saveServerConfig(store: ApiServerSettingsStore, config: Outboun
|
|
|
320
362
|
/** Apply a partial patch to a config, returning the merged whole. */
|
|
321
363
|
declare function mergeServerConfig(current: OutboundApiServerConfig, patch: Partial<OutboundApiServerConfig>): OutboundApiServerConfig;
|
|
322
364
|
|
|
365
|
+
/** Immutable upper bounds used by both tolerant reads and strict admin writes. */
|
|
366
|
+
declare const IMAGE_SERVER_HARD_CEILINGS: Readonly<{
|
|
367
|
+
queue: Readonly<{
|
|
368
|
+
maxConcurrentJobsPerAccount: 8;
|
|
369
|
+
maxQueuedJobs: 1000;
|
|
370
|
+
queueTimeoutMs: number;
|
|
371
|
+
generationTimeoutMs: number;
|
|
372
|
+
}>;
|
|
373
|
+
temporary: Readonly<{
|
|
374
|
+
maxActiveScopes: 256;
|
|
375
|
+
maxTotalBytes: number;
|
|
376
|
+
maxTenantBytes: number;
|
|
377
|
+
staleAfterMs: number;
|
|
378
|
+
cleanupIntervalMs: number;
|
|
379
|
+
}>;
|
|
380
|
+
limits: Readonly<ImageApiLimits>;
|
|
381
|
+
references: Readonly<{
|
|
382
|
+
ttlMs: number;
|
|
383
|
+
maxArtifactBytes: number;
|
|
384
|
+
maxTotalBytes: number;
|
|
385
|
+
maxTenantBytes: number;
|
|
386
|
+
maxEntries: 1000000;
|
|
387
|
+
maxCalls: 2000000;
|
|
388
|
+
maxResponses: 1000000;
|
|
389
|
+
maxTombstones: 2000000;
|
|
390
|
+
tombstoneTtlMs: number;
|
|
391
|
+
cleanupIntervalMs: number;
|
|
392
|
+
}>;
|
|
393
|
+
evidenceTtlMs: number;
|
|
394
|
+
}>;
|
|
395
|
+
/** Migration-safe default: configured off, finite everywhere, and remote-disabled. */
|
|
396
|
+
declare const DEFAULT_IMAGES_SERVER_CONFIG: Readonly<ImagesServerConfig>;
|
|
397
|
+
/** Tolerant read normalization: malformed members fall back or clamp, never throw. */
|
|
398
|
+
declare function normalizeImagesServerConfig(value: unknown): ImagesServerConfig;
|
|
399
|
+
/** Strict structural/range validation. Daemon validation adds filesystem and resolver policy. */
|
|
400
|
+
declare function validateImagesServerConfig(value: unknown): string[];
|
|
401
|
+
|
|
323
402
|
/**
|
|
324
403
|
* Either the winning route projected to the resolver shape, or `none` — no
|
|
325
404
|
* enabled route for this key/endpoint could serve the request. There is no
|
|
@@ -689,7 +768,15 @@ declare function createNamedKey(db: OutboundKeyDb, name: string): Promise<Outbou
|
|
|
689
768
|
* Mint the local gateway key used by native CLI configuration adapters. Unlike
|
|
690
769
|
* a user-distributed key it is explicitly loopback-only and endpoint-scoped.
|
|
691
770
|
*/
|
|
692
|
-
declare function createIntegrationKey(db: OutboundKeyDb, name: string, allowedEndpoints?:
|
|
771
|
+
declare function createIntegrationKey(db: OutboundKeyDb, name: string, allowedEndpoints?: OutboundPermission[]): Promise<OutboundApiKeyCreated>;
|
|
772
|
+
declare const LEGACY_OUTBOUND_PERMISSIONS: readonly OutboundPermission[];
|
|
773
|
+
/** Strict write-edge validator. Stored-row reads use fail-closed interpretation below. */
|
|
774
|
+
declare function validateOutboundPermissions(value: unknown): OutboundPermission[];
|
|
775
|
+
/**
|
|
776
|
+
* Authoritative legacy interpretation. Absence preserves only the four historic
|
|
777
|
+
* families; malformed persisted data denies all instead of widening access.
|
|
778
|
+
*/
|
|
779
|
+
declare function effectiveOutboundPermissions(value: unknown): readonly OutboundPermission[];
|
|
693
780
|
/**
|
|
694
781
|
* A verified key + the enforcement inputs carried from the row so the wire layer
|
|
695
782
|
* runs its policy checks WITHOUT a second DB read (mirrors `maxConcurrency`).
|
|
@@ -697,7 +784,7 @@ declare function createIntegrationKey(db: OutboundKeyDb, name: string, allowedEn
|
|
|
697
784
|
interface VerifiedKey {
|
|
698
785
|
id: string;
|
|
699
786
|
kind?: 'client' | 'integration';
|
|
700
|
-
allowedEndpoints
|
|
787
|
+
allowedEndpoints: OutboundPermission[];
|
|
701
788
|
loopbackOnly?: boolean;
|
|
702
789
|
/**
|
|
703
790
|
* The key's per-key concurrency ceiling, carried from the row so the wire
|
|
@@ -919,4 +1006,4 @@ declare function getOutboundApiServer(deps?: OutboundApiDeps, onPortChange?: (po
|
|
|
919
1006
|
/** Reset the singleton (tests / teardown only). */
|
|
920
1007
|
declare function __resetOutboundApiServerForTests(): void;
|
|
921
1008
|
|
|
922
|
-
export { AccountProbeConfig, AllowanceSchedulingConfig, type ApiServerSettingsStore, type ApplyConfigInput, ConcurrencyQueueConfig, ConcurrencyQueueFullError, ConcurrencyWaitCancelledError, ConcurrencyWaitTimeoutError, DEFAULT_ACCOUNT_PROBE, DEFAULT_ALLOWANCE_SCHEDULING, DEFAULT_CONCURRENCY_QUEUE, DEFAULT_FINGERPRINT, DEFAULT_OUTBOUND_PORT, DEFAULT_USER_MESSAGE_QUEUE, EndpointRoutingConfig, FingerprintConfig, type GateAcquireOptions, type GateAcquisition, type GateSlot, type GateStatusEntry, GatewayBinding, type GatewayBindingResolution, KeyCostLimits, type KeyVerification, KeyedMutex, KindMappedEndpoint, ModelKind, type ModelPrefixKind, ModelPrefixTargets, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiDeps, OutboundApiKeyCreated, OutboundApiServer, OutboundApiServerConfig, OutboundApiServerStatus, OutboundConcurrencyGate, OutboundEndpoint, OutboundFormatUrls, OutboundKeyDb, OutboundProxyConfig, OutboundRateLimiter, RequestRole, type ResolveGatewayBindingInput, type SerialAcquireOptions, type SerialQueueStatusEntry, SerialQueueTimeoutError, type SerialSlot, UserMessageQueueConfig, UserMessageSerialQueue, type VerifiedKey, __resetOutboundApiServerForTests, candidateBackgroundModelIds, candidateGatewayBindings, classifyModelPrefix, createIntegrationKey, createNamedKey, defaultServerConfig, detectModelKind, detectRequestRole, endpointToIngressFormat, formatUrls, gatewayBindingToEndpointConfig, getOutboundApiServer, handleVoucherRedeem, hashKey, isConcurrencyRejection, isKindMappedEndpoint, isRedeemRequest, isSerialQueueTimeout, isUserMessageRequest, legacyEndpointsToBindings, loadServerConfig, mergeServerConfig, modelKindsForEndpoint, normalizeAccountProbe, normalizeAllowanceScheduling, normalizeAudit, normalizeBilling, normalizeFingerprint, normalizeGatewayBindings, normalizePrefixTargets, normalizeProxyConfig, normalizeProxySegment, normalizeQueueSegments, normalizeServerConfig, normalizeVoucher, normalizeWebhookDestination, normalizeWebhookSegment, randomBase62, resolveGatewayBinding, resolvePrefixTarget, saveServerConfig, validateEndpointModelConfig, verifyKey, verifyPresentedKey };
|
|
1009
|
+
export { AccountProbeConfig, AllowanceSchedulingConfig, type ApiServerSettingsStore, type ApplyConfigInput, ConcurrencyQueueConfig, ConcurrencyQueueFullError, ConcurrencyWaitCancelledError, ConcurrencyWaitTimeoutError, DEFAULT_ACCOUNT_PROBE, DEFAULT_ALLOWANCE_SCHEDULING, DEFAULT_CONCURRENCY_QUEUE, DEFAULT_FINGERPRINT, DEFAULT_IMAGES_SERVER_CONFIG, DEFAULT_OUTBOUND_PORT, DEFAULT_USER_MESSAGE_QUEUE, EndpointRoutingConfig, FingerprintConfig, type GateAcquireOptions, type GateAcquisition, type GateSlot, type GateStatusEntry, GatewayBinding, type GatewayBindingResolution, IMAGE_SERVER_HARD_CEILINGS, ImagesServerConfig, KeyCostLimits, type KeyVerification, KeyedMutex, KindMappedEndpoint, LEGACY_OUTBOUND_PERMISSIONS, ModelKind, type ModelPrefixKind, ModelPrefixTargets, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiDeps, OutboundApiKeyCreated, OutboundApiServer, OutboundApiServerConfig, OutboundApiServerStatus, OutboundConcurrencyGate, OutboundEndpoint, OutboundFormatUrls, OutboundKeyDb, OutboundPermission, OutboundProxyConfig, OutboundRateLimiter, type PreparedOutboundApiConfig, RequestRole, type ResolveGatewayBindingInput, type SerialAcquireOptions, type SerialQueueStatusEntry, SerialQueueTimeoutError, type SerialSlot, UserMessageQueueConfig, UserMessageSerialQueue, type VerifiedKey, __resetOutboundApiServerForTests, candidateBackgroundModelIds, candidateGatewayBindings, classifyModelPrefix, createIntegrationKey, createNamedKey, defaultServerConfig, detectModelKind, detectRequestRole, effectiveOutboundPermissions, endpointToIngressFormat, formatUrls, gatewayBindingToEndpointConfig, getOutboundApiServer, handleVoucherRedeem, hashKey, isConcurrencyRejection, isKindMappedEndpoint, isRedeemRequest, isSerialQueueTimeout, isUserMessageRequest, legacyEndpointsToBindings, loadServerConfig, mergeServerConfig, modelKindsForEndpoint, normalizeAccountProbe, normalizeAllowanceScheduling, normalizeAudit, normalizeBilling, normalizeFingerprint, normalizeGatewayBindings, normalizeImagesServerConfig, normalizePrefixTargets, normalizeProxyConfig, normalizeProxySegment, normalizeQueueSegments, normalizeServerConfig, normalizeVoucher, normalizeWebhookDestination, normalizeWebhookSegment, randomBase62, resolveGatewayBinding, resolvePrefixTarget, saveServerConfig, validateEndpointModelConfig, validateImagesServerConfig, validateOutboundPermissions, verifyKey, verifyPresentedKey };
|
package/dist/outbound-api.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { VoucherConfig } from '@omnicross/contracts/voucher-types';
|
|
2
|
-
import { c as EndpointRoutingConfig, G as GatewayBinding, U as UserMessageQueueConfig, b as ConcurrencyQueueConfig, n as OutboundApiDeps, r as OutboundApiServerStatus, t as OutboundFormatUrls, A as AccountProbeConfig, a as AllowanceSchedulingConfig, F as FingerprintConfig, q as OutboundApiServerConfig, m as ModelPrefixTargets,
|
|
3
|
-
export { C as ChatDispatchMode, E as ENDPOINT_MODEL_KINDS, d as GatewayBindingFallback, e as GatewayBindingKeyScope, f as GatewayBindingModelMode, g as GatewayBindingTarget, h as GatewayModelMapping, K as KeySpendReader, i as KeySpendSeeder, j as KeySpendTracker, M as MessagesModelKind, p as OutboundApiKeyInfo, u as OutboundKeyActivationMode, v as OutboundKeyDbRow, w as OutboundKeyPolicy,
|
|
2
|
+
import { c as EndpointRoutingConfig, G as GatewayBinding, U as UserMessageQueueConfig, b as ConcurrencyQueueConfig, W as AnthropicConfigSegment, n as OutboundApiDeps, r as OutboundApiServerStatus, t as OutboundFormatUrls, A as AccountProbeConfig, a as AllowanceSchedulingConfig, F as FingerprintConfig, q as OutboundApiServerConfig, m as ModelPrefixTargets, y as OutboundProxyConfig, I as ImagesServerConfig, s as OutboundEndpoint, R as RequestRole, T as ModelRef, k as KindMappedEndpoint, l as ModelKind, x as OutboundPermission, O as OutboundKeyDb, o as OutboundApiKeyCreated } from './types-5T223WYQ.js';
|
|
3
|
+
export { C as ChatDispatchMode, E as ENDPOINT_MODEL_KINDS, d as GatewayBindingFallback, e as GatewayBindingKeyScope, f as GatewayBindingModelMode, g as GatewayBindingTarget, h as GatewayModelMapping, K as KeySpendReader, i as KeySpendSeeder, j as KeySpendTracker, M as MessagesModelKind, p as OutboundApiKeyInfo, u as OutboundKeyActivationMode, v as OutboundKeyDbRow, w as OutboundKeyPolicy, z as ResponsesModelKind, V as VoucherCreateInput, B as VoucherDb, D as computeVoucherGrant, H as generateVoucherCode, J as hashVoucherCode, L as newVoucherId, N as startOfLocalDay, P as startOfLocalWeek, Q as toVoucherInfo, S as voucherCodePrefix } from './types-5T223WYQ.js';
|
|
4
4
|
import { ProxyConfig } from '@omnicross/contracts/account-tokens-types';
|
|
5
5
|
import { AuditConfig } from '@omnicross/contracts/audit-types';
|
|
6
6
|
import { BillingConfig } from '@omnicross/contracts/billing-types';
|
|
7
7
|
import { WebhookDestination, WebhookConfig } from '@omnicross/contracts/webhook-types';
|
|
8
|
+
import { e as ImageApiLimits } from './types-Bd72H4SB.js';
|
|
8
9
|
export { AUDIT_REDACTED, redactAuditText } from './outbound-api/auditRedact.js';
|
|
9
10
|
export { AuditCaptureContext, beginAuditCapture } from './outbound-api/auditCapture.js';
|
|
10
11
|
export { BillingCaptureContext, beginBillingCapture } from './outbound-api/billingCapture.js';
|
|
11
12
|
import { K as KeyCostLimits, M as ModelRestriction } from './keyPolicy-zdWTu3CQ.js';
|
|
12
13
|
export { a as KeyExpiryInput, b as KeyExpiryResult, c as KeySpend, Q as QuotaDecision, d as checkKeyQuota, e as computeKeyExpiry } from './keyPolicy-zdWTu3CQ.js';
|
|
13
14
|
import http from 'node:http';
|
|
14
|
-
import { IngressFormat } from './
|
|
15
|
-
export { S as SUBSCRIPTION_PROVIDER_IDS, e as endpointSupportsSubscription, i as isSubscriptionProviderId, p as parseModelRef, a as pickModelRefFromList, r as resolveRoute } from './routeResolver-
|
|
15
|
+
import { D as IngressFormat } from './types-CVRge76p.js';
|
|
16
|
+
export { S as SUBSCRIPTION_PROVIDER_IDS, e as endpointSupportsSubscription, i as isSubscriptionProviderId, p as parseModelRef, a as pickModelRefFromList, r as resolveRoute } from './routeResolver-CTCcSHWu.js';
|
|
16
17
|
export { BoundAccountFallbackPolicy, BoundAccountSelectionError, BoundAccountSelectionFailureReason, boundAccountSelectionMessage, isBoundAccountSelectionError } from './pipeline/BoundAccountSelectionError.js';
|
|
17
18
|
import '@omnicross/contracts/health-logging-types';
|
|
18
19
|
import './logger-4GvQNzhE.js';
|
|
@@ -21,7 +22,9 @@ import '@omnicross/contracts/llm-config';
|
|
|
21
22
|
import './transformer/types.js';
|
|
22
23
|
import '@omnicross/contracts/completion-types';
|
|
23
24
|
import './transformer/TransformerService.js';
|
|
24
|
-
import './ProviderProxy
|
|
25
|
+
import './ProviderProxy-DYoY5XoT.js';
|
|
26
|
+
import '@omnicross/contracts/image-generation-types';
|
|
27
|
+
import 'node:fs/promises';
|
|
25
28
|
import '@omnicross/contracts/usage-stats-types';
|
|
26
29
|
import '@omnicross/contracts/subscription-types';
|
|
27
30
|
import '@omnicross/contracts/usage-types';
|
|
@@ -62,6 +65,8 @@ declare const DEFAULT_OUTBOUND_PORT = 8765;
|
|
|
62
65
|
interface ApplyConfigInput {
|
|
63
66
|
enabled: boolean;
|
|
64
67
|
networkBinding: boolean;
|
|
68
|
+
/** Additive Images URL publication; serving still depends on runtime capability. */
|
|
69
|
+
imagesEnabled?: boolean;
|
|
65
70
|
endpoints: EndpointRoutingConfig[];
|
|
66
71
|
/** Independent resource bindings; absent preserves legacy endpoint routing. */
|
|
67
72
|
bindings?: GatewayBinding[];
|
|
@@ -73,6 +78,15 @@ interface ApplyConfigInput {
|
|
|
73
78
|
/** Voucher segment (voucher-redemption #9). Read live per request; absent ⇒
|
|
74
79
|
* disabled ⇒ the `/redeem` endpoint is inert (zero regression). */
|
|
75
80
|
voucher?: VoucherConfig;
|
|
81
|
+
/** Anthropic-protocol segment (claude-api-protocol-fidelity, §10). Read live
|
|
82
|
+
* per request; the heartbeat value is hot-applied to the stream synthesizer. */
|
|
83
|
+
anthropic?: AnthropicConfigSegment;
|
|
84
|
+
}
|
|
85
|
+
/** Prepared listener/config publication used by the daemon's settings transaction. */
|
|
86
|
+
interface PreparedOutboundApiConfig {
|
|
87
|
+
publish(): Promise<void>;
|
|
88
|
+
rollback(): Promise<void>;
|
|
89
|
+
dispose(): Promise<void>;
|
|
76
90
|
}
|
|
77
91
|
declare class OutboundApiServer {
|
|
78
92
|
private readonly deps;
|
|
@@ -86,6 +100,10 @@ declare class OutboundApiServer {
|
|
|
86
100
|
private userMessageQueue;
|
|
87
101
|
private concurrencyQueue;
|
|
88
102
|
private voucherConfig;
|
|
103
|
+
private anthropicConfig;
|
|
104
|
+
private imagesEnabled;
|
|
105
|
+
/** R10 `/api/hello` switch (§10 `anthropic.apiHello`, default true). */
|
|
106
|
+
private apiHelloEnabled;
|
|
89
107
|
private readonly rateLimiter;
|
|
90
108
|
/**
|
|
91
109
|
* Redeem-attempt limiter (voucher-redemption #9, design D6) — a SEPARATE bucket
|
|
@@ -111,12 +129,35 @@ declare class OutboundApiServer {
|
|
|
111
129
|
* in place (read live per request — no restart).
|
|
112
130
|
*/
|
|
113
131
|
applyConfig(input: ApplyConfigInput): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Prepare any new listener before persistence when the target can coexist with
|
|
134
|
+
* the current socket. A live fixed-port address-only change cannot be made
|
|
135
|
+
* failure-atomic on every supported platform because the replacement cannot
|
|
136
|
+
* coexist with the old socket, so reject it before persistence instead of
|
|
137
|
+
* performing a fallible close-then-bind during publication.
|
|
138
|
+
*/
|
|
139
|
+
prepareConfig(input: ApplyConfigInput): Promise<PreparedOutboundApiConfig>;
|
|
114
140
|
/** Start the listener on `bindAddr:port`, falling back on EADDRINUSE. */
|
|
115
141
|
start(bindAddr: string, port: number): Promise<number>;
|
|
116
142
|
/** Bind once; on EADDRINUSE retry with an ephemeral port (port 0). */
|
|
117
|
-
private
|
|
143
|
+
private listenDetached;
|
|
144
|
+
private createHttpServer;
|
|
145
|
+
private installConfigSnapshot;
|
|
146
|
+
private captureRuntimeSnapshot;
|
|
147
|
+
private installRuntimeSnapshot;
|
|
148
|
+
private restoreRuntimeSnapshot;
|
|
149
|
+
private closeServer;
|
|
150
|
+
/** Publication already swapped the authoritative pointer; retirement cannot fail it. */
|
|
151
|
+
private closePublishedServer;
|
|
152
|
+
private announcePublishedListener;
|
|
118
153
|
/** Per-request handler. Auth is enforced on EVERY request (incl. loopback). */
|
|
119
154
|
private onRequest;
|
|
155
|
+
/**
|
|
156
|
+
* Serve `HEAD /api/hello` (exact path, query tolerated) with a bare 200 —
|
|
157
|
+
* returning true when it handled the request. Unauthenticated by design and
|
|
158
|
+
* gated on `anthropic.apiHello` (default true).
|
|
159
|
+
*/
|
|
160
|
+
private tryServeApiHello;
|
|
120
161
|
/**
|
|
121
162
|
* Serve `GET|HEAD /health` (+ `/healthz`) from the injected provider, returning
|
|
122
163
|
* true when it handled the request. 200 when `ok`, else 503; secret-free body.
|
|
@@ -197,7 +238,8 @@ declare function normalizeAccountProbe(raw: Partial<OutboundApiServerConfig> | u
|
|
|
197
238
|
* (request-audit-log, design D2). Lenient like the other segment normalizers:
|
|
198
239
|
* `enabled`/`captureBodies`/`trustForwardedFor` coerce to booleans (default
|
|
199
240
|
* false). `maxBodyBytes:-1` means unlimited; other finite values clamp to
|
|
200
|
-
* `[0, 1_048_576]`. `retentionDays` clamps to `[1, 365]
|
|
241
|
+
* `[0, 1_048_576]`. `retentionDays` clamps to `[1, 365]`;
|
|
242
|
+
* `compactStreamingBodies` coerces to a boolean (default false). Default (all-off) ⇒
|
|
201
243
|
* no capture ⇒ zero regression.
|
|
202
244
|
*/
|
|
203
245
|
declare function normalizeAudit(raw: Partial<OutboundApiServerConfig> | undefined | null): AuditConfig;
|
|
@@ -320,6 +362,43 @@ declare function saveServerConfig(store: ApiServerSettingsStore, config: Outboun
|
|
|
320
362
|
/** Apply a partial patch to a config, returning the merged whole. */
|
|
321
363
|
declare function mergeServerConfig(current: OutboundApiServerConfig, patch: Partial<OutboundApiServerConfig>): OutboundApiServerConfig;
|
|
322
364
|
|
|
365
|
+
/** Immutable upper bounds used by both tolerant reads and strict admin writes. */
|
|
366
|
+
declare const IMAGE_SERVER_HARD_CEILINGS: Readonly<{
|
|
367
|
+
queue: Readonly<{
|
|
368
|
+
maxConcurrentJobsPerAccount: 8;
|
|
369
|
+
maxQueuedJobs: 1000;
|
|
370
|
+
queueTimeoutMs: number;
|
|
371
|
+
generationTimeoutMs: number;
|
|
372
|
+
}>;
|
|
373
|
+
temporary: Readonly<{
|
|
374
|
+
maxActiveScopes: 256;
|
|
375
|
+
maxTotalBytes: number;
|
|
376
|
+
maxTenantBytes: number;
|
|
377
|
+
staleAfterMs: number;
|
|
378
|
+
cleanupIntervalMs: number;
|
|
379
|
+
}>;
|
|
380
|
+
limits: Readonly<ImageApiLimits>;
|
|
381
|
+
references: Readonly<{
|
|
382
|
+
ttlMs: number;
|
|
383
|
+
maxArtifactBytes: number;
|
|
384
|
+
maxTotalBytes: number;
|
|
385
|
+
maxTenantBytes: number;
|
|
386
|
+
maxEntries: 1000000;
|
|
387
|
+
maxCalls: 2000000;
|
|
388
|
+
maxResponses: 1000000;
|
|
389
|
+
maxTombstones: 2000000;
|
|
390
|
+
tombstoneTtlMs: number;
|
|
391
|
+
cleanupIntervalMs: number;
|
|
392
|
+
}>;
|
|
393
|
+
evidenceTtlMs: number;
|
|
394
|
+
}>;
|
|
395
|
+
/** Migration-safe default: configured off, finite everywhere, and remote-disabled. */
|
|
396
|
+
declare const DEFAULT_IMAGES_SERVER_CONFIG: Readonly<ImagesServerConfig>;
|
|
397
|
+
/** Tolerant read normalization: malformed members fall back or clamp, never throw. */
|
|
398
|
+
declare function normalizeImagesServerConfig(value: unknown): ImagesServerConfig;
|
|
399
|
+
/** Strict structural/range validation. Daemon validation adds filesystem and resolver policy. */
|
|
400
|
+
declare function validateImagesServerConfig(value: unknown): string[];
|
|
401
|
+
|
|
323
402
|
/**
|
|
324
403
|
* Either the winning route projected to the resolver shape, or `none` — no
|
|
325
404
|
* enabled route for this key/endpoint could serve the request. There is no
|
|
@@ -689,7 +768,15 @@ declare function createNamedKey(db: OutboundKeyDb, name: string): Promise<Outbou
|
|
|
689
768
|
* Mint the local gateway key used by native CLI configuration adapters. Unlike
|
|
690
769
|
* a user-distributed key it is explicitly loopback-only and endpoint-scoped.
|
|
691
770
|
*/
|
|
692
|
-
declare function createIntegrationKey(db: OutboundKeyDb, name: string, allowedEndpoints?:
|
|
771
|
+
declare function createIntegrationKey(db: OutboundKeyDb, name: string, allowedEndpoints?: OutboundPermission[]): Promise<OutboundApiKeyCreated>;
|
|
772
|
+
declare const LEGACY_OUTBOUND_PERMISSIONS: readonly OutboundPermission[];
|
|
773
|
+
/** Strict write-edge validator. Stored-row reads use fail-closed interpretation below. */
|
|
774
|
+
declare function validateOutboundPermissions(value: unknown): OutboundPermission[];
|
|
775
|
+
/**
|
|
776
|
+
* Authoritative legacy interpretation. Absence preserves only the four historic
|
|
777
|
+
* families; malformed persisted data denies all instead of widening access.
|
|
778
|
+
*/
|
|
779
|
+
declare function effectiveOutboundPermissions(value: unknown): readonly OutboundPermission[];
|
|
693
780
|
/**
|
|
694
781
|
* A verified key + the enforcement inputs carried from the row so the wire layer
|
|
695
782
|
* runs its policy checks WITHOUT a second DB read (mirrors `maxConcurrency`).
|
|
@@ -697,7 +784,7 @@ declare function createIntegrationKey(db: OutboundKeyDb, name: string, allowedEn
|
|
|
697
784
|
interface VerifiedKey {
|
|
698
785
|
id: string;
|
|
699
786
|
kind?: 'client' | 'integration';
|
|
700
|
-
allowedEndpoints
|
|
787
|
+
allowedEndpoints: OutboundPermission[];
|
|
701
788
|
loopbackOnly?: boolean;
|
|
702
789
|
/**
|
|
703
790
|
* The key's per-key concurrency ceiling, carried from the row so the wire
|
|
@@ -919,4 +1006,4 @@ declare function getOutboundApiServer(deps?: OutboundApiDeps, onPortChange?: (po
|
|
|
919
1006
|
/** Reset the singleton (tests / teardown only). */
|
|
920
1007
|
declare function __resetOutboundApiServerForTests(): void;
|
|
921
1008
|
|
|
922
|
-
export { AccountProbeConfig, AllowanceSchedulingConfig, type ApiServerSettingsStore, type ApplyConfigInput, ConcurrencyQueueConfig, ConcurrencyQueueFullError, ConcurrencyWaitCancelledError, ConcurrencyWaitTimeoutError, DEFAULT_ACCOUNT_PROBE, DEFAULT_ALLOWANCE_SCHEDULING, DEFAULT_CONCURRENCY_QUEUE, DEFAULT_FINGERPRINT, DEFAULT_OUTBOUND_PORT, DEFAULT_USER_MESSAGE_QUEUE, EndpointRoutingConfig, FingerprintConfig, type GateAcquireOptions, type GateAcquisition, type GateSlot, type GateStatusEntry, GatewayBinding, type GatewayBindingResolution, KeyCostLimits, type KeyVerification, KeyedMutex, KindMappedEndpoint, ModelKind, type ModelPrefixKind, ModelPrefixTargets, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiDeps, OutboundApiKeyCreated, OutboundApiServer, OutboundApiServerConfig, OutboundApiServerStatus, OutboundConcurrencyGate, OutboundEndpoint, OutboundFormatUrls, OutboundKeyDb, OutboundProxyConfig, OutboundRateLimiter, RequestRole, type ResolveGatewayBindingInput, type SerialAcquireOptions, type SerialQueueStatusEntry, SerialQueueTimeoutError, type SerialSlot, UserMessageQueueConfig, UserMessageSerialQueue, type VerifiedKey, __resetOutboundApiServerForTests, candidateBackgroundModelIds, candidateGatewayBindings, classifyModelPrefix, createIntegrationKey, createNamedKey, defaultServerConfig, detectModelKind, detectRequestRole, endpointToIngressFormat, formatUrls, gatewayBindingToEndpointConfig, getOutboundApiServer, handleVoucherRedeem, hashKey, isConcurrencyRejection, isKindMappedEndpoint, isRedeemRequest, isSerialQueueTimeout, isUserMessageRequest, legacyEndpointsToBindings, loadServerConfig, mergeServerConfig, modelKindsForEndpoint, normalizeAccountProbe, normalizeAllowanceScheduling, normalizeAudit, normalizeBilling, normalizeFingerprint, normalizeGatewayBindings, normalizePrefixTargets, normalizeProxyConfig, normalizeProxySegment, normalizeQueueSegments, normalizeServerConfig, normalizeVoucher, normalizeWebhookDestination, normalizeWebhookSegment, randomBase62, resolveGatewayBinding, resolvePrefixTarget, saveServerConfig, validateEndpointModelConfig, verifyKey, verifyPresentedKey };
|
|
1009
|
+
export { AccountProbeConfig, AllowanceSchedulingConfig, type ApiServerSettingsStore, type ApplyConfigInput, ConcurrencyQueueConfig, ConcurrencyQueueFullError, ConcurrencyWaitCancelledError, ConcurrencyWaitTimeoutError, DEFAULT_ACCOUNT_PROBE, DEFAULT_ALLOWANCE_SCHEDULING, DEFAULT_CONCURRENCY_QUEUE, DEFAULT_FINGERPRINT, DEFAULT_IMAGES_SERVER_CONFIG, DEFAULT_OUTBOUND_PORT, DEFAULT_USER_MESSAGE_QUEUE, EndpointRoutingConfig, FingerprintConfig, type GateAcquireOptions, type GateAcquisition, type GateSlot, type GateStatusEntry, GatewayBinding, type GatewayBindingResolution, IMAGE_SERVER_HARD_CEILINGS, ImagesServerConfig, KeyCostLimits, type KeyVerification, KeyedMutex, KindMappedEndpoint, LEGACY_OUTBOUND_PERMISSIONS, ModelKind, type ModelPrefixKind, ModelPrefixTargets, OUTBOUND_API_SERVER_CONFIG_KEY, OutboundApiDeps, OutboundApiKeyCreated, OutboundApiServer, OutboundApiServerConfig, OutboundApiServerStatus, OutboundConcurrencyGate, OutboundEndpoint, OutboundFormatUrls, OutboundKeyDb, OutboundPermission, OutboundProxyConfig, OutboundRateLimiter, type PreparedOutboundApiConfig, RequestRole, type ResolveGatewayBindingInput, type SerialAcquireOptions, type SerialQueueStatusEntry, SerialQueueTimeoutError, type SerialSlot, UserMessageQueueConfig, UserMessageSerialQueue, type VerifiedKey, __resetOutboundApiServerForTests, candidateBackgroundModelIds, candidateGatewayBindings, classifyModelPrefix, createIntegrationKey, createNamedKey, defaultServerConfig, detectModelKind, detectRequestRole, effectiveOutboundPermissions, endpointToIngressFormat, formatUrls, gatewayBindingToEndpointConfig, getOutboundApiServer, handleVoucherRedeem, hashKey, isConcurrencyRejection, isKindMappedEndpoint, isRedeemRequest, isSerialQueueTimeout, isUserMessageRequest, legacyEndpointsToBindings, loadServerConfig, mergeServerConfig, modelKindsForEndpoint, normalizeAccountProbe, normalizeAllowanceScheduling, normalizeAudit, normalizeBilling, normalizeFingerprint, normalizeGatewayBindings, normalizeImagesServerConfig, normalizePrefixTargets, normalizeProxyConfig, normalizeProxySegment, normalizeQueueSegments, normalizeServerConfig, normalizeVoucher, normalizeWebhookDestination, normalizeWebhookSegment, randomBase62, resolveGatewayBinding, resolvePrefixTarget, saveServerConfig, validateEndpointModelConfig, validateImagesServerConfig, validateOutboundPermissions, verifyKey, verifyPresentedKey };
|
package/dist/outbound-api.js
CHANGED
|
@@ -6,10 +6,13 @@ import {
|
|
|
6
6
|
DEFAULT_ALLOWANCE_SCHEDULING,
|
|
7
7
|
DEFAULT_CONCURRENCY_QUEUE,
|
|
8
8
|
DEFAULT_FINGERPRINT,
|
|
9
|
+
DEFAULT_IMAGES_SERVER_CONFIG,
|
|
9
10
|
DEFAULT_OUTBOUND_PORT,
|
|
10
11
|
DEFAULT_USER_MESSAGE_QUEUE,
|
|
12
|
+
IMAGE_SERVER_HARD_CEILINGS,
|
|
11
13
|
KeySpendTracker,
|
|
12
14
|
KeyedMutex,
|
|
15
|
+
LEGACY_OUTBOUND_PERMISSIONS,
|
|
13
16
|
OUTBOUND_API_SERVER_CONFIG_KEY,
|
|
14
17
|
OutboundApiServer,
|
|
15
18
|
OutboundConcurrencyGate,
|
|
@@ -25,6 +28,7 @@ import {
|
|
|
25
28
|
createIntegrationKey,
|
|
26
29
|
createNamedKey,
|
|
27
30
|
defaultServerConfig,
|
|
31
|
+
effectiveOutboundPermissions,
|
|
28
32
|
formatUrls,
|
|
29
33
|
gatewayBindingToEndpointConfig,
|
|
30
34
|
generateVoucherCode,
|
|
@@ -46,6 +50,7 @@ import {
|
|
|
46
50
|
normalizeBilling,
|
|
47
51
|
normalizeFingerprint,
|
|
48
52
|
normalizeGatewayBindings,
|
|
53
|
+
normalizeImagesServerConfig,
|
|
49
54
|
normalizePrefixTargets,
|
|
50
55
|
normalizeProxyConfig,
|
|
51
56
|
normalizeProxySegment,
|
|
@@ -60,34 +65,39 @@ import {
|
|
|
60
65
|
startOfLocalDay,
|
|
61
66
|
startOfLocalWeek,
|
|
62
67
|
toVoucherInfo,
|
|
68
|
+
validateImagesServerConfig,
|
|
69
|
+
validateOutboundPermissions,
|
|
63
70
|
verifyKey,
|
|
64
71
|
verifyPresentedKey,
|
|
65
72
|
voucherCodePrefix
|
|
66
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-WSJE42SG.js";
|
|
67
74
|
import "./chunk-VVEHS2LI.js";
|
|
68
75
|
import "./chunk-WTQMX2Q6.js";
|
|
69
|
-
import "./chunk-
|
|
70
|
-
import "./chunk-
|
|
71
|
-
import "./chunk-
|
|
72
|
-
import "./chunk-
|
|
76
|
+
import "./chunk-EYGBM2VC.js";
|
|
77
|
+
import "./chunk-DK4A7DLE.js";
|
|
78
|
+
import "./chunk-FJNKXOWE.js";
|
|
79
|
+
import "./chunk-V53ZEFXC.js";
|
|
80
|
+
import "./chunk-7PIUVCKK.js";
|
|
81
|
+
import "./chunk-6OC3ORW6.js";
|
|
73
82
|
import "./chunk-FU7EAR73.js";
|
|
74
|
-
import "./chunk-
|
|
75
|
-
import "./chunk-
|
|
83
|
+
import "./chunk-LFEH7CEO.js";
|
|
84
|
+
import "./chunk-HN74IGEO.js";
|
|
85
|
+
import "./chunk-QIIAMBTM.js";
|
|
76
86
|
import "./chunk-FXR6N3SR.js";
|
|
77
|
-
import "./chunk-
|
|
78
|
-
import "./chunk-WNKWAEUR.js";
|
|
87
|
+
import "./chunk-AQDON6MB.js";
|
|
79
88
|
import "./chunk-MZNPGW5Q.js";
|
|
80
|
-
import "./chunk-
|
|
81
|
-
import "./chunk-XXFYLL7R.js";
|
|
89
|
+
import "./chunk-ECZ3ZE2C.js";
|
|
82
90
|
import "./chunk-XTEI64OU.js";
|
|
83
91
|
import "./chunk-XX6NQJMA.js";
|
|
84
92
|
import "./chunk-GFIZ6LQI.js";
|
|
85
93
|
import "./chunk-OE6TDIWW.js";
|
|
86
94
|
import "./chunk-DRWHTIIZ.js";
|
|
95
|
+
import "./chunk-X335TJNS.js";
|
|
96
|
+
import "./chunk-HOMUGKHR.js";
|
|
87
97
|
import "./chunk-JWC6APFQ.js";
|
|
88
98
|
import "./chunk-5ERIZW3D.js";
|
|
89
99
|
import "./chunk-PO3XB56Z.js";
|
|
90
|
-
import "./chunk-
|
|
100
|
+
import "./chunk-V2UKUTJ3.js";
|
|
91
101
|
import "./chunk-23S5OPIO.js";
|
|
92
102
|
import "./chunk-AVYJ4YBN.js";
|
|
93
103
|
import "./chunk-OPRS4IQZ.js";
|
|
@@ -96,12 +106,19 @@ import {
|
|
|
96
106
|
boundAccountSelectionMessage,
|
|
97
107
|
isBoundAccountSelectionError
|
|
98
108
|
} from "./chunk-2JYRIADS.js";
|
|
99
|
-
import
|
|
100
|
-
|
|
109
|
+
import {
|
|
110
|
+
beginAuditCapture
|
|
111
|
+
} from "./chunk-6OKXH2TW.js";
|
|
112
|
+
import "./chunk-WNY4WMRF.js";
|
|
113
|
+
import {
|
|
114
|
+
AUDIT_REDACTED,
|
|
115
|
+
redactAuditText
|
|
116
|
+
} from "./chunk-N76KU6F5.js";
|
|
101
117
|
import {
|
|
102
118
|
beginBillingCapture
|
|
103
119
|
} from "./chunk-WLYIIEAF.js";
|
|
104
120
|
import "./chunk-TKJMZBAH.js";
|
|
121
|
+
import "./chunk-OZFM4X3S.js";
|
|
105
122
|
import "./chunk-3QFXFCHG.js";
|
|
106
123
|
import {
|
|
107
124
|
SUBSCRIPTION_PROVIDER_IDS,
|
|
@@ -118,34 +135,27 @@ import {
|
|
|
118
135
|
resolvePrefixTarget,
|
|
119
136
|
resolveRoute,
|
|
120
137
|
validateEndpointModelConfig
|
|
121
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-U47LQXPB.js";
|
|
122
139
|
import "./chunk-AQ5TNQB7.js";
|
|
123
140
|
import {
|
|
124
141
|
ENDPOINT_MODEL_KINDS
|
|
125
142
|
} from "./chunk-XEKD23J5.js";
|
|
143
|
+
import "./chunk-Y7FO65VT.js";
|
|
144
|
+
import "./chunk-FMOBD2OQ.js";
|
|
145
|
+
import "./chunk-HUZZZ3JL.js";
|
|
126
146
|
import "./chunk-H5JUT3KV.js";
|
|
127
|
-
import {
|
|
128
|
-
beginAuditCapture
|
|
129
|
-
} from "./chunk-7C7DET6S.js";
|
|
130
|
-
import {
|
|
131
|
-
AUDIT_REDACTED,
|
|
132
|
-
redactAuditText
|
|
133
|
-
} from "./chunk-K5NM7VAH.js";
|
|
134
|
-
import "./chunk-WNY4WMRF.js";
|
|
135
|
-
import "./chunk-OZFM4X3S.js";
|
|
136
147
|
import "./chunk-5NJLQ6T6.js";
|
|
137
|
-
import "./chunk-
|
|
138
|
-
import "./chunk-
|
|
148
|
+
import "./chunk-4VVCXVB7.js";
|
|
149
|
+
import "./chunk-R4VCO2CB.js";
|
|
139
150
|
import "./chunk-WYVGULTQ.js";
|
|
140
|
-
import "./chunk-
|
|
141
|
-
import "./chunk-
|
|
151
|
+
import "./chunk-ZLNHPUFA.js";
|
|
152
|
+
import "./chunk-CFSGYFOZ.js";
|
|
142
153
|
import "./chunk-3WD4HTR2.js";
|
|
143
154
|
import "./chunk-MKF46GNZ.js";
|
|
144
155
|
import "./chunk-GL6XM527.js";
|
|
156
|
+
import "./chunk-DEIUR2TH.js";
|
|
157
|
+
import "./chunk-4JOU54M5.js";
|
|
145
158
|
import "./chunk-CDHS2QDC.js";
|
|
146
|
-
import "./chunk-Y7FO65VT.js";
|
|
147
|
-
import "./chunk-FMOBD2OQ.js";
|
|
148
|
-
import "./chunk-HUZZZ3JL.js";
|
|
149
159
|
export {
|
|
150
160
|
AUDIT_REDACTED,
|
|
151
161
|
BoundAccountSelectionError,
|
|
@@ -156,11 +166,14 @@ export {
|
|
|
156
166
|
DEFAULT_ALLOWANCE_SCHEDULING,
|
|
157
167
|
DEFAULT_CONCURRENCY_QUEUE,
|
|
158
168
|
DEFAULT_FINGERPRINT,
|
|
169
|
+
DEFAULT_IMAGES_SERVER_CONFIG,
|
|
159
170
|
DEFAULT_OUTBOUND_PORT,
|
|
160
171
|
DEFAULT_USER_MESSAGE_QUEUE,
|
|
161
172
|
ENDPOINT_MODEL_KINDS,
|
|
173
|
+
IMAGE_SERVER_HARD_CEILINGS,
|
|
162
174
|
KeySpendTracker,
|
|
163
175
|
KeyedMutex,
|
|
176
|
+
LEGACY_OUTBOUND_PERMISSIONS,
|
|
164
177
|
OUTBOUND_API_SERVER_CONFIG_KEY,
|
|
165
178
|
OutboundApiServer,
|
|
166
179
|
OutboundConcurrencyGate,
|
|
@@ -183,6 +196,7 @@ export {
|
|
|
183
196
|
defaultServerConfig,
|
|
184
197
|
detectModelKind,
|
|
185
198
|
detectRequestRole,
|
|
199
|
+
effectiveOutboundPermissions,
|
|
186
200
|
endpointSupportsSubscription,
|
|
187
201
|
endpointToIngressFormat,
|
|
188
202
|
formatUrls,
|
|
@@ -210,6 +224,7 @@ export {
|
|
|
210
224
|
normalizeBilling,
|
|
211
225
|
normalizeFingerprint,
|
|
212
226
|
normalizeGatewayBindings,
|
|
227
|
+
normalizeImagesServerConfig,
|
|
213
228
|
normalizePrefixTargets,
|
|
214
229
|
normalizeProxyConfig,
|
|
215
230
|
normalizeProxySegment,
|
|
@@ -230,6 +245,8 @@ export {
|
|
|
230
245
|
startOfLocalWeek,
|
|
231
246
|
toVoucherInfo,
|
|
232
247
|
validateEndpointModelConfig,
|
|
248
|
+
validateImagesServerConfig,
|
|
249
|
+
validateOutboundPermissions,
|
|
233
250
|
verifyKey,
|
|
234
251
|
verifyPresentedKey,
|
|
235
252
|
voucherCodePrefix
|
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
import { SubscriptionProviderId } from '@omnicross/contracts/subscription-types';
|
|
2
|
-
import { a as AllowanceSchedulingConfig } from '../types-
|
|
2
|
+
import { a as AllowanceSchedulingConfig } from '../types-jjU24eYG.cjs';
|
|
3
3
|
import { AccountAllowanceStore } from './AccountAllowanceStore.cjs';
|
|
4
|
-
import '
|
|
5
|
-
import '@omnicross/contracts/
|
|
6
|
-
import '
|
|
7
|
-
import '@omnicross/contracts/health-logging-types';
|
|
8
|
-
import '@omnicross/contracts/voucher-types';
|
|
9
|
-
import '@omnicross/contracts/webhook-types';
|
|
10
|
-
import '../logger-4GvQNzhE.cjs';
|
|
11
|
-
import '../ports/provider-config-source.cjs';
|
|
12
|
-
import '@omnicross/contracts/llm-config';
|
|
13
|
-
import '../transformer/types.cjs';
|
|
14
|
-
import '@omnicross/contracts/completion-types';
|
|
15
|
-
import '../transformer/TransformerService.cjs';
|
|
16
|
-
import '../ProviderProxy-QdwNV6l1.cjs';
|
|
17
|
-
import '../provider-proxy/types.cjs';
|
|
4
|
+
import '../types-CbglB73l.cjs';
|
|
5
|
+
import '@omnicross/contracts/image-generation-types';
|
|
6
|
+
import '../types-DsHBBk3h.cjs';
|
|
18
7
|
import 'node:http';
|
|
8
|
+
import '@omnicross/contracts/completion-types';
|
|
19
9
|
import '@omnicross/contracts/usage-stats-types';
|
|
20
10
|
import '@omnicross/contracts/usage-types';
|
|
21
11
|
import '../completion/ApiKeyPoolService.cjs';
|
|
12
|
+
import '@omnicross/contracts/llm-config';
|
|
13
|
+
import '../logger-4GvQNzhE.cjs';
|
|
22
14
|
import './AuthSource.cjs';
|
|
23
15
|
import './BoundAccountSelectionError.cjs';
|
|
24
16
|
import './SubscriptionAuthSource.cjs';
|
|
25
17
|
import './SubscriptionAuthStrategy.cjs';
|
|
18
|
+
import '../ports/provider-config-source.cjs';
|
|
19
|
+
import '../transformer/types.cjs';
|
|
20
|
+
import '../transformer/TransformerService.cjs';
|
|
26
21
|
import '../ports/web-search-backend.cjs';
|
|
27
22
|
import '@omnicross/contracts/websearch-types';
|
|
23
|
+
import 'node:fs/promises';
|
|
24
|
+
import '@omnicross/contracts/account-tokens-types';
|
|
25
|
+
import '@omnicross/contracts/audit-types';
|
|
26
|
+
import '@omnicross/contracts/billing-types';
|
|
27
|
+
import '@omnicross/contracts/health-logging-types';
|
|
28
|
+
import '@omnicross/contracts/voucher-types';
|
|
29
|
+
import '@omnicross/contracts/webhook-types';
|
|
30
|
+
import '../ProviderProxy-CgIcCVwk.cjs';
|
|
28
31
|
import '../keyPolicy-zdWTu3CQ.cjs';
|
|
29
32
|
import '@omnicross/contracts/account-allowance-types';
|
|
30
33
|
|