@omnicross/core 0.4.1 → 0.4.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 +11 -184
- package/dist/auth/GeminiCodeAssistProjectResolver.d.cts +41 -3
- package/dist/auth/GeminiCodeAssistProjectResolver.d.ts +41 -3
- package/dist/auth/GeminiCodeAssistProjectResolver.js +12 -185
- package/dist/{chunk-POUTD5AM.cjs → chunk-47E3I5PF.cjs} +10 -3
- package/dist/{chunk-WX2E2G7H.cjs → chunk-4NAMH4UE.cjs} +79 -51
- package/dist/{chunk-LQYS2N47.js → chunk-4RM22ETG.js} +14 -2
- package/dist/{chunk-YEVWA4C7.cjs → chunk-57Y2EA2G.cjs} +6 -5
- package/dist/chunk-6I4SAWCN.js +24 -0
- package/dist/chunk-AFH5CEMF.cjs +38 -0
- package/dist/{chunk-KIQ2HA2A.cjs → chunk-BTSADEX4.cjs} +5 -5
- package/dist/chunk-CGEZQC2G.cjs +67 -0
- package/dist/chunk-E5RCCGE7.cjs +95 -0
- package/dist/chunk-EE7VP4O3.js +230 -0
- package/dist/chunk-F6P4DIBL.js +95 -0
- package/dist/{chunk-BKXC4XM6.cjs → chunk-FORICQ5U.cjs} +15 -11
- package/dist/{chunk-PF7YQBKX.js → chunk-FYPKKMB3.js} +6 -2
- package/dist/chunk-HRBXQ5AC.js +44 -0
- package/dist/{chunk-LFEH7CEO.js → chunk-IDPMD4B7.js} +22 -0
- package/dist/{chunk-UPQIWJIE.cjs → chunk-INY54AYX.cjs} +14 -2
- package/dist/{chunk-QEOV6Y4E.cjs → chunk-J5XMB5KY.cjs} +359 -170
- package/dist/{chunk-C3NPMQTK.js → chunk-JHJRZ75C.js} +14 -10
- package/dist/chunk-K6J2RIEX.js +67 -0
- package/dist/chunk-KSMK45RD.cjs +45 -0
- package/dist/chunk-LL3MZ7O5.cjs +24 -0
- package/dist/{chunk-ECZ3ZE2C.js → chunk-M6PKXP6T.js} +4 -29
- package/dist/{chunk-PAXJGABW.js → chunk-MPFOC7AT.js} +10 -5
- package/dist/{chunk-DKBXDV5U.cjs → chunk-N3MGNLCU.cjs} +49 -44
- package/dist/chunk-NDIBVTBZ.cjs +230 -0
- package/dist/{chunk-5DJSOFEP.js → chunk-NTF7TLT7.js} +1 -1
- package/dist/chunk-ONTTXSRL.js +32 -0
- package/dist/{chunk-HN74IGEO.js → chunk-OXBGNEYR.js} +1 -1
- package/dist/{chunk-5GXOYVLB.js → chunk-QSOHEDKO.js} +44 -39
- package/dist/{chunk-TX3AEV6H.cjs → chunk-RXMF7GNF.cjs} +4 -3
- package/dist/{chunk-5TEWZN5J.js → chunk-SWY2LTMR.js} +277 -88
- package/dist/{chunk-EUZRH544.js → chunk-TKZ3DZS5.js} +10 -3
- package/dist/{chunk-MXI2PWIC.cjs → chunk-UKQHBK4Q.cjs} +1 -32
- package/dist/{chunk-3XVDFRCQ.cjs → chunk-UOOLU64V.cjs} +13 -8
- package/dist/{chunk-ZSA44G7J.cjs → chunk-VFFCV4J6.cjs} +3 -3
- package/dist/{chunk-6DDYNS2B.cjs → chunk-VGBJPHHD.cjs} +36 -14
- package/dist/{chunk-2T6D7LWE.cjs → chunk-VYOBVPNB.cjs} +6 -2
- package/dist/chunk-WYECWQ3J.cjs +44 -0
- package/dist/chunk-X6GHTNDL.cjs +482 -0
- package/dist/chunk-XBQTVRMK.js +45 -0
- package/dist/{chunk-R4VCO2CB.js → chunk-YEHQ5FXZ.js} +28 -0
- package/dist/{chunk-HDXSPXIN.js → chunk-ZBDDPWVQ.js} +4 -3
- package/dist/chunk-ZJJBITUN.js +482 -0
- package/dist/{chunk-QRXOLINS.js → chunk-ZMERU7D3.js} +3 -2
- package/dist/completion/CompletionService.cjs +29 -22
- package/dist/completion/CompletionService.js +28 -21
- package/dist/completion.cjs +29 -22
- package/dist/completion.js +28 -21
- package/dist/image-generation.cjs +2 -2
- package/dist/image-generation.d.cts +2 -2
- package/dist/image-generation.d.ts +2 -2
- package/dist/image-generation.js +1 -1
- package/dist/index.cjs +40 -29
- package/dist/index.d.cts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +40 -29
- package/dist/outbound-api/routeResolver.cjs +3 -3
- package/dist/outbound-api/routeResolver.d.cts +3 -3
- package/dist/outbound-api/routeResolver.d.ts +3 -3
- package/dist/outbound-api/routeResolver.js +2 -2
- package/dist/outbound-api/types.cjs +6 -2
- package/dist/outbound-api/types.d.cts +2 -2
- package/dist/outbound-api/types.d.ts +2 -2
- package/dist/outbound-api/types.js +7 -3
- package/dist/outbound-api.cjs +33 -22
- package/dist/outbound-api.d.cts +4 -4
- package/dist/outbound-api.d.ts +4 -4
- package/dist/outbound-api.js +33 -22
- package/dist/pipeline/AccountAllowanceScheduling.cjs +4 -3
- package/dist/pipeline/AccountAllowanceScheduling.d.cts +4 -4
- package/dist/pipeline/AccountAllowanceScheduling.d.ts +4 -4
- package/dist/pipeline/AccountAllowanceScheduling.js +3 -2
- package/dist/pipeline/AccountAllowanceStore.cjs +2 -2
- package/dist/pipeline/AccountAllowanceStore.js +1 -1
- package/dist/pipeline/AuthSource.d.cts +6 -0
- package/dist/pipeline/AuthSource.d.ts +6 -0
- package/dist/pipeline/SubscriptionAuthSource.cjs +5 -4
- package/dist/pipeline/SubscriptionAuthSource.js +4 -3
- package/dist/pipeline/SubscriptionAuthStrategy.d.cts +7 -0
- package/dist/pipeline/SubscriptionAuthStrategy.d.ts +7 -0
- package/dist/pipeline/antigravityQuotaFamily.cjs +16 -0
- package/dist/pipeline/antigravityQuotaFamily.d.cts +52 -0
- package/dist/pipeline/antigravityQuotaFamily.d.ts +52 -0
- package/dist/pipeline/antigravityQuotaFamily.js +16 -0
- package/dist/pipeline/upstreamFetch.cjs +3 -3
- package/dist/pipeline/upstreamFetch.js +2 -2
- package/dist/ports.d.cts +2 -2
- package/dist/ports.d.ts +2 -2
- package/dist/provider-proxy/ProviderProxy.cjs +29 -22
- package/dist/provider-proxy/ProviderProxy.js +28 -21
- package/dist/provider-proxy/identity/codexCliHeaders.cjs +4 -2
- package/dist/provider-proxy/identity/codexCliHeaders.js +4 -2
- package/dist/provider-proxy/identity/openCodeGoHeaders.cjs +17 -0
- package/dist/provider-proxy/identity/openCodeGoHeaders.d.cts +71 -0
- package/dist/provider-proxy/identity/openCodeGoHeaders.d.ts +71 -0
- package/dist/provider-proxy/identity/openCodeGoHeaders.js +17 -0
- package/dist/provider-proxy/ingress/providerProxyShared.cjs +29 -22
- package/dist/provider-proxy/ingress/providerProxyShared.js +28 -21
- package/dist/provider-proxy.cjs +29 -22
- package/dist/provider-proxy.d.cts +2 -2
- package/dist/provider-proxy.d.ts +2 -2
- package/dist/provider-proxy.js +28 -21
- package/dist/{routeResolver-STwMz_G4.d.ts → routeResolver-BLTleO4H.d.ts} +1 -1
- package/dist/{routeResolver-Da0yvkL1.d.cts → routeResolver-C2z0pp-q.d.cts} +1 -1
- package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.cjs +2 -2
- package/dist/transformer/transformers/AnthropicOpenAIToAnthropicStream.js +1 -1
- package/dist/transformer/transformers/AnthropicTransformer.cjs +3 -3
- package/dist/transformer/transformers/AnthropicTransformer.js +2 -2
- package/dist/transformer/transformers/AntigravityTransformer.cjs +31 -0
- package/dist/transformer/transformers/AntigravityTransformer.d.cts +104 -0
- package/dist/transformer/transformers/AntigravityTransformer.d.ts +104 -0
- package/dist/transformer/transformers/AntigravityTransformer.js +31 -0
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.cjs +3 -3
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.d.cts +2 -1
- package/dist/transformer/transformers/GeminiCodeAssistTransformer.d.ts +2 -1
- 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/antigravityFailover.cjs +30 -0
- package/dist/transformer/transformers/antigravityFailover.d.cts +52 -0
- package/dist/transformer/transformers/antigravityFailover.d.ts +52 -0
- package/dist/transformer/transformers/antigravityFailover.js +30 -0
- package/dist/transformer/transformers/antigravityIdentity.cjs +24 -0
- package/dist/transformer/transformers/antigravityIdentity.d.cts +76 -0
- package/dist/transformer/transformers/antigravityIdentity.d.ts +76 -0
- package/dist/transformer/transformers/antigravityIdentity.js +24 -0
- package/dist/transformer/transformers.cjs +61 -9
- package/dist/transformer/transformers.d.cts +7 -2
- package/dist/transformer/transformers.d.ts +7 -2
- package/dist/transformer/transformers.js +61 -9
- package/dist/transformer/types.d.cts +11 -0
- package/dist/transformer/types.d.ts +11 -0
- package/dist/transformer.cjs +21 -12
- package/dist/transformer.d.cts +3 -0
- package/dist/transformer.d.ts +3 -0
- package/dist/transformer.js +20 -11
- package/dist/{types-Be-yt_6T.d.cts → types-BVwJQ9ZS.d.cts} +3 -0
- package/dist/{types-D-oHYusb.d.cts → types-C6m-Db26.d.cts} +25 -4
- package/dist/{types-Dvlpjn0d.d.ts → types-Da735j2d.d.ts} +25 -4
- package/dist/{types-Dm4_36V4.d.ts → types-VAHRysdP.d.ts} +3 -0
- package/package.json +2 -2
- package/dist/chunk-4IH4EL7M.cjs +0 -9
- package/dist/chunk-XEKD23J5.js +0 -9
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
convertOpenAIStreamToAnthropic
|
|
3
|
-
} from "./chunk-LFEH7CEO.js";
|
|
4
1
|
import {
|
|
5
2
|
anthropicUsageToChatUsage
|
|
6
3
|
} from "./chunk-FU7EAR73.js";
|
|
4
|
+
import {
|
|
5
|
+
beginAnthropicImageDropScope,
|
|
6
|
+
convertOpenAIStreamToAnthropic,
|
|
7
|
+
noteDroppedInlineImages
|
|
8
|
+
} from "./chunk-IDPMD4B7.js";
|
|
7
9
|
import {
|
|
8
10
|
flattenToolResultContent,
|
|
9
11
|
formatBase64,
|
|
@@ -275,6 +277,11 @@ function convertOpenAIResponseToAnthropic(openaiResponse) {
|
|
|
275
277
|
}
|
|
276
278
|
const message = choice.message;
|
|
277
279
|
const content = [];
|
|
280
|
+
const images = message.images;
|
|
281
|
+
if (Array.isArray(images) && images.length > 0) {
|
|
282
|
+
beginAnthropicImageDropScope();
|
|
283
|
+
noteDroppedInlineImages(images.length);
|
|
284
|
+
}
|
|
278
285
|
const thinking = message.thinking;
|
|
279
286
|
if (thinking?.content) {
|
|
280
287
|
content.push({
|
|
@@ -25,39 +25,8 @@ var NEVER_FORWARD_HEADERS = /* @__PURE__ */ new Set([
|
|
|
25
25
|
"accept-encoding"
|
|
26
26
|
]);
|
|
27
27
|
|
|
28
|
-
// src/provider-proxy/identity/codexCliHeaders.ts
|
|
29
|
-
var DEFAULT_CODEX_CLI_HEADERS = Object.freeze({
|
|
30
|
-
originator: "codex_cli_rs",
|
|
31
|
-
"user-agent": "codex_cli_rs/0.144.5",
|
|
32
|
-
version: "0.144.5"
|
|
33
|
-
});
|
|
34
|
-
var CODEX_FORWARD_ALLOWLIST = /* @__PURE__ */ new Set([
|
|
35
|
-
"version",
|
|
36
|
-
"openai-beta",
|
|
37
|
-
"session_id",
|
|
38
|
-
"originator",
|
|
39
|
-
"user-agent"
|
|
40
|
-
]);
|
|
41
|
-
function extractCodexClientHeaders(reqHeaders) {
|
|
42
|
-
const out = {};
|
|
43
|
-
for (const [rawKey, rawVal] of Object.entries(reqHeaders)) {
|
|
44
|
-
const key = rawKey.toLowerCase();
|
|
45
|
-
if (NEVER_FORWARD_HEADERS.has(key)) continue;
|
|
46
|
-
if (!CODEX_FORWARD_ALLOWLIST.has(key)) continue;
|
|
47
|
-
const value = flattenHeaderValue(rawVal);
|
|
48
|
-
if (value !== void 0) out[key] = value;
|
|
49
|
-
}
|
|
50
|
-
return out;
|
|
51
|
-
}
|
|
52
|
-
function codexAcceptHeader(isStream) {
|
|
53
|
-
return isStream ? "text/event-stream" : "application/json";
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
28
|
|
|
60
29
|
|
|
61
30
|
|
|
62
31
|
|
|
63
|
-
exports.fillMissingHeaders = fillMissingHeaders; exports.flattenHeaderValue = flattenHeaderValue; exports.NEVER_FORWARD_HEADERS = NEVER_FORWARD_HEADERS;
|
|
32
|
+
exports.fillMissingHeaders = fillMissingHeaders; exports.flattenHeaderValue = flattenHeaderValue; exports.NEVER_FORWARD_HEADERS = NEVER_FORWARD_HEADERS;
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var _chunkKIQ2HA2Acjs = require('./chunk-KIQ2HA2A.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
3
|
var _chunkNOITAVHAcjs = require('./chunk-NOITAVHA.cjs');
|
|
7
4
|
|
|
8
5
|
|
|
9
6
|
var _chunkQWNUOR7Fcjs = require('./chunk-QWNUOR7F.cjs');
|
|
10
7
|
|
|
11
8
|
|
|
12
|
-
var
|
|
9
|
+
var _chunk47E3I5PFcjs = require('./chunk-47E3I5PF.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkX6GHTNDLcjs = require('./chunk-X6GHTNDL.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkBTSADEX4cjs = require('./chunk-BTSADEX4.cjs');
|
|
13
16
|
|
|
14
17
|
|
|
15
|
-
var
|
|
18
|
+
var _chunkN3MGNLCUcjs = require('./chunk-N3MGNLCU.cjs');
|
|
16
19
|
|
|
17
20
|
// src/transformer/transformers/index.ts
|
|
18
21
|
var BuiltinTransformers = {
|
|
19
22
|
OpenAITransformer: _chunkQWNUOR7Fcjs.OpenAITransformer,
|
|
20
|
-
GeminiTransformer:
|
|
21
|
-
GeminiCodeAssistTransformer:
|
|
22
|
-
|
|
23
|
+
GeminiTransformer: _chunkBTSADEX4cjs.GeminiTransformer,
|
|
24
|
+
GeminiCodeAssistTransformer: _chunkN3MGNLCUcjs.GeminiCodeAssistTransformer,
|
|
25
|
+
AntigravityTransformer: _chunkX6GHTNDLcjs.AntigravityTransformer,
|
|
26
|
+
AnthropicTransformer: _chunk47E3I5PFcjs.AnthropicTransformer,
|
|
23
27
|
OpenAIResponseTransformer: _chunkNOITAVHAcjs.OpenAIResponseTransformer
|
|
24
28
|
};
|
|
25
29
|
function getBuiltinTransformers() {
|
|
@@ -29,6 +33,7 @@ var BUILTIN_TRANSFORMER_NAMES = [
|
|
|
29
33
|
"openai",
|
|
30
34
|
"gemini",
|
|
31
35
|
"gemini-code-assist",
|
|
36
|
+
"antigravity",
|
|
32
37
|
"anthropic",
|
|
33
38
|
"openai-response"
|
|
34
39
|
];
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
var _chunk235MXAGXcjs = require('./chunk-235MXAGX.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkVYOBVPNBcjs = require('./chunk-VYOBVPNB.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _chunkNKVZ6Z3Ycjs = require('./chunk-NKVZ6Z3Y.cjs');
|
|
@@ -118,12 +118,12 @@ function fetchUpstream(url, init, ctx) {
|
|
|
118
118
|
const doFetchWithAllowanceTap = () => doFetch().then((response) => {
|
|
119
119
|
if (_optionalChain([ctx, 'optionalAccess', _4 => _4.providerId]) === "codex" && ctx.accountId) {
|
|
120
120
|
try {
|
|
121
|
-
|
|
121
|
+
_chunkVYOBVPNBcjs.getSharedAccountAllowanceStore.call(void 0, ).recordCodexHeaders(ctx.accountId, response.headers);
|
|
122
122
|
} catch (e4) {
|
|
123
123
|
}
|
|
124
124
|
} else if (_optionalChain([ctx, 'optionalAccess', _5 => _5.providerId]) === "claude" && ctx.accountId) {
|
|
125
125
|
try {
|
|
126
|
-
|
|
126
|
+
_chunkVYOBVPNBcjs.getSharedAccountAllowanceStore.call(void 0, ).recordClaudeHeaders(ctx.accountId, response.headers);
|
|
127
127
|
} catch (e5) {
|
|
128
128
|
}
|
|
129
129
|
}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/transformer/transformers/
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/transformer/transformers/utils/anthropicImageDrop.ts
|
|
2
|
+
var anthropicDroppedImageCount = 0;
|
|
3
|
+
var warnedForCurrentStream = false;
|
|
4
|
+
function beginAnthropicImageDropScope() {
|
|
5
|
+
warnedForCurrentStream = false;
|
|
6
|
+
}
|
|
7
|
+
function noteDroppedInlineImages(count) {
|
|
8
|
+
anthropicDroppedImageCount += count;
|
|
9
|
+
if (warnedForCurrentStream) return;
|
|
10
|
+
warnedForCurrentStream = true;
|
|
11
|
+
console.warn(
|
|
12
|
+
`[Anthropic face] dropped ${count} session image(s); the Anthropic Messages wire has no image block (total dropped: ${anthropicDroppedImageCount})`
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/transformer/transformers/AnthropicOpenAIToAnthropicStream.ts
|
|
2
17
|
var DEFAULT_ANTHROPIC_PING_HEARTBEAT_MS = 2e4;
|
|
3
18
|
var anthropicPingHeartbeatMs = DEFAULT_ANTHROPIC_PING_HEARTBEAT_MS;
|
|
4
19
|
function setAnthropicPingHeartbeatMs(ms) {
|
|
@@ -124,6 +139,7 @@ data: ${JSON.stringify({ type: "message_stop" })}
|
|
|
124
139
|
isClosed = true;
|
|
125
140
|
};
|
|
126
141
|
try {
|
|
142
|
+
beginAnthropicImageDropScope();
|
|
127
143
|
armPing();
|
|
128
144
|
while (true) {
|
|
129
145
|
const { done, value } = await reader.read();
|
|
@@ -190,18 +206,22 @@ data: ${JSON.stringify({
|
|
|
190
206
|
}
|
|
191
207
|
const choice = _optionalChain([chunk, 'access', _12 => _12.choices, 'optionalAccess', _13 => _13[0]]);
|
|
192
208
|
if (!choice) continue;
|
|
209
|
+
const deltaImages = _optionalChain([choice, 'access', _14 => _14.delta, 'optionalAccess', _15 => _15.images]);
|
|
210
|
+
if (Array.isArray(deltaImages) && deltaImages.length > 0) {
|
|
211
|
+
noteDroppedInlineImages(deltaImages.length);
|
|
212
|
+
}
|
|
193
213
|
if (chunk.usage) {
|
|
194
214
|
stopReasonDelta = {
|
|
195
215
|
type: "message_delta",
|
|
196
216
|
delta: { stop_reason: "end_turn", stop_sequence: null },
|
|
197
217
|
usage: {
|
|
198
|
-
input_tokens: (chunk.usage.prompt_tokens || 0) - (_optionalChain([chunk, 'access',
|
|
218
|
+
input_tokens: (chunk.usage.prompt_tokens || 0) - (_optionalChain([chunk, 'access', _16 => _16.usage, 'access', _17 => _17.prompt_tokens_details, 'optionalAccess', _18 => _18.cached_tokens]) || 0),
|
|
199
219
|
output_tokens: chunk.usage.completion_tokens || 0,
|
|
200
|
-
cache_read_input_tokens: _optionalChain([chunk, 'access',
|
|
220
|
+
cache_read_input_tokens: _optionalChain([chunk, 'access', _19 => _19.usage, 'access', _20 => _20.prompt_tokens_details, 'optionalAccess', _21 => _21.cached_tokens]) || 0
|
|
201
221
|
}
|
|
202
222
|
};
|
|
203
223
|
}
|
|
204
|
-
if (_optionalChain([choice, 'access',
|
|
224
|
+
if (_optionalChain([choice, 'access', _22 => _22.delta, 'optionalAccess', _23 => _23.thinking])) {
|
|
205
225
|
if (!isThinkingStarted) {
|
|
206
226
|
const thinkingBlockIndex = assignContentBlockIndex();
|
|
207
227
|
safeEnqueue(`event: content_block_start
|
|
@@ -243,7 +263,7 @@ data: ${JSON.stringify({
|
|
|
243
263
|
`);
|
|
244
264
|
}
|
|
245
265
|
}
|
|
246
|
-
if (_optionalChain([choice, 'access',
|
|
266
|
+
if (_optionalChain([choice, 'access', _24 => _24.delta, 'optionalAccess', _25 => _25.content])) {
|
|
247
267
|
if (!hasTextContentStarted) {
|
|
248
268
|
if (currentContentBlockIndex >= 0 && isThinkingStarted) {
|
|
249
269
|
safeEnqueue(`event: content_block_stop
|
|
@@ -275,7 +295,7 @@ data: ${JSON.stringify({
|
|
|
275
295
|
|
|
276
296
|
`);
|
|
277
297
|
}
|
|
278
|
-
if (_optionalChain([choice, 'access',
|
|
298
|
+
if (_optionalChain([choice, 'access', _26 => _26.delta, 'optionalAccess', _27 => _27.tool_calls])) {
|
|
279
299
|
for (const toolCall of choice.delta.tool_calls) {
|
|
280
300
|
const toolCallIndex = _nullishCoalesce(toolCall.index, () => ( 0));
|
|
281
301
|
if (!toolCallIndexToContentBlockIndex.has(toolCallIndex)) {
|
|
@@ -298,7 +318,7 @@ data: ${JSON.stringify({
|
|
|
298
318
|
content_block: {
|
|
299
319
|
type: "tool_use",
|
|
300
320
|
id: toolCall.id || `call_${Date.now()}_${toolCallIndex}`,
|
|
301
|
-
name: _optionalChain([toolCall, 'access',
|
|
321
|
+
name: _optionalChain([toolCall, 'access', _28 => _28.function, 'optionalAccess', _29 => _29.name]) || `tool_${toolCallIndex}`,
|
|
302
322
|
input: {}
|
|
303
323
|
}
|
|
304
324
|
})}
|
|
@@ -306,7 +326,7 @@ data: ${JSON.stringify({
|
|
|
306
326
|
`);
|
|
307
327
|
currentContentBlockIndex = newBlockIndex;
|
|
308
328
|
}
|
|
309
|
-
if (_optionalChain([toolCall, 'access',
|
|
329
|
+
if (_optionalChain([toolCall, 'access', _30 => _30.function, 'optionalAccess', _31 => _31.arguments])) {
|
|
310
330
|
const blockIndex = toolCallIndexToContentBlockIndex.get(toolCallIndex);
|
|
311
331
|
if (blockIndex !== void 0) {
|
|
312
332
|
safeEnqueue(`event: content_block_delta
|
|
@@ -340,14 +360,14 @@ data: ${JSON.stringify({
|
|
|
340
360
|
stop_sequence: null
|
|
341
361
|
},
|
|
342
362
|
usage: {
|
|
343
|
-
input_tokens: (_optionalChain([chunk, 'access',
|
|
344
|
-
output_tokens: _optionalChain([chunk, 'access',
|
|
345
|
-
cache_read_input_tokens: _optionalChain([chunk, 'access',
|
|
363
|
+
input_tokens: (_optionalChain([chunk, 'access', _32 => _32.usage, 'optionalAccess', _33 => _33.prompt_tokens]) || 0) - (_optionalChain([chunk, 'access', _34 => _34.usage, 'optionalAccess', _35 => _35.prompt_tokens_details, 'optionalAccess', _36 => _36.cached_tokens]) || 0),
|
|
364
|
+
output_tokens: _optionalChain([chunk, 'access', _37 => _37.usage, 'optionalAccess', _38 => _38.completion_tokens]) || 0,
|
|
365
|
+
cache_read_input_tokens: _optionalChain([chunk, 'access', _39 => _39.usage, 'optionalAccess', _40 => _40.prompt_tokens_details, 'optionalAccess', _41 => _41.cached_tokens]) || 0
|
|
346
366
|
}
|
|
347
367
|
};
|
|
348
368
|
}
|
|
349
369
|
} catch (e) {
|
|
350
|
-
_optionalChain([logger, 'optionalAccess',
|
|
370
|
+
_optionalChain([logger, 'optionalAccess', _42 => _42.error, 'call', _43 => _43("Error parsing stream chunk:", e)]);
|
|
351
371
|
}
|
|
352
372
|
}
|
|
353
373
|
armPing();
|
|
@@ -367,7 +387,7 @@ data: ${JSON.stringify({
|
|
|
367
387
|
// cleared INDIRECTLY (pinned by the cancel-leak fake-timer test).
|
|
368
388
|
cancel: async () => {
|
|
369
389
|
try {
|
|
370
|
-
await _optionalChain([reader, 'optionalAccess',
|
|
390
|
+
await _optionalChain([reader, 'optionalAccess', _44 => _44.cancel, 'call', _45 => _45()]);
|
|
371
391
|
} catch (_e) {
|
|
372
392
|
}
|
|
373
393
|
}
|
|
@@ -381,4 +401,6 @@ data: ${JSON.stringify({
|
|
|
381
401
|
|
|
382
402
|
|
|
383
403
|
|
|
384
|
-
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
exports.beginAnthropicImageDropScope = beginAnthropicImageDropScope; exports.noteDroppedInlineImages = noteDroppedInlineImages; exports.DEFAULT_ANTHROPIC_PING_HEARTBEAT_MS = DEFAULT_ANTHROPIC_PING_HEARTBEAT_MS; exports.setAnthropicPingHeartbeatMs = setAnthropicPingHeartbeatMs; exports.getAnthropicPingHeartbeatMs = getAnthropicPingHeartbeatMs; exports.stopReasonContentFilterCount = stopReasonContentFilterCount; exports.__resetStopReasonContentFilterCountForTests = __resetStopReasonContentFilterCountForTests; exports.convertOpenAIStreamToAnthropic = convertOpenAIStreamToAnthropic;
|
|
@@ -17,7 +17,8 @@ function cloneWindow(window) {
|
|
|
17
17
|
...window.windowMinutes === void 0 ? {} : { windowMinutes: window.windowMinutes },
|
|
18
18
|
...window.resetsAt === void 0 ? {} : { resetsAt: window.resetsAt },
|
|
19
19
|
...window.remainingSeconds === void 0 ? {} : { remainingSeconds: window.remainingSeconds },
|
|
20
|
-
state: window.state
|
|
20
|
+
state: window.state,
|
|
21
|
+
...window.disabled === void 0 ? {} : { disabled: window.disabled }
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
function cloneSnapshot(snapshot) {
|
|
@@ -56,7 +57,7 @@ function normalizedInstant(value) {
|
|
|
56
57
|
return Number.isFinite(parsed) ? new Date(parsed).toISOString() : void 0;
|
|
57
58
|
}
|
|
58
59
|
function isAllowanceProvider(value) {
|
|
59
|
-
return value === "claude" || value === "codex" || value === "gemini" || value === "opencodego" || value === "kimi" || value === "grok" || value === "copilot";
|
|
60
|
+
return value === "claude" || value === "codex" || value === "gemini" || value === "opencodego" || value === "kimi" || value === "grok" || value === "copilot" || value === "antigravity";
|
|
60
61
|
}
|
|
61
62
|
function isWindowState(value) {
|
|
62
63
|
return value === "fresh" || value === "stale" || value === "unavailable" || value === "unsupported";
|
|
@@ -95,6 +96,9 @@ function normalizeAccountAllowanceSnapshot(value) {
|
|
|
95
96
|
...windowMinutes === void 0 ? {} : { windowMinutes },
|
|
96
97
|
...resetsAt === void 0 ? {} : { resetsAt },
|
|
97
98
|
...remainingSeconds2 === void 0 ? {} : { remainingSeconds: remainingSeconds2 },
|
|
99
|
+
// antigravity: the disabled counter-family hard-block flag (additive;
|
|
100
|
+
// absent on every other provider's windows).
|
|
101
|
+
...window.disabled === true ? { disabled: true } : {},
|
|
98
102
|
state
|
|
99
103
|
});
|
|
100
104
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkUKQHBK4Qcjs = require('./chunk-UKQHBK4Q.cjs');
|
|
4
|
+
|
|
5
|
+
// src/provider-proxy/identity/openCodeGoHeaders.ts
|
|
6
|
+
var OPENCODE_SESSION_HEADER = "x-opencode-session";
|
|
7
|
+
var configuredUserAgent;
|
|
8
|
+
function setOpenCodeGoUserAgent(userAgent) {
|
|
9
|
+
const trimmed = typeof userAgent === "string" ? userAgent.trim() : "";
|
|
10
|
+
configuredUserAgent = trimmed.length > 0 ? trimmed : void 0;
|
|
11
|
+
}
|
|
12
|
+
function getOpenCodeGoUserAgent() {
|
|
13
|
+
if (configuredUserAgent) return configuredUserAgent;
|
|
14
|
+
const version = true ? "0.4.3" : "0.0.0-dev";
|
|
15
|
+
return `omnicross/${version}`;
|
|
16
|
+
}
|
|
17
|
+
function extractOpenCodeSessionHeader(reqHeaders) {
|
|
18
|
+
for (const [rawKey, rawVal] of Object.entries(reqHeaders)) {
|
|
19
|
+
if (rawKey.toLowerCase() !== OPENCODE_SESSION_HEADER) continue;
|
|
20
|
+
const value = _chunkUKQHBK4Qcjs.flattenHeaderValue.call(void 0, rawVal);
|
|
21
|
+
if (value === void 0) continue;
|
|
22
|
+
const trimmed = value.trim();
|
|
23
|
+
if (trimmed.length > 0) return trimmed;
|
|
24
|
+
}
|
|
25
|
+
return void 0;
|
|
26
|
+
}
|
|
27
|
+
function resolveOpenCodeSessionHeader(callerSession, sessionKey) {
|
|
28
|
+
const caller = typeof callerSession === "string" ? callerSession.trim() : "";
|
|
29
|
+
if (caller.length > 0) return caller;
|
|
30
|
+
if (typeof sessionKey === "string" && sessionKey.trim().length > 0) return sessionKey;
|
|
31
|
+
return void 0;
|
|
32
|
+
}
|
|
33
|
+
function __resetOpenCodeGoHeadersForTests() {
|
|
34
|
+
configuredUserAgent = void 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
exports.OPENCODE_SESSION_HEADER = OPENCODE_SESSION_HEADER; exports.setOpenCodeGoUserAgent = setOpenCodeGoUserAgent; exports.getOpenCodeGoUserAgent = getOpenCodeGoUserAgent; exports.extractOpenCodeSessionHeader = extractOpenCodeSessionHeader; exports.resolveOpenCodeSessionHeader = resolveOpenCodeSessionHeader; exports.__resetOpenCodeGoHeadersForTests = __resetOpenCodeGoHeadersForTests;
|