@omnicross/core 0.1.3 → 0.1.5
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 +15 -15
- package/dist/auth/GeminiCodeAssistProjectResolver.cjs +6 -5
- package/dist/auth/GeminiCodeAssistProjectResolver.js +6 -5
- package/dist/{chunk-2DCNB7DF.cjs → chunk-3Q6Z6JTO.cjs} +154 -26
- package/dist/chunk-3QFXFCHG.js +33 -0
- package/dist/chunk-3Z5BQZFM.cjs +52 -0
- package/dist/{chunk-4VAVYUZS.cjs → chunk-4XMYPW46.cjs} +9 -9
- package/dist/chunk-4YINUUKQ.cjs +33 -0
- package/dist/{chunk-S4WBV25P.js → chunk-6QZGDLL4.js} +106 -23
- package/dist/{chunk-C72S6TTV.cjs → chunk-7FEBOPJO.cjs} +5 -4
- package/dist/chunk-APYG5QD7.cjs +50 -0
- package/dist/{chunk-5HTVET6E.js → chunk-BODMAL6G.js} +143 -15
- package/dist/{chunk-CWM2ZDU5.js → chunk-BPKCU575.js} +3 -10
- package/dist/{chunk-2FMI2B6V.cjs → chunk-CGKLE6IW.cjs} +350 -461
- package/dist/{chunk-BO4RFWBR.js → chunk-D3TDKWRP.js} +84 -3
- package/dist/{chunk-RSJ3TWJQ.cjs → chunk-DDMRUL76.cjs} +5 -5
- package/dist/chunk-FCR77GYM.cjs +33 -0
- package/dist/{chunk-4DECIFU7.js → chunk-FH2P4OCD.js} +178 -289
- package/dist/{chunk-N5QFKSDO.js → chunk-HRRYG2AX.js} +2 -1
- package/dist/{chunk-KUU2RNG6.cjs → chunk-HYN75H6G.cjs} +3 -0
- package/dist/{chunk-Z7LUNECE.js → chunk-IB3FDI4O.js} +5 -4
- package/dist/chunk-IFXJ2BG7.js +109 -0
- package/dist/{chunk-JO5NLTLY.js → chunk-IK3KE3AU.js} +3 -0
- package/dist/{chunk-C7PSERMH.js → chunk-IWQAX3CS.js} +1 -1
- package/dist/{chunk-YGXJGRFI.cjs → chunk-JWVTXXPX.cjs} +106 -23
- package/dist/{chunk-7YN22L2H.cjs → chunk-K52THW2C.cjs} +5 -5
- package/dist/chunk-K5NM7VAH.js +33 -0
- package/dist/{chunk-Y6OM7EV7.cjs → chunk-KFI44N2R.cjs} +2 -1
- package/dist/{chunk-Z7Y2NPHY.js → chunk-MFZ5437A.js} +1 -1
- package/dist/chunk-OE6TDIWW.js +22 -0
- package/dist/{chunk-MQNDWYPN.js → chunk-OQWKZCXP.js} +13 -6
- package/dist/chunk-OZFM4X3S.js +18 -0
- package/dist/chunk-PG7PS2NN.cjs +170 -0
- package/dist/{chunk-3QOSDDNI.cjs → chunk-SNYBEXLB.cjs} +6 -13
- package/dist/chunk-SYQF7OIR.js +52 -0
- package/dist/{chunk-CZHZGRU7.js → chunk-UHGVBFU3.js} +2 -0
- package/dist/chunk-UIBD2YY5.cjs +22 -0
- package/dist/chunk-UNWKG6EI.cjs +109 -0
- package/dist/{chunk-SVXC36MU.cjs → chunk-VACWOIRE.cjs} +2 -0
- package/dist/chunk-WLYIIEAF.js +50 -0
- package/dist/chunk-XSVNC2UD.cjs +18 -0
- package/dist/{chunk-FFALUUZZ.cjs → chunk-ZCIQ3L3R.cjs} +18 -11
- package/dist/completion/CompletionService.cjs +26 -19
- package/dist/completion/CompletionService.js +25 -18
- package/dist/completion.cjs +28 -21
- package/dist/completion.js +27 -20
- package/dist/index.cjs +35 -25
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +44 -34
- package/dist/keyPolicy-Cp0FntZl.d.cts +90 -0
- package/dist/keyPolicy-Cp0FntZl.d.ts +90 -0
- package/dist/outbound-api/auditCapture.cjs +9 -0
- package/dist/outbound-api/auditCapture.d.cts +54 -0
- package/dist/outbound-api/auditCapture.d.ts +54 -0
- package/dist/outbound-api/auditCapture.js +9 -0
- package/dist/outbound-api/auditRedact.cjs +8 -0
- package/dist/outbound-api/auditRedact.d.cts +30 -0
- package/dist/outbound-api/auditRedact.d.ts +30 -0
- package/dist/outbound-api/auditRedact.js +8 -0
- package/dist/outbound-api/billingCapture.cjs +8 -0
- package/dist/outbound-api/billingCapture.d.cts +61 -0
- package/dist/outbound-api/billingCapture.d.ts +61 -0
- package/dist/outbound-api/billingCapture.js +8 -0
- package/dist/outbound-api/quotaWarn.cjs +12 -0
- package/dist/outbound-api/quotaWarn.d.cts +43 -0
- package/dist/outbound-api/quotaWarn.d.ts +43 -0
- package/dist/outbound-api/quotaWarn.js +12 -0
- package/dist/outbound-api/routeResolver.cjs +2 -2
- package/dist/outbound-api/routeResolver.d.cts +3 -2
- package/dist/outbound-api/routeResolver.d.ts +3 -2
- package/dist/outbound-api/routeResolver.js +1 -1
- package/dist/outbound-api/types.d.cts +2 -1
- package/dist/outbound-api/types.d.ts +2 -1
- package/dist/outbound-api.cjs +33 -23
- package/dist/outbound-api.d.cts +9 -140
- package/dist/outbound-api.d.ts +9 -140
- package/dist/outbound-api.js +32 -22
- package/dist/pipeline/AuthSource.d.cts +6 -0
- package/dist/pipeline/AuthSource.d.ts +6 -0
- package/dist/pipeline/SubscriptionAuthSource.cjs +2 -2
- package/dist/pipeline/SubscriptionAuthSource.js +1 -1
- package/dist/pipeline/SubscriptionAuthStrategy.d.cts +6 -0
- package/dist/pipeline/SubscriptionAuthStrategy.d.ts +6 -0
- package/dist/pipeline/auditUsageStash.cjs +10 -0
- package/dist/pipeline/auditUsageStash.d.cts +37 -0
- package/dist/pipeline/auditUsageStash.d.ts +37 -0
- package/dist/pipeline/auditUsageStash.js +10 -0
- package/dist/pipeline/executeProviderCall.cjs +2 -2
- package/dist/pipeline/executeProviderCall.js +1 -1
- package/dist/pipeline/upstreamFetch.cjs +15 -0
- package/dist/pipeline/upstreamFetch.d.cts +89 -0
- package/dist/pipeline/upstreamFetch.d.ts +89 -0
- package/dist/pipeline/upstreamFetch.js +15 -0
- package/dist/pipeline/upstreamTrace.cjs +14 -0
- package/dist/pipeline/upstreamTrace.d.cts +85 -0
- package/dist/pipeline/upstreamTrace.d.ts +85 -0
- package/dist/pipeline/upstreamTrace.js +14 -0
- package/dist/pipeline/webhookEmit.cjs +10 -0
- package/dist/pipeline/webhookEmit.d.cts +36 -0
- package/dist/pipeline/webhookEmit.d.ts +36 -0
- package/dist/pipeline/webhookEmit.js +10 -0
- package/dist/ports.d.cts +2 -1
- package/dist/ports.d.ts +2 -1
- package/dist/provider-proxy/ProviderProxy.cjs +26 -19
- package/dist/provider-proxy/ProviderProxy.js +25 -18
- package/dist/provider-proxy/ingress/providerProxyShared.cjs +28 -19
- package/dist/provider-proxy/ingress/providerProxyShared.d.cts +17 -1
- package/dist/provider-proxy/ingress/providerProxyShared.d.ts +17 -1
- package/dist/provider-proxy/ingress/providerProxyShared.js +27 -18
- package/dist/provider-proxy/types.d.cts +7 -0
- package/dist/provider-proxy/types.d.ts +7 -0
- package/dist/provider-proxy.cjs +26 -19
- package/dist/provider-proxy.js +25 -18
- package/dist/{routeResolver-B1NglTfe.d.ts → routeResolver-C4T7yClx.d.ts} +1 -1
- package/dist/{routeResolver-CbG5uBgm.d.cts → routeResolver-CB3tvJKy.d.cts} +1 -1
- package/dist/transformer/transformers/AnthropicTransformer.cjs +2 -2
- package/dist/transformer/transformers/AnthropicTransformer.js +1 -1
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +3 -3
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.js +2 -2
- package/dist/transformer/transformers/GeminiTransformer.cjs +3 -3
- package/dist/transformer/transformers/GeminiTransformer.js +2 -2
- package/dist/transformer/transformers/OpenAIResponseTransformer.cjs +2 -2
- package/dist/transformer/transformers/OpenAIResponseTransformer.js +1 -1
- package/dist/transformer/transformers/OpenCodeGoTransformer.cjs +2 -2
- package/dist/transformer/transformers/OpenCodeGoTransformer.js +1 -1
- package/dist/transformer/transformers.cjs +8 -8
- package/dist/transformer/transformers.js +7 -7
- package/dist/transformer.cjs +8 -8
- package/dist/transformer.js +7 -7
- package/dist/{types-aBFFXoBz.d.cts → types-B8Arpxn0.d.cts} +14 -90
- package/dist/{types-6OUY_xfA.d.ts → types-lgPYQuZS.d.ts} +14 -90
- package/dist/usage/usage-recorder.cjs +3 -2
- package/dist/usage/usage-recorder.js +2 -1
- package/dist/usage.cjs +3 -2
- package/dist/usage.js +2 -1
- package/package.json +64 -64
- package/dist/chunk-S6JGLF3G.cjs +0 -89
- package/dist/{chunk-FTQ7IQUC.js → chunk-C6OV7GCC.js} +8 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var _chunkK52THW2Ccjs = require('../../chunk-K52THW2C.cjs');
|
|
4
|
+
require('../../chunk-JWVTXXPX.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
exports.GeminiTransformer =
|
|
7
|
+
exports.GeminiTransformer = _chunkK52THW2Ccjs.GeminiTransformer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk3Q6Z6JTOcjs = require('../../chunk-3Q6Z6JTO.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
exports.OpenAIResponseTransformer =
|
|
6
|
+
exports.OpenAIResponseTransformer = _chunk3Q6Z6JTOcjs.OpenAIResponseTransformer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk7FEBOPJOcjs = require('../../chunk-7FEBOPJO.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
exports.OpenCodeGoTransformer =
|
|
6
|
+
exports.OpenCodeGoTransformer = _chunk7FEBOPJOcjs.OpenCodeGoTransformer;
|
|
@@ -4,26 +4,26 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkZCIQ3L3Rcjs = require('../chunk-ZCIQ3L3R.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk7FEBOPJOcjs = require('../chunk-7FEBOPJO.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkDWKQZ2SKcjs = require('../chunk-DWKQZ2SK.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunk4XMYPW46cjs = require('../chunk-4XMYPW46.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkK52THW2Ccjs = require('../chunk-K52THW2C.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _chunk3Q6Z6JTOcjs = require('../chunk-3Q6Z6JTO.cjs');
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
var
|
|
26
|
-
require('../chunk-
|
|
25
|
+
var _chunkDDMRUL76cjs = require('../chunk-DDMRUL76.cjs');
|
|
26
|
+
require('../chunk-JWVTXXPX.cjs');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
@@ -36,4 +36,4 @@ require('../chunk-YGXJGRFI.cjs');
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
exports.AnthropicTransformer =
|
|
39
|
+
exports.AnthropicTransformer = _chunk4XMYPW46cjs.AnthropicTransformer; exports.BUILTIN_TRANSFORMER_NAMES = _chunkZCIQ3L3Rcjs.BUILTIN_TRANSFORMER_NAMES; exports.BuiltinTransformers = _chunkZCIQ3L3Rcjs.BuiltinTransformers; exports.DeepseekTransformer = _chunkZCIQ3L3Rcjs.DeepseekTransformer; exports.GeminiCodeAssistTransformer = _chunkDDMRUL76cjs.GeminiCodeAssistTransformer; exports.GeminiTransformer = _chunkK52THW2Ccjs.GeminiTransformer; exports.OpenAIResponseTransformer = _chunk3Q6Z6JTOcjs.OpenAIResponseTransformer; exports.OpenCodeGoTransformer = _chunk7FEBOPJOcjs.OpenCodeGoTransformer; exports.ReasoningTransformer = _chunkDWKQZ2SKcjs.ReasoningTransformer; exports.getBuiltinTransformers = _chunkZCIQ3L3Rcjs.getBuiltinTransformers; exports.registerBuiltinTransformers = _chunkZCIQ3L3Rcjs.registerBuiltinTransformers;
|
|
@@ -4,26 +4,26 @@ import {
|
|
|
4
4
|
DeepseekTransformer,
|
|
5
5
|
getBuiltinTransformers,
|
|
6
6
|
registerBuiltinTransformers
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-OQWKZCXP.js";
|
|
8
8
|
import {
|
|
9
9
|
OpenCodeGoTransformer
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-IB3FDI4O.js";
|
|
11
11
|
import {
|
|
12
12
|
ReasoningTransformer
|
|
13
13
|
} from "../chunk-ZJZAOKI7.js";
|
|
14
14
|
import {
|
|
15
15
|
AnthropicTransformer
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-C6OV7GCC.js";
|
|
17
17
|
import {
|
|
18
18
|
GeminiTransformer
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-IWQAX3CS.js";
|
|
20
20
|
import {
|
|
21
21
|
OpenAIResponseTransformer
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-BODMAL6G.js";
|
|
23
23
|
import {
|
|
24
24
|
GeminiCodeAssistTransformer
|
|
25
|
-
} from "../chunk-
|
|
26
|
-
import "../chunk-
|
|
25
|
+
} from "../chunk-MFZ5437A.js";
|
|
26
|
+
import "../chunk-6QZGDLL4.js";
|
|
27
27
|
export {
|
|
28
28
|
AnthropicTransformer,
|
|
29
29
|
BUILTIN_TRANSFORMER_NAMES,
|
package/dist/transformer.cjs
CHANGED
|
@@ -7,17 +7,17 @@ var _chunk46ZIFWYGcjs = require('./chunk-46ZIFWYG.cjs');
|
|
|
7
7
|
var _chunk3OPYJG76cjs = require('./chunk-3OPYJG76.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
require('./chunk-
|
|
10
|
+
var _chunkZCIQ3L3Rcjs = require('./chunk-ZCIQ3L3R.cjs');
|
|
11
|
+
require('./chunk-7FEBOPJO.cjs');
|
|
12
12
|
require('./chunk-DWKQZ2SK.cjs');
|
|
13
|
-
require('./chunk-
|
|
14
|
-
require('./chunk-
|
|
15
|
-
require('./chunk-
|
|
13
|
+
require('./chunk-4XMYPW46.cjs');
|
|
14
|
+
require('./chunk-K52THW2C.cjs');
|
|
15
|
+
require('./chunk-3Q6Z6JTO.cjs');
|
|
16
16
|
require('./chunk-GBHYAGX3.cjs');
|
|
17
|
-
require('./chunk-
|
|
18
|
-
require('./chunk-
|
|
17
|
+
require('./chunk-DDMRUL76.cjs');
|
|
18
|
+
require('./chunk-JWVTXXPX.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
exports.TransformerChainExecutor = _chunk46ZIFWYGcjs.TransformerChainExecutor; exports.TransformerService = _chunk3OPYJG76cjs.TransformerService; exports.registerBuiltinTransformers =
|
|
23
|
+
exports.TransformerChainExecutor = _chunk46ZIFWYGcjs.TransformerChainExecutor; exports.TransformerService = _chunk3OPYJG76cjs.TransformerService; exports.registerBuiltinTransformers = _chunkZCIQ3L3Rcjs.registerBuiltinTransformers;
|
package/dist/transformer.js
CHANGED
|
@@ -7,15 +7,15 @@ import {
|
|
|
7
7
|
} from "./chunk-DK4A7DLE.js";
|
|
8
8
|
import {
|
|
9
9
|
registerBuiltinTransformers
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-OQWKZCXP.js";
|
|
11
|
+
import "./chunk-IB3FDI4O.js";
|
|
12
12
|
import "./chunk-ZJZAOKI7.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-C6OV7GCC.js";
|
|
14
|
+
import "./chunk-IWQAX3CS.js";
|
|
15
|
+
import "./chunk-BODMAL6G.js";
|
|
16
16
|
import "./chunk-MZNPGW5Q.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-MFZ5437A.js";
|
|
18
|
+
import "./chunk-6QZGDLL4.js";
|
|
19
19
|
export {
|
|
20
20
|
TransformerChainExecutor,
|
|
21
21
|
TransformerService,
|
|
@@ -8,95 +8,7 @@ import { L as Logger } from './logger-4GvQNzhE.cjs';
|
|
|
8
8
|
import { ProviderConfigSource } from './ports/provider-config-source.cjs';
|
|
9
9
|
import { P as ProviderProxy } from './ProviderProxy-CnMQYN59.cjs';
|
|
10
10
|
import { ProviderProxyDeps } from './provider-proxy/types.cjs';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* keyPolicy — PURE decision helpers for the outbound key-policy envelope
|
|
14
|
-
* (`outbound-key-policy`, design D2/D4). Expiry/activation resolution +
|
|
15
|
-
* cost-quota decision. No I/O, no clock ownership (the caller passes `now`), so
|
|
16
|
-
* these are trivially unit-testable and reused by both the auth path
|
|
17
|
-
* (`verifyKey`) and the wire path (`outboundApiRouter`).
|
|
18
|
-
*
|
|
19
|
-
* The #6 (`restrictedModels`) and #9 (voucher) children EXTEND the key-policy
|
|
20
|
-
* schema; they must not change the shapes frozen here.
|
|
21
|
-
*
|
|
22
|
-
* @module outbound-api/keyPolicy
|
|
23
|
-
*/
|
|
24
|
-
/** The expiry/activation subset of a key row `computeKeyExpiry` reads. */
|
|
25
|
-
interface KeyExpiryInput {
|
|
26
|
-
/** Fixed-mode absolute expiry (epoch ms). */
|
|
27
|
-
expiresAt?: number | null;
|
|
28
|
-
/** Expiry mode; absent ⇒ `'fixed'`. */
|
|
29
|
-
activationMode?: 'fixed' | 'activation';
|
|
30
|
-
/** Activation-mode lifetime in days (absent/null ⇒ never expires). */
|
|
31
|
-
activationDays?: number | null;
|
|
32
|
-
/** First-use activation stamp (epoch ms); null ⇒ not yet activated. */
|
|
33
|
-
activatedAt?: number | null;
|
|
34
|
-
}
|
|
35
|
-
/** Result of {@link computeKeyExpiry}. */
|
|
36
|
-
interface KeyExpiryResult {
|
|
37
|
-
expired: boolean;
|
|
38
|
-
/** The resolved absolute expiry (epoch ms), when the key has one. */
|
|
39
|
-
effectiveExpiresAt?: number;
|
|
40
|
-
/**
|
|
41
|
-
* True when this is an activation-mode key that has NOT been activated yet, so
|
|
42
|
-
* the caller SHOULD stamp the activation (best-effort) on a successful verify.
|
|
43
|
-
*/
|
|
44
|
-
needsActivation?: boolean;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Resolve whether a key is past its effective expiry (design D2).
|
|
48
|
-
* - `fixed`: expired when `expiresAt != null && now >= expiresAt`.
|
|
49
|
-
* - `activation`: while `activatedAt == null` the key is NOT expired (it
|
|
50
|
-
* activates on THIS use → `needsActivation`); once activated, expired when
|
|
51
|
-
* `now >= activatedAt + activationDays*DAY`. A null `activationDays` never
|
|
52
|
-
* expires.
|
|
53
|
-
* A key with no expiry configured never expires.
|
|
54
|
-
*/
|
|
55
|
-
declare function computeKeyExpiry(row: KeyExpiryInput, now: number): KeyExpiryResult;
|
|
56
|
-
/** Per-key USD cost limits carried on the verified key (absent scope ⇒ no cap). */
|
|
57
|
-
interface KeyCostLimits {
|
|
58
|
-
dailyUsd?: number;
|
|
59
|
-
totalUsd?: number;
|
|
60
|
-
weeklyUsd?: number;
|
|
61
|
-
}
|
|
62
|
-
/** In-memory per-key accumulated spend snapshot (see `keySpendTracker`). */
|
|
63
|
-
interface KeySpend {
|
|
64
|
-
dailyUsd: number;
|
|
65
|
-
/** Local-midnight boundary the `dailyUsd` window opened at (epoch ms). */
|
|
66
|
-
dailyWindowStart: number;
|
|
67
|
-
weeklyUsd: number;
|
|
68
|
-
/** Local week-start boundary the `weeklyUsd` window opened at (epoch ms). */
|
|
69
|
-
weeklyWindowStart: number;
|
|
70
|
-
totalUsd: number;
|
|
71
|
-
}
|
|
72
|
-
/** Decision returned by {@link checkKeyQuota}. */
|
|
73
|
-
type QuotaDecision = {
|
|
74
|
-
allowed: true;
|
|
75
|
-
} | {
|
|
76
|
-
allowed: false;
|
|
77
|
-
scope: 'daily' | 'weekly' | 'total';
|
|
78
|
-
limitUsd: number;
|
|
79
|
-
spentUsd: number;
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Decide whether the key's accumulated spend already meets/exceeds any
|
|
83
|
-
* configured cost limit (design D4). `allowed:false` when a scope's PRIOR spend
|
|
84
|
-
* is `>= limit` (the triggering request's own cost is unknown pre-flight →
|
|
85
|
-
* bounded one-request overage, CRS-equivalent). An unconfigured scope is never
|
|
86
|
-
* gated; a `limits`-less key always passes.
|
|
87
|
-
*/
|
|
88
|
-
declare function checkKeyQuota(limits: KeyCostLimits | undefined, spend: KeySpend): QuotaDecision;
|
|
89
|
-
/**
|
|
90
|
-
* Per-key model restriction carried on the verified key (outbound-key-policy #6).
|
|
91
|
-
* Present ONLY when the key has `enableModelRestriction === true` — so the wire
|
|
92
|
-
* layer's presence check (`if (key.modelRestriction) …`) is the zero-regression
|
|
93
|
-
* gate.
|
|
94
|
-
*/
|
|
95
|
-
interface ModelRestriction {
|
|
96
|
-
mode: 'blacklist' | 'allowlist';
|
|
97
|
-
/** Bare modelIds the mode acts on. Empty allowlist denies every model. */
|
|
98
|
-
models: string[];
|
|
99
|
-
}
|
|
11
|
+
import { c as KeySpend } from './keyPolicy-Cp0FntZl.cjs';
|
|
100
12
|
|
|
101
13
|
/**
|
|
102
14
|
* keySpendTracker — a cheap in-memory per-key accumulated-spend cache
|
|
@@ -398,6 +310,18 @@ interface EndpointRoutingConfig {
|
|
|
398
310
|
backgroundModel?: ModelRef;
|
|
399
311
|
/** Gates subscription-vs-BYO provider selection. Default FALSE. */
|
|
400
312
|
useSubscription: boolean;
|
|
313
|
+
/**
|
|
314
|
+
* OPTIONAL subscription-mode binding to ONE specific subscription account id
|
|
315
|
+
* (provider/subscription duality). Absent/blank ⇒ the provider's account pool
|
|
316
|
+
* auto-schedules (priority/LRU/health). When set and the account is
|
|
317
|
+
* schedulable it is used directly; otherwise the pool is the fallback.
|
|
318
|
+
*/
|
|
319
|
+
boundAccountId?: string;
|
|
320
|
+
/**
|
|
321
|
+
* OPTIONAL provider-mode binding to ONE specific BYO key id (from the
|
|
322
|
+
* provider's key pool). Absent/blank ⇒ the provider's default key / key pool.
|
|
323
|
+
*/
|
|
324
|
+
boundKeyId?: string;
|
|
401
325
|
/**
|
|
402
326
|
* OPTIONAL "background model id" override list (role-based `gemini` only).
|
|
403
327
|
* When set, an incoming requested model id appearing in this list is
|
|
@@ -827,4 +751,4 @@ interface OutboundApiDeps {
|
|
|
827
751
|
readonly logger?: Logger;
|
|
828
752
|
}
|
|
829
753
|
|
|
830
|
-
export { type AccountProbeConfig as A,
|
|
754
|
+
export { type AccountProbeConfig as A, toVoucherInfo as B, type ChatDispatchMode as C, voucherCodePrefix as D, ENDPOINT_MODEL_KINDS as E, type FingerprintConfig as F, type ModelRef as G, type AccountHealthConfig as H, type OutboundKeyModelRestrictionMode as I, type KeySpendReader as K, type MessagesModelKind as M, type OutboundKeyDb as O, type RequestRole as R, type UserMessageQueueConfig as U, type VoucherCreateInput as V, type ConcurrencyQueueConfig as a, type EndpointRoutingConfig as b, type KeySpendSeeder as c, KeySpendTracker as d, type KindMappedEndpoint as e, type ModelKind as f, type ModelPrefixTargets as g, type OutboundApiDeps as h, type OutboundApiKeyCreated as i, type OutboundApiKeyInfo as j, type OutboundApiServerConfig as k, type OutboundApiServerStatus as l, type OutboundEndpoint as m, type OutboundFormatUrls as n, type OutboundKeyActivationMode as o, type OutboundKeyDbRow as p, type OutboundKeyPolicy as q, type OutboundProxyConfig as r, type ResponsesModelKind as s, type VoucherDb as t, computeVoucherGrant as u, generateVoucherCode as v, hashVoucherCode as w, newVoucherId as x, startOfLocalDay as y, startOfLocalWeek as z };
|
|
@@ -8,95 +8,7 @@ import { L as Logger } from './logger-4GvQNzhE.js';
|
|
|
8
8
|
import { ProviderConfigSource } from './ports/provider-config-source.js';
|
|
9
9
|
import { P as ProviderProxy } from './ProviderProxy-C-xqrkKi.js';
|
|
10
10
|
import { ProviderProxyDeps } from './provider-proxy/types.js';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* keyPolicy — PURE decision helpers for the outbound key-policy envelope
|
|
14
|
-
* (`outbound-key-policy`, design D2/D4). Expiry/activation resolution +
|
|
15
|
-
* cost-quota decision. No I/O, no clock ownership (the caller passes `now`), so
|
|
16
|
-
* these are trivially unit-testable and reused by both the auth path
|
|
17
|
-
* (`verifyKey`) and the wire path (`outboundApiRouter`).
|
|
18
|
-
*
|
|
19
|
-
* The #6 (`restrictedModels`) and #9 (voucher) children EXTEND the key-policy
|
|
20
|
-
* schema; they must not change the shapes frozen here.
|
|
21
|
-
*
|
|
22
|
-
* @module outbound-api/keyPolicy
|
|
23
|
-
*/
|
|
24
|
-
/** The expiry/activation subset of a key row `computeKeyExpiry` reads. */
|
|
25
|
-
interface KeyExpiryInput {
|
|
26
|
-
/** Fixed-mode absolute expiry (epoch ms). */
|
|
27
|
-
expiresAt?: number | null;
|
|
28
|
-
/** Expiry mode; absent ⇒ `'fixed'`. */
|
|
29
|
-
activationMode?: 'fixed' | 'activation';
|
|
30
|
-
/** Activation-mode lifetime in days (absent/null ⇒ never expires). */
|
|
31
|
-
activationDays?: number | null;
|
|
32
|
-
/** First-use activation stamp (epoch ms); null ⇒ not yet activated. */
|
|
33
|
-
activatedAt?: number | null;
|
|
34
|
-
}
|
|
35
|
-
/** Result of {@link computeKeyExpiry}. */
|
|
36
|
-
interface KeyExpiryResult {
|
|
37
|
-
expired: boolean;
|
|
38
|
-
/** The resolved absolute expiry (epoch ms), when the key has one. */
|
|
39
|
-
effectiveExpiresAt?: number;
|
|
40
|
-
/**
|
|
41
|
-
* True when this is an activation-mode key that has NOT been activated yet, so
|
|
42
|
-
* the caller SHOULD stamp the activation (best-effort) on a successful verify.
|
|
43
|
-
*/
|
|
44
|
-
needsActivation?: boolean;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Resolve whether a key is past its effective expiry (design D2).
|
|
48
|
-
* - `fixed`: expired when `expiresAt != null && now >= expiresAt`.
|
|
49
|
-
* - `activation`: while `activatedAt == null` the key is NOT expired (it
|
|
50
|
-
* activates on THIS use → `needsActivation`); once activated, expired when
|
|
51
|
-
* `now >= activatedAt + activationDays*DAY`. A null `activationDays` never
|
|
52
|
-
* expires.
|
|
53
|
-
* A key with no expiry configured never expires.
|
|
54
|
-
*/
|
|
55
|
-
declare function computeKeyExpiry(row: KeyExpiryInput, now: number): KeyExpiryResult;
|
|
56
|
-
/** Per-key USD cost limits carried on the verified key (absent scope ⇒ no cap). */
|
|
57
|
-
interface KeyCostLimits {
|
|
58
|
-
dailyUsd?: number;
|
|
59
|
-
totalUsd?: number;
|
|
60
|
-
weeklyUsd?: number;
|
|
61
|
-
}
|
|
62
|
-
/** In-memory per-key accumulated spend snapshot (see `keySpendTracker`). */
|
|
63
|
-
interface KeySpend {
|
|
64
|
-
dailyUsd: number;
|
|
65
|
-
/** Local-midnight boundary the `dailyUsd` window opened at (epoch ms). */
|
|
66
|
-
dailyWindowStart: number;
|
|
67
|
-
weeklyUsd: number;
|
|
68
|
-
/** Local week-start boundary the `weeklyUsd` window opened at (epoch ms). */
|
|
69
|
-
weeklyWindowStart: number;
|
|
70
|
-
totalUsd: number;
|
|
71
|
-
}
|
|
72
|
-
/** Decision returned by {@link checkKeyQuota}. */
|
|
73
|
-
type QuotaDecision = {
|
|
74
|
-
allowed: true;
|
|
75
|
-
} | {
|
|
76
|
-
allowed: false;
|
|
77
|
-
scope: 'daily' | 'weekly' | 'total';
|
|
78
|
-
limitUsd: number;
|
|
79
|
-
spentUsd: number;
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Decide whether the key's accumulated spend already meets/exceeds any
|
|
83
|
-
* configured cost limit (design D4). `allowed:false` when a scope's PRIOR spend
|
|
84
|
-
* is `>= limit` (the triggering request's own cost is unknown pre-flight →
|
|
85
|
-
* bounded one-request overage, CRS-equivalent). An unconfigured scope is never
|
|
86
|
-
* gated; a `limits`-less key always passes.
|
|
87
|
-
*/
|
|
88
|
-
declare function checkKeyQuota(limits: KeyCostLimits | undefined, spend: KeySpend): QuotaDecision;
|
|
89
|
-
/**
|
|
90
|
-
* Per-key model restriction carried on the verified key (outbound-key-policy #6).
|
|
91
|
-
* Present ONLY when the key has `enableModelRestriction === true` — so the wire
|
|
92
|
-
* layer's presence check (`if (key.modelRestriction) …`) is the zero-regression
|
|
93
|
-
* gate.
|
|
94
|
-
*/
|
|
95
|
-
interface ModelRestriction {
|
|
96
|
-
mode: 'blacklist' | 'allowlist';
|
|
97
|
-
/** Bare modelIds the mode acts on. Empty allowlist denies every model. */
|
|
98
|
-
models: string[];
|
|
99
|
-
}
|
|
11
|
+
import { c as KeySpend } from './keyPolicy-Cp0FntZl.js';
|
|
100
12
|
|
|
101
13
|
/**
|
|
102
14
|
* keySpendTracker — a cheap in-memory per-key accumulated-spend cache
|
|
@@ -398,6 +310,18 @@ interface EndpointRoutingConfig {
|
|
|
398
310
|
backgroundModel?: ModelRef;
|
|
399
311
|
/** Gates subscription-vs-BYO provider selection. Default FALSE. */
|
|
400
312
|
useSubscription: boolean;
|
|
313
|
+
/**
|
|
314
|
+
* OPTIONAL subscription-mode binding to ONE specific subscription account id
|
|
315
|
+
* (provider/subscription duality). Absent/blank ⇒ the provider's account pool
|
|
316
|
+
* auto-schedules (priority/LRU/health). When set and the account is
|
|
317
|
+
* schedulable it is used directly; otherwise the pool is the fallback.
|
|
318
|
+
*/
|
|
319
|
+
boundAccountId?: string;
|
|
320
|
+
/**
|
|
321
|
+
* OPTIONAL provider-mode binding to ONE specific BYO key id (from the
|
|
322
|
+
* provider's key pool). Absent/blank ⇒ the provider's default key / key pool.
|
|
323
|
+
*/
|
|
324
|
+
boundKeyId?: string;
|
|
401
325
|
/**
|
|
402
326
|
* OPTIONAL "background model id" override list (role-based `gemini` only).
|
|
403
327
|
* When set, an incoming requested model id appearing in this list is
|
|
@@ -827,4 +751,4 @@ interface OutboundApiDeps {
|
|
|
827
751
|
readonly logger?: Logger;
|
|
828
752
|
}
|
|
829
753
|
|
|
830
|
-
export { type AccountProbeConfig as A,
|
|
754
|
+
export { type AccountProbeConfig as A, toVoucherInfo as B, type ChatDispatchMode as C, voucherCodePrefix as D, ENDPOINT_MODEL_KINDS as E, type FingerprintConfig as F, type ModelRef as G, type AccountHealthConfig as H, type OutboundKeyModelRestrictionMode as I, type KeySpendReader as K, type MessagesModelKind as M, type OutboundKeyDb as O, type RequestRole as R, type UserMessageQueueConfig as U, type VoucherCreateInput as V, type ConcurrencyQueueConfig as a, type EndpointRoutingConfig as b, type KeySpendSeeder as c, KeySpendTracker as d, type KindMappedEndpoint as e, type ModelKind as f, type ModelPrefixTargets as g, type OutboundApiDeps as h, type OutboundApiKeyCreated as i, type OutboundApiKeyInfo as j, type OutboundApiServerConfig as k, type OutboundApiServerStatus as l, type OutboundEndpoint as m, type OutboundFormatUrls as n, type OutboundKeyActivationMode as o, type OutboundKeyDbRow as p, type OutboundKeyPolicy as q, type OutboundProxyConfig as r, type ResponsesModelKind as s, type VoucherDb as t, computeVoucherGrant as u, generateVoucherCode as v, hashVoucherCode as w, newVoucherId as x, startOfLocalDay as y, startOfLocalWeek as z };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkSNYBEXLBcjs = require('../chunk-SNYBEXLB.cjs');
|
|
4
|
+
require('../chunk-XSVNC2UD.cjs');
|
|
4
5
|
|
|
5
6
|
|
|
6
|
-
exports.UsageRecorder =
|
|
7
|
+
exports.UsageRecorder = _chunkSNYBEXLBcjs.UsageRecorder;
|
package/dist/usage.cjs
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
var _chunkYMFAJFQTcjs = require('./chunk-YMFAJFQT.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkSNYBEXLBcjs = require('./chunk-SNYBEXLB.cjs');
|
|
8
|
+
require('./chunk-XSVNC2UD.cjs');
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
exports.PricingEngine = _chunkYMFAJFQTcjs.PricingEngine; exports.UsageRecorder =
|
|
12
|
+
exports.PricingEngine = _chunkYMFAJFQTcjs.PricingEngine; exports.UsageRecorder = _chunkSNYBEXLBcjs.UsageRecorder;
|
package/dist/usage.js
CHANGED
package/package.json
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@omnicross/core",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Omnicross LLM serving core
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"author": "Sayo (https://github.com/Dumoedss)",
|
|
7
|
-
"homepage": "https://github.com/Dumoedss/omnicross#readme",
|
|
8
|
-
"keywords": [
|
|
9
|
-
"omnicross",
|
|
10
|
-
"llm",
|
|
11
|
-
"openai",
|
|
12
|
-
"anthropic",
|
|
13
|
-
"gemini",
|
|
14
|
-
"proxy",
|
|
15
|
-
"router",
|
|
16
|
-
"completion",
|
|
17
|
-
"transformer"
|
|
18
|
-
],
|
|
19
|
-
"repository": {
|
|
20
|
-
"type": "git",
|
|
21
|
-
"url": "git+https://github.com/Dumoedss/omnicross.git",
|
|
22
|
-
"directory": "packages/core"
|
|
23
|
-
},
|
|
24
|
-
"publishConfig": {
|
|
25
|
-
"access": "public"
|
|
26
|
-
},
|
|
27
|
-
"engines": {
|
|
28
|
-
"node": ">=20"
|
|
29
|
-
},
|
|
30
|
-
"type": "module",
|
|
31
|
-
"main": "dist/index.cjs",
|
|
32
|
-
"module": "dist/index.js",
|
|
33
|
-
"types": "dist/index.d.ts",
|
|
34
|
-
"exports": {
|
|
35
|
-
".": {
|
|
36
|
-
"types": "./dist/index.d.ts",
|
|
37
|
-
"import": "./dist/index.js",
|
|
38
|
-
"require": "./dist/index.cjs"
|
|
39
|
-
},
|
|
40
|
-
"./*": {
|
|
41
|
-
"types": "./dist/*.d.ts",
|
|
42
|
-
"import": "./dist/*.js",
|
|
43
|
-
"require": "./dist/*.cjs"
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
"files": [
|
|
47
|
-
"dist",
|
|
48
|
-
"LICENSE",
|
|
49
|
-
"NOTICE",
|
|
50
|
-
"README.md"
|
|
51
|
-
],
|
|
52
|
-
"scripts": {
|
|
53
|
-
"build": "tsup",
|
|
54
|
-
"typecheck": "tsc -p tsconfig.typecheck.json --noEmit"
|
|
55
|
-
},
|
|
56
|
-
"dependencies": {
|
|
57
|
-
"@mozilla/readability": "^0.6.0",
|
|
58
|
-
"@omnicross/contracts": "^0.1.0",
|
|
59
|
-
"jsdom": "^24.1.3",
|
|
60
|
-
"socks": "^2.8.3",
|
|
61
|
-
"turndown": "^7.2.2",
|
|
62
|
-
"undici": "^6.21.1"
|
|
63
|
-
}
|
|
64
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@omnicross/core",
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "Omnicross LLM serving core 鈥?provider dispatch, completion pipeline, transformers, and the provider proxy.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Sayo (https://github.com/Dumoedss)",
|
|
7
|
+
"homepage": "https://github.com/Dumoedss/omnicross#readme",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"omnicross",
|
|
10
|
+
"llm",
|
|
11
|
+
"openai",
|
|
12
|
+
"anthropic",
|
|
13
|
+
"gemini",
|
|
14
|
+
"proxy",
|
|
15
|
+
"router",
|
|
16
|
+
"completion",
|
|
17
|
+
"transformer"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/Dumoedss/omnicross.git",
|
|
22
|
+
"directory": "packages/core"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20"
|
|
29
|
+
},
|
|
30
|
+
"type": "module",
|
|
31
|
+
"main": "dist/index.cjs",
|
|
32
|
+
"module": "dist/index.js",
|
|
33
|
+
"types": "dist/index.d.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"import": "./dist/index.js",
|
|
38
|
+
"require": "./dist/index.cjs"
|
|
39
|
+
},
|
|
40
|
+
"./*": {
|
|
41
|
+
"types": "./dist/*.d.ts",
|
|
42
|
+
"import": "./dist/*.js",
|
|
43
|
+
"require": "./dist/*.cjs"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist",
|
|
48
|
+
"LICENSE",
|
|
49
|
+
"NOTICE",
|
|
50
|
+
"README.md"
|
|
51
|
+
],
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsup",
|
|
54
|
+
"typecheck": "tsc -p tsconfig.typecheck.json --noEmit"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@mozilla/readability": "^0.6.0",
|
|
58
|
+
"@omnicross/contracts": "^0.1.0",
|
|
59
|
+
"jsdom": "^24.1.3",
|
|
60
|
+
"socks": "^2.8.3",
|
|
61
|
+
"turndown": "^7.2.2",
|
|
62
|
+
"undici": "^6.21.1"
|
|
63
|
+
}
|
|
64
|
+
}
|