@omnicross/core 0.4.2 → 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
|
@@ -0,0 +1,482 @@
|
|
|
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; } var _class;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkE5RCCGE7cjs = require('./chunk-E5RCCGE7.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkKSMK45RDcjs = require('./chunk-KSMK45RD.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkNDIBVTBZcjs = require('./chunk-NDIBVTBZ.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunkN3MGNLCUcjs = require('./chunk-N3MGNLCU.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunk4NAMH4UEcjs = require('./chunk-4NAMH4UE.cjs');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
var _chunkIUL4VWNUcjs = require('./chunk-IUL4VWNU.cjs');
|
|
27
|
+
|
|
28
|
+
// src/transformer/transformers/AntigravityTransformer.ts
|
|
29
|
+
var _crypto = require('crypto');
|
|
30
|
+
|
|
31
|
+
// src/transformer/transformers/utils/ccaLegacySchema.ts
|
|
32
|
+
function appendHint(description, hint) {
|
|
33
|
+
if (!hint) return _nullishCoalesce(description, () => ( ""));
|
|
34
|
+
if (!description) return hint;
|
|
35
|
+
return `${description} (${hint})`;
|
|
36
|
+
}
|
|
37
|
+
function refHint(refValue) {
|
|
38
|
+
const name = refValue.slice(refValue.lastIndexOf("/") + 1);
|
|
39
|
+
return name ? `See: ${name}` : "";
|
|
40
|
+
}
|
|
41
|
+
var CONSTRAINT_KEYS = [
|
|
42
|
+
"minLength",
|
|
43
|
+
"maxLength",
|
|
44
|
+
"exclusiveMinimum",
|
|
45
|
+
"exclusiveMaximum",
|
|
46
|
+
"pattern",
|
|
47
|
+
"minItems",
|
|
48
|
+
"maxItems"
|
|
49
|
+
];
|
|
50
|
+
function normalizeType(typeValue) {
|
|
51
|
+
if (typeof typeValue === "string" && typeValue) return { type: typeValue, hint: "" };
|
|
52
|
+
if (!Array.isArray(typeValue) || typeValue.length === 0) return { type: "", hint: "" };
|
|
53
|
+
const raw = typeValue.map((t) => t == null ? "" : String(t)).filter(Boolean);
|
|
54
|
+
const hasNull = raw.includes("null");
|
|
55
|
+
const nonNull = raw.filter((t) => t !== "null");
|
|
56
|
+
const primary = nonNull[0] || "string";
|
|
57
|
+
const hints = [];
|
|
58
|
+
if (nonNull.length > 1) hints.push(`Accepts: ${nonNull.join(" | ")}`);
|
|
59
|
+
if (hasNull) hints.push("nullable");
|
|
60
|
+
return { type: primary, hint: hints.join("; ") };
|
|
61
|
+
}
|
|
62
|
+
function schemaScore(schema) {
|
|
63
|
+
if (!schema || typeof schema !== "object") return 0;
|
|
64
|
+
const s = schema;
|
|
65
|
+
const t = typeof s["type"] === "string" ? s["type"] : "";
|
|
66
|
+
if (t === "object" || s["properties"] && typeof s["properties"] === "object") return 3;
|
|
67
|
+
if (t === "array" || s["items"]) return 2;
|
|
68
|
+
if (t && t !== "null") return 1;
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
function cleanSchemaForCcaLegacyParameters(schema) {
|
|
72
|
+
if (!schema || typeof schema !== "object" || Array.isArray(schema)) {
|
|
73
|
+
return { type: "object", properties: {} };
|
|
74
|
+
}
|
|
75
|
+
const s = schema;
|
|
76
|
+
const ref = s["$ref"];
|
|
77
|
+
if (typeof ref === "string" && ref) {
|
|
78
|
+
return {
|
|
79
|
+
type: "object",
|
|
80
|
+
description: appendHint(
|
|
81
|
+
typeof s["description"] === "string" ? s["description"] : void 0,
|
|
82
|
+
refHint(ref)
|
|
83
|
+
),
|
|
84
|
+
properties: {}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const alternatives = Array.isArray(s["anyOf"]) ? s["anyOf"] : Array.isArray(s["oneOf"]) ? s["oneOf"] : null;
|
|
88
|
+
if (alternatives && alternatives.length > 0) {
|
|
89
|
+
let best = alternatives[0];
|
|
90
|
+
let bestScore = -1;
|
|
91
|
+
const types = [];
|
|
92
|
+
for (const alternative of alternatives) {
|
|
93
|
+
const score = schemaScore(alternative);
|
|
94
|
+
const normalized = normalizeType(_optionalChain([alternative, 'optionalAccess', _ => _["type"]]));
|
|
95
|
+
if (normalized.type) types.push(normalized.type);
|
|
96
|
+
if (score > bestScore) {
|
|
97
|
+
bestScore = score;
|
|
98
|
+
best = alternative;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const cleaned = cleanSchemaForCcaLegacyParameters(best);
|
|
102
|
+
const typeHint2 = types.length > 1 ? `Accepts: ${[...new Set(types)].join(" || ")}` : "";
|
|
103
|
+
return {
|
|
104
|
+
...cleaned,
|
|
105
|
+
description: appendHint(
|
|
106
|
+
appendHint(cleaned.description, typeof s["description"] === "string" ? s["description"] : void 0),
|
|
107
|
+
typeHint2
|
|
108
|
+
)
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
if (Array.isArray(s["allOf"]) && s["allOf"].length > 0) {
|
|
112
|
+
const merged = {};
|
|
113
|
+
let mergedDescription = typeof s["description"] === "string" ? s["description"] : void 0;
|
|
114
|
+
const required = /* @__PURE__ */ new Set();
|
|
115
|
+
const properties = {};
|
|
116
|
+
for (const branch of s["allOf"]) {
|
|
117
|
+
const cleaned = cleanSchemaForCcaLegacyParameters(branch);
|
|
118
|
+
if (cleaned.description) mergedDescription = appendHint(mergedDescription, cleaned.description);
|
|
119
|
+
for (const key of _nullishCoalesce(cleaned.required, () => ( []))) required.add(key);
|
|
120
|
+
Object.assign(properties, _nullishCoalesce(cleaned.properties, () => ( {})));
|
|
121
|
+
if (cleaned.type && !merged.type) merged.type = cleaned.type;
|
|
122
|
+
if (cleaned.items && !merged.items) merged.items = cleaned.items;
|
|
123
|
+
if (cleaned.enum && !merged.enum) merged.enum = cleaned.enum;
|
|
124
|
+
}
|
|
125
|
+
if (Object.keys(properties).length > 0) {
|
|
126
|
+
merged.type = _nullishCoalesce(merged.type, () => ( "object"));
|
|
127
|
+
merged.properties = properties;
|
|
128
|
+
const validRequired = [...required].filter((key) => key in properties);
|
|
129
|
+
if (validRequired.length > 0) merged.required = validRequired;
|
|
130
|
+
}
|
|
131
|
+
if (mergedDescription) merged.description = mergedDescription;
|
|
132
|
+
return cleanSchemaForCcaLegacyParameters(merged);
|
|
133
|
+
}
|
|
134
|
+
const result = {};
|
|
135
|
+
const constraintHints = [];
|
|
136
|
+
if (typeof s["description"] === "string") result.description = s["description"];
|
|
137
|
+
for (const key of CONSTRAINT_KEYS) {
|
|
138
|
+
const value = s[key];
|
|
139
|
+
if (value === void 0 || value === null || typeof value === "object") continue;
|
|
140
|
+
constraintHints.push(`${key}: ${String(value)}`);
|
|
141
|
+
}
|
|
142
|
+
if (s["const"] !== void 0 && !Array.isArray(s["enum"])) {
|
|
143
|
+
result.enum = [s["const"]];
|
|
144
|
+
}
|
|
145
|
+
if (Array.isArray(s["enum"])) {
|
|
146
|
+
const values = s["enum"].filter(
|
|
147
|
+
(v) => typeof v === "string" || typeof v === "number" || typeof v === "boolean"
|
|
148
|
+
);
|
|
149
|
+
if (values.length > 0) result.enum = values;
|
|
150
|
+
if (result.enum && result.enum.length > 1 && result.enum.length <= 10) {
|
|
151
|
+
result.description = appendHint(
|
|
152
|
+
result.description,
|
|
153
|
+
`Allowed: ${result.enum.map(String).join(", ")}`
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const { type: normalizedType, hint: typeHint } = normalizeType(s["type"]);
|
|
158
|
+
if (normalizedType) result.type = normalizedType;
|
|
159
|
+
if (typeHint) result.description = appendHint(result.description, typeHint);
|
|
160
|
+
if (constraintHints.length > 0) {
|
|
161
|
+
result.description = appendHint(result.description, constraintHints.join(", "));
|
|
162
|
+
}
|
|
163
|
+
if (s["additionalProperties"] === false) {
|
|
164
|
+
result.description = appendHint(result.description, "No extra properties allowed");
|
|
165
|
+
}
|
|
166
|
+
if (s["properties"] && typeof s["properties"] === "object" && !Array.isArray(s["properties"])) {
|
|
167
|
+
const properties = {};
|
|
168
|
+
for (const [name, property] of Object.entries(s["properties"])) {
|
|
169
|
+
properties[name] = cleanSchemaForCcaLegacyParameters(property);
|
|
170
|
+
}
|
|
171
|
+
result.type = _nullishCoalesce(result.type, () => ( "object"));
|
|
172
|
+
result.properties = properties;
|
|
173
|
+
}
|
|
174
|
+
if (s["items"] !== void 0) {
|
|
175
|
+
result.type = _nullishCoalesce(result.type, () => ( "array"));
|
|
176
|
+
result.items = cleanSchemaForCcaLegacyParameters(s["items"]);
|
|
177
|
+
}
|
|
178
|
+
if (Array.isArray(s["required"]) && result.properties) {
|
|
179
|
+
const required = s["required"].filter(
|
|
180
|
+
(key) => typeof key === "string" && !!key && key in result.properties
|
|
181
|
+
);
|
|
182
|
+
if (required.length > 0) result.required = required;
|
|
183
|
+
}
|
|
184
|
+
if (!result.type) {
|
|
185
|
+
result.type = result.properties ? "object" : result.items !== void 0 ? "array" : "object";
|
|
186
|
+
}
|
|
187
|
+
if (result.type === "object" && !result.properties) {
|
|
188
|
+
result.properties = {};
|
|
189
|
+
}
|
|
190
|
+
return result;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// src/transformer/transformers/AntigravityTransformer.ts
|
|
194
|
+
var ANTIGRAVITY_FORCED_TOOL_DIRECTIVE = "TOOL-ONLY TURN. This turn accepts a tool call and nothing else; a text reply here is discarded unread and you will be re-prompted. Emit the tool call now.";
|
|
195
|
+
var ANTIGRAVITY_FORCED_TOOL_ASSET_VERSION = "2.8.0";
|
|
196
|
+
var CLAUDE_THINKING_BETA_HEADER = "interleaved-thinking-2025-05-14";
|
|
197
|
+
var forcedToolDriftLogged = false;
|
|
198
|
+
function checkForcedToolAssetDrift(currentVersion, log) {
|
|
199
|
+
if (forcedToolDriftLogged || currentVersion === ANTIGRAVITY_FORCED_TOOL_ASSET_VERSION) return;
|
|
200
|
+
forcedToolDriftLogged = true;
|
|
201
|
+
const message = `[AntigravityTransformer] UA version ${currentVersion} differs from the frozen forced-tool asset version ${ANTIGRAVITY_FORCED_TOOL_ASSET_VERSION} \u2014 review whether the upstream directive changed (the asset does not auto-follow).`;
|
|
202
|
+
(_nullishCoalesce(log, () => ( ((line) => console.warn(line)))))(message);
|
|
203
|
+
}
|
|
204
|
+
var ANTIGRAVITY_VARIANT_ROUTES = {
|
|
205
|
+
// Gemini ≥3.6 flash (google-level): minimal|low → -low, medium → -medium, high → -high.
|
|
206
|
+
"gemini-3.6-flash": {
|
|
207
|
+
default: "gemini-3.6-flash-low",
|
|
208
|
+
minimal: "gemini-3.6-flash-low",
|
|
209
|
+
low: "gemini-3.6-flash-low",
|
|
210
|
+
medium: "gemini-3.6-flash-medium",
|
|
211
|
+
high: "gemini-3.6-flash-high"
|
|
212
|
+
},
|
|
213
|
+
"gemini-3.7-flash": {
|
|
214
|
+
default: "gemini-3.7-flash-low",
|
|
215
|
+
minimal: "gemini-3.7-flash-low",
|
|
216
|
+
low: "gemini-3.7-flash-low",
|
|
217
|
+
medium: "gemini-3.7-flash-medium",
|
|
218
|
+
high: "gemini-3.7-flash-high"
|
|
219
|
+
},
|
|
220
|
+
"gemini-3.8-flash": {
|
|
221
|
+
default: "gemini-3.8-flash-low",
|
|
222
|
+
minimal: "gemini-3.8-flash-low",
|
|
223
|
+
low: "gemini-3.8-flash-low",
|
|
224
|
+
medium: "gemini-3.8-flash-medium",
|
|
225
|
+
high: "gemini-3.8-flash-high"
|
|
226
|
+
},
|
|
227
|
+
// Gemini 3.5 flash (budget transport; `gemini-3-flash` is its alias):
|
|
228
|
+
// minimal|low → extra-low, medium → -low, high → the agent id.
|
|
229
|
+
"gemini-3.5-flash": {
|
|
230
|
+
default: "gemini-3.5-flash-extra-low",
|
|
231
|
+
off: "gemini-3.5-flash-extra-low",
|
|
232
|
+
minimal: "gemini-3.5-flash-extra-low",
|
|
233
|
+
low: "gemini-3.5-flash-extra-low",
|
|
234
|
+
medium: "gemini-3.5-flash-low",
|
|
235
|
+
high: "gemini-3-flash-agent"
|
|
236
|
+
},
|
|
237
|
+
"gemini-3-flash": {
|
|
238
|
+
default: "gemini-3.5-flash-extra-low",
|
|
239
|
+
off: "gemini-3.5-flash-extra-low",
|
|
240
|
+
minimal: "gemini-3.5-flash-extra-low",
|
|
241
|
+
low: "gemini-3.5-flash-extra-low",
|
|
242
|
+
medium: "gemini-3.5-flash-low",
|
|
243
|
+
high: "gemini-3-flash-agent"
|
|
244
|
+
},
|
|
245
|
+
// Gemini 3.1 pro: low → -low, high → the pro-agent id.
|
|
246
|
+
"gemini-3.1-pro": {
|
|
247
|
+
default: "gemini-3.1-pro-low",
|
|
248
|
+
off: "gemini-3.1-pro-low",
|
|
249
|
+
low: "gemini-3.1-pro-low",
|
|
250
|
+
high: "gemini-pro-agent"
|
|
251
|
+
},
|
|
252
|
+
// Gemini 3 pro (google-level): low → -low, high → -high.
|
|
253
|
+
"gemini-3-pro": {
|
|
254
|
+
default: "gemini-3-pro-low",
|
|
255
|
+
off: "gemini-3-pro-low",
|
|
256
|
+
low: "gemini-3-pro-low",
|
|
257
|
+
high: "gemini-3-pro-high"
|
|
258
|
+
},
|
|
259
|
+
// gpt-oss 120b: every effort level rides the -medium wire id.
|
|
260
|
+
"gpt-oss-120b": {
|
|
261
|
+
default: "gpt-oss-120b-medium",
|
|
262
|
+
minimal: "gpt-oss-120b-medium",
|
|
263
|
+
low: "gpt-oss-120b-medium",
|
|
264
|
+
medium: "gpt-oss-120b-medium",
|
|
265
|
+
high: "gpt-oss-120b-medium"
|
|
266
|
+
},
|
|
267
|
+
// Claude 4.5: thinking is a separate wire id; off rides the base id.
|
|
268
|
+
"claude-opus-4-5": {
|
|
269
|
+
off: "claude-opus-4-5",
|
|
270
|
+
minimal: "claude-opus-4-5-thinking",
|
|
271
|
+
low: "claude-opus-4-5-thinking",
|
|
272
|
+
medium: "claude-opus-4-5-thinking",
|
|
273
|
+
high: "claude-opus-4-5-thinking"
|
|
274
|
+
},
|
|
275
|
+
"claude-sonnet-4-5": {
|
|
276
|
+
off: "claude-sonnet-4-5",
|
|
277
|
+
minimal: "claude-sonnet-4-5-thinking",
|
|
278
|
+
low: "claude-sonnet-4-5-thinking",
|
|
279
|
+
medium: "claude-sonnet-4-5-thinking",
|
|
280
|
+
high: "claude-sonnet-4-5-thinking"
|
|
281
|
+
},
|
|
282
|
+
// Claude opus 4.6: the BASE id is retired upstream — every request (off or
|
|
283
|
+
// not) rides the thinking wire id.
|
|
284
|
+
"claude-opus-4-6": {
|
|
285
|
+
default: "claude-opus-4-6-thinking",
|
|
286
|
+
off: "claude-opus-4-6-thinking",
|
|
287
|
+
minimal: "claude-opus-4-6-thinking",
|
|
288
|
+
low: "claude-opus-4-6-thinking",
|
|
289
|
+
medium: "claude-opus-4-6-thinking",
|
|
290
|
+
high: "claude-opus-4-6-thinking"
|
|
291
|
+
},
|
|
292
|
+
// Claude sonnet 4.6: the THINKING variant is retired upstream — always base.
|
|
293
|
+
"claude-sonnet-4-6": {
|
|
294
|
+
default: "claude-sonnet-4-6"
|
|
295
|
+
},
|
|
296
|
+
// Gemini 2.5 flash/lite: thinking rides the -thinking wire id.
|
|
297
|
+
"gemini-2.5-flash": {
|
|
298
|
+
off: "gemini-2.5-flash",
|
|
299
|
+
minimal: "gemini-2.5-flash-thinking",
|
|
300
|
+
low: "gemini-2.5-flash-thinking",
|
|
301
|
+
medium: "gemini-2.5-flash-thinking",
|
|
302
|
+
high: "gemini-2.5-flash-thinking"
|
|
303
|
+
},
|
|
304
|
+
"gemini-2.5-flash-lite": {
|
|
305
|
+
off: "gemini-2.5-flash-lite",
|
|
306
|
+
minimal: "gemini-2.5-flash-lite-thinking",
|
|
307
|
+
low: "gemini-2.5-flash-lite-thinking",
|
|
308
|
+
medium: "gemini-2.5-flash-lite-thinking",
|
|
309
|
+
high: "gemini-2.5-flash-lite-thinking"
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
function resolveAntigravityWireModelId(logicalModelId, request, provider) {
|
|
313
|
+
const routes = ANTIGRAVITY_VARIANT_ROUTES[logicalModelId];
|
|
314
|
+
const intent = _chunkIUL4VWNUcjs.extractReasoningIntent.call(void 0, { model: logicalModelId, reasoning: request.reasoning });
|
|
315
|
+
const capabilities = _chunkIUL4VWNUcjs.resolveTargetModelCapabilities.call(void 0, logicalModelId, provider);
|
|
316
|
+
const reasoningCapable = !!_optionalChain([capabilities, 'access', _2 => _2.thinkingLevels, 'optionalAccess', _3 => _3.some, 'call', _4 => _4((level) => level !== "none")]) || capabilities.reasoning === true;
|
|
317
|
+
if (!routes || !_optionalChain([intent, 'optionalAccess', _5 => _5.effort])) {
|
|
318
|
+
return { wireModelId: _nullishCoalesce(_optionalChain([routes, 'optionalAccess', _6 => _6.default]), () => ( logicalModelId)), variantEngaged: false, effort: _optionalChain([intent, 'optionalAccess', _7 => _7.effort]) };
|
|
319
|
+
}
|
|
320
|
+
const effort = intent.effort === "none" ? "none" : reasoningCapable ? _chunkIUL4VWNUcjs.resolveReasoningEffort.call(void 0, intent.effort, logicalModelId, provider) : "none";
|
|
321
|
+
if (effort === "none") {
|
|
322
|
+
return { wireModelId: _nullishCoalesce(_nullishCoalesce(routes.off, () => ( routes.default)), () => ( logicalModelId)), variantEngaged: true, effort };
|
|
323
|
+
}
|
|
324
|
+
const routed = routes[effort];
|
|
325
|
+
if (routed) {
|
|
326
|
+
return { wireModelId: routed, variantEngaged: true, effort };
|
|
327
|
+
}
|
|
328
|
+
return { wireModelId: _nullishCoalesce(routes.default, () => ( logicalModelId)), variantEngaged: false, effort };
|
|
329
|
+
}
|
|
330
|
+
var ANTIGRAVITY_ENDPOINT = _chunkNDIBVTBZcjs.ANTIGRAVITY_CODE_ASSIST_ENDPOINT;
|
|
331
|
+
function buildAntigravityUrl(stream, base = ANTIGRAVITY_ENDPOINT) {
|
|
332
|
+
return _chunkN3MGNLCUcjs.buildCcaMethodUrl.call(void 0, base, "v1internal", stream);
|
|
333
|
+
}
|
|
334
|
+
var INT63_MASK = (1n << 63n) - 1n;
|
|
335
|
+
function deriveAntigravitySessionId(text) {
|
|
336
|
+
const digest = _crypto.createHash.call(void 0, "sha256").update(text).digest();
|
|
337
|
+
let value = 0n;
|
|
338
|
+
for (let index = 0; index < 8; index += 1) {
|
|
339
|
+
value = value << 8n | BigInt(_nullishCoalesce(digest[index], () => ( 0)));
|
|
340
|
+
}
|
|
341
|
+
return `-${(value & INT63_MASK).toString()}`;
|
|
342
|
+
}
|
|
343
|
+
function firstUserText(request) {
|
|
344
|
+
for (const message of request.messages) {
|
|
345
|
+
if (message.role !== "user") continue;
|
|
346
|
+
if (typeof message.content === "string") return message.content;
|
|
347
|
+
if (Array.isArray(message.content)) {
|
|
348
|
+
const firstText = message.content.find((part) => part.type === "text");
|
|
349
|
+
return _optionalChain([firstText, 'optionalAccess', _8 => _8.text]);
|
|
350
|
+
}
|
|
351
|
+
return void 0;
|
|
352
|
+
}
|
|
353
|
+
return void 0;
|
|
354
|
+
}
|
|
355
|
+
var AntigravityTransformer = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }
|
|
356
|
+
static __initStatic() {this.TransformerName = "antigravity"}
|
|
357
|
+
__init() {this.name = "antigravity"}
|
|
358
|
+
|
|
359
|
+
/** The URL is built per-request (colon-method, no fixed endpoint pattern). */
|
|
360
|
+
__init2() {this.endPoint = void 0}
|
|
361
|
+
async transformRequestIn(request, provider, _context) {
|
|
362
|
+
void _chunkE5RCCGE7cjs.ensureAntigravityVersion.call(void 0, ).catch(() => void 0);
|
|
363
|
+
checkForcedToolAssetDrift(_chunkE5RCCGE7cjs.getAntigravityVersion.call(void 0, ), _optionalChain([this, 'access', _9 => _9.logger, 'optionalAccess', _10 => _10.warn, 'optionalAccess', _11 => _11.bind, 'call', _12 => _12(this.logger)]));
|
|
364
|
+
const family = _nullishCoalesce(_chunkKSMK45RDcjs.antigravityModelFamily.call(void 0, request.model), () => ( "gemini"));
|
|
365
|
+
const { wireModelId, variantEngaged } = resolveAntigravityWireModelId(request.model, request, provider);
|
|
366
|
+
const inner = _chunk4NAMH4UEcjs.buildRequestBody.call(void 0, { ...request, model: wireModelId }, provider);
|
|
367
|
+
const generationConfig = { ..._nullishCoalesce(inner["generationConfig"], () => ( {})) };
|
|
368
|
+
if (variantEngaged) {
|
|
369
|
+
delete generationConfig["thinkingConfig"];
|
|
370
|
+
}
|
|
371
|
+
const profile = _chunkE5RCCGE7cjs.getAntigravityModelWireProfile.call(void 0, wireModelId);
|
|
372
|
+
if (profile) {
|
|
373
|
+
generationConfig["maxOutputTokens"] = profile.maxOutputTokens;
|
|
374
|
+
}
|
|
375
|
+
const tools = inner["tools"];
|
|
376
|
+
const decoratedTools = family === "claude" && tools ? tools.map((tool) => legacyParametersTool(tool)) : tools;
|
|
377
|
+
const contents = inner["contents"];
|
|
378
|
+
let toolConfig = inner["toolConfig"];
|
|
379
|
+
let forcedToolInjected = false;
|
|
380
|
+
const hasTools = !!_optionalChain([decoratedTools, 'optionalAccess', _13 => _13.some, 'call', _14 => _14((tool) => (_nullishCoalesce(_optionalChain([tool, 'access', _15 => _15.functionDeclarations, 'optionalAccess', _16 => _16.length]), () => ( 0))) > 0)]);
|
|
381
|
+
if (_optionalChain([toolConfig, 'optionalAccess', _17 => _17.functionCallingConfig, 'access', _18 => _18.mode]) === "none") {
|
|
382
|
+
toolConfig = { functionCallingConfig: { mode: "NONE" } };
|
|
383
|
+
} else if (_optionalChain([toolConfig, 'optionalAccess', _19 => _19.functionCallingConfig, 'access', _20 => _20.mode]) === "any") {
|
|
384
|
+
toolConfig = {
|
|
385
|
+
functionCallingConfig: {
|
|
386
|
+
mode: "ANY",
|
|
387
|
+
...toolConfig.functionCallingConfig.allowedFunctionNames ? { allowedFunctionNames: toolConfig.functionCallingConfig.allowedFunctionNames } : {}
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
if (family !== "claude") {
|
|
391
|
+
contents.push({ role: "user", parts: [{ text: ANTIGRAVITY_FORCED_TOOL_DIRECTIVE }] });
|
|
392
|
+
forcedToolInjected = true;
|
|
393
|
+
}
|
|
394
|
+
} else if (hasTools || family === "claude") {
|
|
395
|
+
toolConfig = { functionCallingConfig: { mode: "VALIDATED" } };
|
|
396
|
+
} else {
|
|
397
|
+
toolConfig = void 0;
|
|
398
|
+
}
|
|
399
|
+
void forcedToolInjected;
|
|
400
|
+
const anchor = firstUserText(request);
|
|
401
|
+
const sessionId = anchor && anchor.trim().length > 0 ? deriveAntigravitySessionId(anchor) : `-${Date.now()}`;
|
|
402
|
+
const trajectoryId = _crypto.randomUUID.call(void 0, );
|
|
403
|
+
const step = request.messages.filter((message) => message.role === "assistant").length + 2;
|
|
404
|
+
const requestId = `agent/${_crypto.randomUUID.call(void 0, )}/${Date.now()}/${trajectoryId}/${step}`;
|
|
405
|
+
const labels = {
|
|
406
|
+
last_step_index: String(step - 1),
|
|
407
|
+
// Anthropic ids carry no model_enum token (the backend does not require it).
|
|
408
|
+
...family !== "claude" && _optionalChain([profile, 'optionalAccess', _21 => _21.modelEnum]) !== void 0 ? { model_enum: profile.modelEnum } : {},
|
|
409
|
+
trajectory_id: trajectoryId,
|
|
410
|
+
used_claude: String(family === "claude"),
|
|
411
|
+
used_claude_conservative: String(family === "claude")
|
|
412
|
+
};
|
|
413
|
+
const innerRequest = {
|
|
414
|
+
...inner,
|
|
415
|
+
contents,
|
|
416
|
+
...decoratedTools ? { tools: decoratedTools } : {},
|
|
417
|
+
...toolConfig ? { toolConfig } : {},
|
|
418
|
+
...Object.keys(generationConfig).length > 0 ? { generationConfig } : {},
|
|
419
|
+
sessionId,
|
|
420
|
+
labels
|
|
421
|
+
};
|
|
422
|
+
const envelope = {
|
|
423
|
+
project: provider.geminiProject,
|
|
424
|
+
requestId,
|
|
425
|
+
model: wireModelId,
|
|
426
|
+
userAgent: "antigravity",
|
|
427
|
+
requestType: "agent",
|
|
428
|
+
request: innerRequest
|
|
429
|
+
};
|
|
430
|
+
const url = buildAntigravityUrl(Boolean(request.stream));
|
|
431
|
+
const headers = {
|
|
432
|
+
"x-goog-api-key": void 0,
|
|
433
|
+
"X-Goog-Api-Key": void 0,
|
|
434
|
+
"User-Agent": _chunkE5RCCGE7cjs.getAntigravityUserAgent.call(void 0, ),
|
|
435
|
+
// Claude thinking models ride the interleaved-thinking beta (the CCA
|
|
436
|
+
// backend needs it to return thinking blocks for Anthropic ids).
|
|
437
|
+
...family === "claude" ? { "anthropic-beta": CLAUDE_THINKING_BETA_HEADER } : {}
|
|
438
|
+
};
|
|
439
|
+
return {
|
|
440
|
+
body: envelope,
|
|
441
|
+
config: { url, headers }
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
/** antigravity request → unified (endpoint-decode parity with the gemini one). */
|
|
445
|
+
async transformRequestOut(request, _context) {
|
|
446
|
+
const r = request;
|
|
447
|
+
const inner = r && typeof r === "object" && "request" in r ? r.request : r;
|
|
448
|
+
if (inner && typeof inner === "object" && !("model" in inner) && "model" in r) {
|
|
449
|
+
inner.model = r.model;
|
|
450
|
+
}
|
|
451
|
+
return _chunk4NAMH4UEcjs.transformRequestOut.call(void 0, inner);
|
|
452
|
+
}
|
|
453
|
+
/** antigravity response → OpenAI-compatible: peel `.response`, delegate. */
|
|
454
|
+
async transformResponseOut(response, _context) {
|
|
455
|
+
const unwrapped = await _chunkN3MGNLCUcjs.unwrapCcaResponse.call(void 0, response);
|
|
456
|
+
return _chunk4NAMH4UEcjs.transformResponseOut.call(void 0, unwrapped, this.name, this.logger);
|
|
457
|
+
}
|
|
458
|
+
}, _class.__initStatic(), _class);
|
|
459
|
+
function legacyParametersTool(tool) {
|
|
460
|
+
if (!tool.functionDeclarations) return tool;
|
|
461
|
+
return {
|
|
462
|
+
functionDeclarations: tool.functionDeclarations.map((declaration) => {
|
|
463
|
+
if ("parameters" in declaration) return declaration;
|
|
464
|
+
const { parametersJsonSchema, ...rest } = declaration;
|
|
465
|
+
return {
|
|
466
|
+
...rest,
|
|
467
|
+
parameters: cleanSchemaForCcaLegacyParameters(parametersJsonSchema)
|
|
468
|
+
};
|
|
469
|
+
})
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
exports.ANTIGRAVITY_FORCED_TOOL_DIRECTIVE = ANTIGRAVITY_FORCED_TOOL_DIRECTIVE; exports.ANTIGRAVITY_FORCED_TOOL_ASSET_VERSION = ANTIGRAVITY_FORCED_TOOL_ASSET_VERSION; exports.checkForcedToolAssetDrift = checkForcedToolAssetDrift; exports.resolveAntigravityWireModelId = resolveAntigravityWireModelId; exports.ANTIGRAVITY_ENDPOINT = ANTIGRAVITY_ENDPOINT; exports.buildAntigravityUrl = buildAntigravityUrl; exports.deriveAntigravitySessionId = deriveAntigravitySessionId; exports.AntigravityTransformer = AntigravityTransformer;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// src/pipeline/antigravityQuotaFamily.ts
|
|
2
|
+
var ANTIGRAVITY_COUNTER_TO_MODEL_FAMILY = {
|
|
3
|
+
google: "gemini",
|
|
4
|
+
anthropic: "claude",
|
|
5
|
+
openai: "gpt-oss"
|
|
6
|
+
};
|
|
7
|
+
var ANTIGRAVITY_MODEL_TO_COUNTER_FAMILY = {
|
|
8
|
+
gemini: "google",
|
|
9
|
+
claude: "anthropic",
|
|
10
|
+
"gpt-oss": "openai"
|
|
11
|
+
};
|
|
12
|
+
var ANTIGRAVITY_COUNTER_FAMILY_KEYS = [
|
|
13
|
+
"google",
|
|
14
|
+
"anthropic",
|
|
15
|
+
"openai"
|
|
16
|
+
];
|
|
17
|
+
function antigravityModelFamily(modelId) {
|
|
18
|
+
if (!modelId) return void 0;
|
|
19
|
+
if (modelId.startsWith("claude-")) return "claude";
|
|
20
|
+
if (modelId.startsWith("gpt-oss-")) return "gpt-oss";
|
|
21
|
+
if (modelId.startsWith("gemini-") || modelId.startsWith("tab_")) return "gemini";
|
|
22
|
+
return void 0;
|
|
23
|
+
}
|
|
24
|
+
function antigravityCounterFamilyForModel(modelId) {
|
|
25
|
+
const family = antigravityModelFamily(modelId);
|
|
26
|
+
return family ? ANTIGRAVITY_MODEL_TO_COUNTER_FAMILY[family] : void 0;
|
|
27
|
+
}
|
|
28
|
+
function antigravityCounterFamiliesForBucketId(bucketId, groupName) {
|
|
29
|
+
const bucket = (bucketId ?? "").toLowerCase();
|
|
30
|
+
const group = (groupName ?? "").toLowerCase();
|
|
31
|
+
if (bucket.startsWith("gemini-") || group.includes("gemini")) return ["google"];
|
|
32
|
+
if (bucket.startsWith("3p-") || group.includes("claude") || group.includes("gpt") || group.includes("third party")) {
|
|
33
|
+
return ["anthropic", "openai"];
|
|
34
|
+
}
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
ANTIGRAVITY_COUNTER_TO_MODEL_FAMILY,
|
|
40
|
+
ANTIGRAVITY_MODEL_TO_COUNTER_FAMILY,
|
|
41
|
+
ANTIGRAVITY_COUNTER_FAMILY_KEYS,
|
|
42
|
+
antigravityModelFamily,
|
|
43
|
+
antigravityCounterFamilyForModel,
|
|
44
|
+
antigravityCounterFamiliesForBucketId
|
|
45
|
+
};
|
|
@@ -246,6 +246,13 @@ async function transformResponseIn(response, logger) {
|
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
// src/transformer/transformers/utils/gemini.stream.ts
|
|
249
|
+
function inlineDataToDataUrl(part) {
|
|
250
|
+
const inline = part.inlineData ?? part.inline_data;
|
|
251
|
+
const data = inline?.data;
|
|
252
|
+
if (typeof data !== "string" || !data) return null;
|
|
253
|
+
const mime = inline?.mimeType ?? inline?.mime_type ?? "image/png";
|
|
254
|
+
return `data:${mime};base64,${data}`;
|
|
255
|
+
}
|
|
249
256
|
async function transformResponseOut(response, providerName, logger) {
|
|
250
257
|
const contentType = response.headers.get("Content-Type") ?? "";
|
|
251
258
|
if (contentType.includes("application/json")) {
|
|
@@ -279,6 +286,7 @@ async function handleJsonResponse(response, providerName, logger) {
|
|
|
279
286
|
}
|
|
280
287
|
}));
|
|
281
288
|
const textContent = nonThinkingParts.filter((part) => part.text).map((part) => part.text).join("\n");
|
|
289
|
+
const images = nonThinkingParts.map((part) => inlineDataToDataUrl(part)).filter((url) => url !== null);
|
|
282
290
|
const openAIResponse = {
|
|
283
291
|
id: jsonResponse.responseId ?? "",
|
|
284
292
|
choices: [
|
|
@@ -288,6 +296,7 @@ async function handleJsonResponse(response, providerName, logger) {
|
|
|
288
296
|
message: {
|
|
289
297
|
content: textContent,
|
|
290
298
|
role: "assistant",
|
|
299
|
+
images: images.length > 0 ? images : void 0,
|
|
291
300
|
tool_calls: toolCalls.length > 0 ? toolCalls : void 0,
|
|
292
301
|
...thinkingSignature && {
|
|
293
302
|
thinking: {
|
|
@@ -445,6 +454,7 @@ function handleStreamResponse(response, providerName, logger) {
|
|
|
445
454
|
signatureSent = true;
|
|
446
455
|
}
|
|
447
456
|
}
|
|
457
|
+
const images = parts.map((part) => inlineDataToDataUrl(part)).filter((url) => url !== null);
|
|
448
458
|
if (textContent && !textBuffered) {
|
|
449
459
|
if (!pendingContent) contentIndex++;
|
|
450
460
|
const contentChunk = createChunk({
|
|
@@ -458,6 +468,21 @@ function handleStreamResponse(response, providerName, logger) {
|
|
|
458
468
|
});
|
|
459
469
|
controller.enqueue(encoder.encode(`data: ${JSON.stringify(contentChunk)}
|
|
460
470
|
|
|
471
|
+
`));
|
|
472
|
+
contentSent = true;
|
|
473
|
+
}
|
|
474
|
+
if (images.length > 0) {
|
|
475
|
+
const imageChunk = createChunk({
|
|
476
|
+
responseId: chunk.responseId,
|
|
477
|
+
modelVersion: chunk.modelVersion,
|
|
478
|
+
contentIndex,
|
|
479
|
+
delta: { role: "assistant", images },
|
|
480
|
+
finishReason: candidate.finishReason,
|
|
481
|
+
usageMetadata: chunk.usageMetadata,
|
|
482
|
+
groundingMetadata: candidate.groundingMetadata
|
|
483
|
+
});
|
|
484
|
+
controller.enqueue(encoder.encode(`data: ${JSON.stringify(imageChunk)}
|
|
485
|
+
|
|
461
486
|
`));
|
|
462
487
|
contentSent = true;
|
|
463
488
|
}
|
|
@@ -832,6 +857,9 @@ function buildRequestBody(request, provider, preserveNativeEffort = false) {
|
|
|
832
857
|
thinkingBudget: reasoningPlan.budgetTokens
|
|
833
858
|
};
|
|
834
859
|
}
|
|
860
|
+
if (!generationConfig.responseModalities && typeof request.model === "string" && request.model.startsWith("gemini") && request.model.includes("-image")) {
|
|
861
|
+
generationConfig.responseModalities = ["TEXT", "IMAGE"];
|
|
862
|
+
}
|
|
835
863
|
const body = {
|
|
836
864
|
contents,
|
|
837
865
|
tools: tools.length > 0 ? tools : void 0,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
serializeError
|
|
3
3
|
} from "./chunk-AVYJ4YBN.js";
|
|
4
|
-
import {
|
|
5
|
-
isAccountAllowanceExhaustedError
|
|
6
|
-
} from "./chunk-C3NPMQTK.js";
|
|
7
4
|
import {
|
|
8
5
|
isBoundAccountSelectionError
|
|
9
6
|
} from "./chunk-2JYRIADS.js";
|
|
7
|
+
import {
|
|
8
|
+
isAccountAllowanceExhaustedError
|
|
9
|
+
} from "./chunk-JHJRZ75C.js";
|
|
10
10
|
|
|
11
11
|
// src/pipeline/SubscriptionAuthSource.ts
|
|
12
12
|
function stripAuthHeaders(headers) {
|
|
@@ -39,6 +39,7 @@ var SubscriptionAuthSource = class {
|
|
|
39
39
|
upstreamUrl: hints.upstreamUrl,
|
|
40
40
|
resolvedModel: hints.model,
|
|
41
41
|
sessionKey: hints.sessionKey,
|
|
42
|
+
callerOpenCodeSession: hints.callerOpenCodeSession,
|
|
42
43
|
reportSelection: hints.reportSelection,
|
|
43
44
|
preferredAccountId: hints.preferredAccountId,
|
|
44
45
|
preferredAccountGroup: hints.preferredAccountGroup,
|