@omnicross/core 0.1.2 → 0.1.3
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/auth/GeminiCodeAssistProjectResolver.cjs +6 -1
- package/dist/auth/GeminiCodeAssistProjectResolver.js +6 -1
- package/dist/{chunk-SN3YWBX7.cjs → chunk-2FMI2B6V.cjs} +2329 -533
- package/dist/{chunk-XBSYYZIY.cjs → chunk-3QOSDDNI.cjs} +39 -3
- package/dist/{chunk-2FEVTJWG.js → chunk-4DECIFU7.js} +2162 -366
- package/dist/chunk-4IH4EL7M.cjs +9 -0
- package/dist/chunk-5ENKBSWO.js +311 -0
- package/dist/chunk-6RPZADX3.cjs +92 -0
- package/dist/chunk-AEOZIDEB.cjs +32 -0
- package/dist/chunk-BO4RFWBR.js +89 -0
- package/dist/{chunk-MNYKI4CI.js → chunk-CWM2ZDU5.js} +36 -0
- package/dist/chunk-CZHZGRU7.js +383 -0
- package/dist/{chunk-4NBS6KPV.cjs → chunk-DQ5VAYZ6.cjs} +7 -8
- package/dist/chunk-HUZZZ3JL.js +32 -0
- package/dist/{chunk-QOCNX236.js → chunk-IAXWICZU.js} +24 -1
- package/dist/{chunk-V5KPWNYX.cjs → chunk-JMJBSACD.cjs} +3 -3
- package/dist/chunk-L74VDN4A.cjs +32 -0
- package/dist/{chunk-74TMJA7Z.js → chunk-N5QFKSDO.js} +7 -4
- package/dist/{chunk-LKZJEL6E.cjs → chunk-Q27JY5RG.cjs} +6 -4
- package/dist/{chunk-SPVWWUHX.cjs → chunk-QWBWGODS.cjs} +24 -1
- package/dist/chunk-RPII3E6Z.cjs +145 -0
- package/dist/chunk-S6JGLF3G.cjs +89 -0
- package/dist/chunk-SVXC36MU.cjs +383 -0
- package/dist/chunk-TKJMZBAH.js +32 -0
- package/dist/{chunk-ZSVQT3PW.js → chunk-UBWEBKRC.js} +5 -6
- package/dist/chunk-UNEFIWXI.cjs +32 -0
- package/dist/chunk-VQY5W4YW.cjs +311 -0
- package/dist/chunk-WNY4WMRF.js +32 -0
- package/dist/chunk-XEKD23J5.js +9 -0
- package/dist/chunk-XTEI64OU.js +145 -0
- package/dist/chunk-XX6NQJMA.js +92 -0
- package/dist/{chunk-N3V2J5ZO.cjs → chunk-Y6OM7EV7.cjs} +7 -4
- package/dist/{chunk-745DV5FL.js → chunk-Y7FO65VT.js} +3 -3
- package/dist/{chunk-PXUJF5HS.js → chunk-ZY6KU6P3.js} +4 -2
- package/dist/completion/CompletionService.cjs +22 -15
- package/dist/completion/CompletionService.js +21 -14
- package/dist/completion/NativeSearchInjector.cjs +3 -3
- package/dist/completion/NativeSearchInjector.js +2 -2
- package/dist/completion/openrouter-headers.cjs +3 -6
- package/dist/completion/openrouter-headers.d.cts +9 -12
- package/dist/completion/openrouter-headers.d.ts +9 -12
- package/dist/completion/openrouter-headers.js +2 -5
- package/dist/completion/openrouter-models.cjs +4 -3
- package/dist/completion/openrouter-models.js +2 -1
- package/dist/completion.cjs +22 -15
- package/dist/completion.js +21 -14
- package/dist/index.cjs +139 -17
- package/dist/index.d.cts +40 -10
- package/dist/index.d.ts +40 -10
- package/dist/index.js +146 -24
- package/dist/outbound-api/routeResolver.cjs +5 -2
- package/dist/outbound-api/routeResolver.d.cts +8 -2
- package/dist/outbound-api/routeResolver.d.ts +8 -2
- package/dist/outbound-api/routeResolver.js +4 -1
- package/dist/outbound-api/types.cjs +6 -1
- package/dist/outbound-api/types.d.cts +11 -144
- package/dist/outbound-api/types.d.ts +11 -144
- package/dist/outbound-api/types.js +6 -0
- package/dist/outbound-api.cjs +133 -15
- package/dist/outbound-api.d.cts +786 -25
- package/dist/outbound-api.d.ts +786 -25
- package/dist/outbound-api.js +137 -19
- package/dist/pipeline/AuthSource.d.cts +23 -1
- package/dist/pipeline/AuthSource.d.ts +23 -1
- package/dist/pipeline/LlmConfigProviderAuth.cjs +3 -3
- package/dist/pipeline/LlmConfigProviderAuth.js +2 -2
- package/dist/pipeline/SubscriptionAccountHealth.cjs +22 -0
- package/dist/pipeline/SubscriptionAccountHealth.d.cts +235 -0
- package/dist/pipeline/SubscriptionAccountHealth.d.ts +235 -0
- package/dist/pipeline/SubscriptionAccountHealth.js +22 -0
- package/dist/pipeline/SubscriptionAuthSource.cjs +2 -2
- package/dist/pipeline/SubscriptionAuthSource.d.cts +3 -2
- package/dist/pipeline/SubscriptionAuthSource.d.ts +3 -2
- package/dist/pipeline/SubscriptionAuthSource.js +1 -1
- package/dist/pipeline/SubscriptionAuthStrategy.d.cts +24 -1
- package/dist/pipeline/SubscriptionAuthStrategy.d.ts +24 -1
- package/dist/pipeline/auditSink.cjs +14 -0
- package/dist/pipeline/auditSink.d.cts +48 -0
- package/dist/pipeline/auditSink.d.ts +48 -0
- package/dist/pipeline/auditSink.js +14 -0
- package/dist/pipeline/billingEmit.cjs +14 -0
- package/dist/pipeline/billingEmit.d.cts +49 -0
- package/dist/pipeline/billingEmit.d.ts +49 -0
- package/dist/pipeline/billingEmit.js +14 -0
- package/dist/ports/usage-event-store.d.cts +26 -1
- package/dist/ports/usage-event-store.d.ts +26 -1
- package/dist/ports.d.cts +7 -1
- package/dist/ports.d.ts +7 -1
- package/dist/provider-proxy/ProviderProxy.cjs +22 -15
- package/dist/provider-proxy/ProviderProxy.js +21 -14
- package/dist/provider-proxy/identity/SubscriptionIdentityStore.cjs +15 -0
- package/dist/provider-proxy/identity/SubscriptionIdentityStore.d.cts +121 -0
- package/dist/provider-proxy/identity/SubscriptionIdentityStore.d.ts +121 -0
- package/dist/provider-proxy/identity/SubscriptionIdentityStore.js +15 -0
- package/dist/provider-proxy/identity/fingerprintHeaders.cjs +20 -0
- package/dist/provider-proxy/identity/fingerprintHeaders.d.cts +89 -0
- package/dist/provider-proxy/identity/fingerprintHeaders.d.ts +89 -0
- package/dist/provider-proxy/identity/fingerprintHeaders.js +20 -0
- package/dist/provider-proxy/ingress/providerProxyShared.cjs +22 -15
- package/dist/provider-proxy/ingress/providerProxyShared.d.cts +11 -2
- package/dist/provider-proxy/ingress/providerProxyShared.d.ts +11 -2
- package/dist/provider-proxy/ingress/providerProxyShared.js +21 -14
- package/dist/provider-proxy/matchText.cjs +4 -2
- package/dist/provider-proxy/matchText.d.cts +14 -1
- package/dist/provider-proxy/matchText.d.ts +14 -1
- package/dist/provider-proxy/matchText.js +3 -1
- package/dist/provider-proxy/types.d.cts +23 -0
- package/dist/provider-proxy/types.d.ts +23 -0
- package/dist/provider-proxy.cjs +22 -15
- package/dist/provider-proxy.js +21 -14
- package/dist/{routeResolver-HE-ZO0fO.d.ts → routeResolver-B1NglTfe.d.ts} +36 -10
- package/dist/{routeResolver-BrbK6ja9.d.cts → routeResolver-CbG5uBgm.d.cts} +36 -10
- package/dist/transformer/transformers.cjs +7 -7
- package/dist/transformer/transformers.js +7 -7
- package/dist/transformer.cjs +5 -5
- package/dist/transformer.js +4 -4
- package/dist/types-6OUY_xfA.d.ts +830 -0
- package/dist/types-aBFFXoBz.d.cts +830 -0
- package/dist/usage/usage-recorder.cjs +2 -2
- package/dist/usage/usage-recorder.d.cts +19 -1
- package/dist/usage/usage-recorder.d.ts +19 -1
- package/dist/usage/usage-recorder.js +1 -1
- package/dist/usage.cjs +2 -2
- package/dist/usage.js +1 -1
- package/package.json +4 -2
- package/dist/chunk-3MEACFK3.js +0 -193
- package/dist/chunk-6VIXXLMX.cjs +0 -14
- package/dist/chunk-E3WHL7CO.js +0 -14
- package/dist/chunk-G2FUJNA2.cjs +0 -193
- package/dist/{chunk-UYPEN5XE.cjs → chunk-FFALUUZZ.cjs} +5 -5
- package/dist/{chunk-O466Y272.js → chunk-MQNDWYPN.js} +6 -6
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/pipeline/auditUsageStash.ts
|
|
2
|
+
var stash = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
function stashAuditUsage(key, detail) {
|
|
4
|
+
const existing = stash.get(key);
|
|
5
|
+
stash.set(key, existing ? { ...existing, ...detail } : { ...detail });
|
|
6
|
+
}
|
|
7
|
+
function readAuditUsage(key) {
|
|
8
|
+
return stash.get(key);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// src/usage/usage-recorder.ts
|
|
2
12
|
var UsageRecorder = class {
|
|
3
13
|
constructor(store, pricing, logger, options = {}) {
|
|
4
14
|
this.store = store;
|
|
5
15
|
this.pricing = pricing;
|
|
6
16
|
this.logger = logger;
|
|
7
17
|
this.defer = _nullishCoalesce(options.defer, () => ( ((fn) => setTimeout(fn, 0))));
|
|
18
|
+
this.onRecord = options.onRecord;
|
|
8
19
|
}
|
|
9
20
|
|
|
10
21
|
|
|
11
22
|
|
|
12
23
|
|
|
24
|
+
|
|
13
25
|
/**
|
|
14
26
|
* Record one LLM request. Returns immediately — the actual store insert is
|
|
15
27
|
* deferred so the caller's response path is unblocked.
|
|
@@ -17,6 +29,14 @@ var UsageRecorder = class {
|
|
|
17
29
|
* Errors during the insert are logged but never thrown.
|
|
18
30
|
*/
|
|
19
31
|
record(input) {
|
|
32
|
+
if (input.auditResponse) {
|
|
33
|
+
stashAuditUsage(input.auditResponse, {
|
|
34
|
+
inputTokens: input.usage.inputTokens,
|
|
35
|
+
outputTokens: input.usage.outputTokens,
|
|
36
|
+
model: input.model,
|
|
37
|
+
provider: input.providerId
|
|
38
|
+
});
|
|
39
|
+
}
|
|
20
40
|
this.defer(() => {
|
|
21
41
|
void this.recordAsync(input).catch((err) => {
|
|
22
42
|
this.logger.warn("[UsageRecorder] failed to persist usage event", {
|
|
@@ -35,6 +55,18 @@ var UsageRecorder = class {
|
|
|
35
55
|
input.model,
|
|
36
56
|
input.usage
|
|
37
57
|
);
|
|
58
|
+
if (input.auditResponse) {
|
|
59
|
+
try {
|
|
60
|
+
stashAuditUsage(input.auditResponse, { costUsd });
|
|
61
|
+
} catch (e) {
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (this.onRecord && input.apiKeyId) {
|
|
65
|
+
try {
|
|
66
|
+
this.onRecord(input.apiKeyId, costUsd, Date.now());
|
|
67
|
+
} catch (e2) {
|
|
68
|
+
}
|
|
69
|
+
}
|
|
38
70
|
const row = {
|
|
39
71
|
messageId: _nullishCoalesce(input.messageId, () => ( null)),
|
|
40
72
|
parentMessageId: _nullishCoalesce(input.parentMessageId, () => ( null)),
|
|
@@ -73,6 +105,9 @@ var UsageRecorder = class {
|
|
|
73
105
|
getByApiKey(range) {
|
|
74
106
|
return this.store.getByApiKey(range);
|
|
75
107
|
}
|
|
108
|
+
getTimeSeries(range, bucket) {
|
|
109
|
+
return this.store.getTimeSeries(range, bucket);
|
|
110
|
+
}
|
|
76
111
|
getMessagesForSession(sessionId) {
|
|
77
112
|
return this.store.getMessagesForSession(sessionId);
|
|
78
113
|
}
|
|
@@ -84,11 +119,12 @@ var UsageRecorder = class {
|
|
|
84
119
|
var safeStringify = (value) => {
|
|
85
120
|
try {
|
|
86
121
|
return JSON.stringify(value);
|
|
87
|
-
} catch (
|
|
122
|
+
} catch (e3) {
|
|
88
123
|
return "";
|
|
89
124
|
}
|
|
90
125
|
};
|
|
91
126
|
|
|
92
127
|
|
|
93
128
|
|
|
94
|
-
|
|
129
|
+
|
|
130
|
+
exports.readAuditUsage = readAuditUsage; exports.UsageRecorder = UsageRecorder;
|