pi-provider-antigravity 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +43 -14
- package/dist/index.js.map +2 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var PROVIDER_ID = "antigravity";
|
|
|
6
6
|
var PROVIDER_NAME = "Antigravity";
|
|
7
7
|
var DEFAULT_HOST = "daily-cloudcode-pa.googleapis.com";
|
|
8
8
|
var DEFAULT_ENDPOINT = `https://${DEFAULT_HOST}`;
|
|
9
|
-
var DEFAULT_USER_AGENT = "antigravity/cli/1.2.
|
|
9
|
+
var DEFAULT_USER_AGENT = "antigravity/cli/1.2.16 (aidev_client; os_type=linux; arch=amd64; cl=992658124; auth_method=consumer)";
|
|
10
10
|
var FALLBACK_PROJECT_ID = "aicode-consumers";
|
|
11
11
|
|
|
12
12
|
// src/auth.ts
|
|
@@ -392,12 +392,16 @@ var PRIVATE_SNAPSHOT_KEY = "pi-provider-antigravity";
|
|
|
392
392
|
var CANONICAL_TIER_SUFFIXES = Object.freeze({
|
|
393
393
|
low: "-low",
|
|
394
394
|
medium: "-medium",
|
|
395
|
-
high: "-high"
|
|
395
|
+
high: "-high",
|
|
396
|
+
xhigh: "-xhigh",
|
|
397
|
+
max: "-max"
|
|
396
398
|
});
|
|
397
399
|
var TIER_ALIASES = Object.freeze({
|
|
398
400
|
low: Object.freeze(["-extra-low"]),
|
|
399
401
|
medium: Object.freeze([]),
|
|
400
|
-
high: Object.freeze(["-thinking", "-agent"])
|
|
402
|
+
high: Object.freeze(["-thinking", "-agent"]),
|
|
403
|
+
xhigh: Object.freeze([]),
|
|
404
|
+
max: Object.freeze([])
|
|
401
405
|
});
|
|
402
406
|
var SPECIAL_TIER_SUFFIXES = Object.freeze(["-tiered"]);
|
|
403
407
|
var ALL_TIER_SUFFIXES = Object.freeze([
|
|
@@ -425,7 +429,8 @@ var TIER_FALLBACKS = Object.freeze({
|
|
|
425
429
|
// Gemini 3.1 Pro lists no -medium: up to high, never down
|
|
426
430
|
high: Object.freeze(["-thinking", "-agent", ""]),
|
|
427
431
|
// Claude's high tier is -thinking
|
|
428
|
-
xhigh: Object.freeze(["-high", "-thinking", "-agent", ""]),
|
|
432
|
+
xhigh: Object.freeze(["-max", "-high", "-thinking", "-agent", ""]),
|
|
433
|
+
// up to max, never down
|
|
429
434
|
max: Object.freeze(["-high", "-thinking", "-agent", ""])
|
|
430
435
|
});
|
|
431
436
|
var DEFAULT_TIER_ORDER = Object.freeze([
|
|
@@ -583,9 +588,21 @@ function followRenames(runtimeModelId, snapshot) {
|
|
|
583
588
|
}
|
|
584
589
|
return current;
|
|
585
590
|
}
|
|
591
|
+
function thinkingLevelFor(runtimeModelId) {
|
|
592
|
+
for (const tier of Object.keys(CANONICAL_TIER_SUFFIXES)) {
|
|
593
|
+
if (tierSpellings(tier).some((suffix) => runtimeModelId.endsWith(suffix))) {
|
|
594
|
+
return tier.toUpperCase();
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
return void 0;
|
|
598
|
+
}
|
|
586
599
|
function resolveThinkingConfig(runtimeModelId, snapshot) {
|
|
587
600
|
const budget = snapshot.thinking[runtimeModelId]?.budget;
|
|
588
|
-
|
|
601
|
+
if (typeof budget === "number") {
|
|
602
|
+
return { includeThoughts: true, thinkingBudget: budget };
|
|
603
|
+
}
|
|
604
|
+
const thinkingLevel = thinkingLevelFor(runtimeModelId);
|
|
605
|
+
return thinkingLevel ? { includeThoughts: true, thinkingBudget: 0, thinkingLevel } : { includeThoughts: false, thinkingBudget: 0 };
|
|
589
606
|
}
|
|
590
607
|
function resolveModelPlan(publicModelId, effort, snapshot) {
|
|
591
608
|
const runtimeModelId = followRenames(
|
|
@@ -631,7 +648,9 @@ function synthesizeDynamicModel(baseId, items) {
|
|
|
631
648
|
minimal: null,
|
|
632
649
|
...hasVariant(tierSpellings("low")) ? {} : { low: null },
|
|
633
650
|
...hasVariant(tierSpellings("medium")) ? {} : { medium: null },
|
|
634
|
-
...hasVariant(tierSpellings("high")) || items.some((it) => it.id === baseId) ? {} : { high: null }
|
|
651
|
+
...hasVariant(tierSpellings("high")) || items.some((it) => it.id === baseId) ? {} : { high: null },
|
|
652
|
+
...hasVariant(tierSpellings("xhigh")) ? { xhigh: "xhigh" } : {},
|
|
653
|
+
...hasVariant(tierSpellings("max")) ? { max: "max" } : {}
|
|
635
654
|
};
|
|
636
655
|
const profile = getModelProfile(baseId);
|
|
637
656
|
const defaultContext = profile.defaultContextWindow;
|
|
@@ -1534,13 +1553,19 @@ function deriveSessionId(conversation, explicitSessionId) {
|
|
|
1534
1553
|
const hex = [...hash].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1535
1554
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
1536
1555
|
}
|
|
1537
|
-
function
|
|
1538
|
-
const bytes = createHash2("sha1").update(
|
|
1556
|
+
function v5Uuid(seed) {
|
|
1557
|
+
const bytes = createHash2("sha1").update(seed).digest().subarray(0, 16);
|
|
1539
1558
|
bytes[6] = bytes[6] & 15 | 80;
|
|
1540
1559
|
bytes[8] = bytes[8] & 63 | 128;
|
|
1541
1560
|
const hex = [...bytes].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1542
1561
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
1543
1562
|
}
|
|
1563
|
+
function resolveSessionTrajectory(sessionId) {
|
|
1564
|
+
return v5Uuid(`antigravity:${sessionId}`);
|
|
1565
|
+
}
|
|
1566
|
+
function resolveSessionCascade(sessionId) {
|
|
1567
|
+
return v5Uuid(`antigravity:cascade:${sessionId}`);
|
|
1568
|
+
}
|
|
1544
1569
|
var DEFAULT_SESSION_ID = "-3750763034362895579";
|
|
1545
1570
|
function resolveNumericSessionId(sessionId) {
|
|
1546
1571
|
if (/^-?\d+$/.test(sessionId)) {
|
|
@@ -1652,6 +1677,7 @@ function translateTurnTrace(conversation, runtimeModelId) {
|
|
|
1652
1677
|
const isSameModel = runtimeProfile.isReplayCompatible(msg.model);
|
|
1653
1678
|
const isSameProviderAndModel = isSameProvider && isSameModel;
|
|
1654
1679
|
const parts = [];
|
|
1680
|
+
const isToolTurn = Array.isArray(msg.content) && msg.content.some((item) => item.type === "tool_use" || item.type === "toolCall");
|
|
1655
1681
|
let pendingThinkingSig;
|
|
1656
1682
|
if (typeof msg.content === "string") {
|
|
1657
1683
|
parts.push({ text: msg.content });
|
|
@@ -1677,15 +1703,13 @@ function translateTurnTrace(conversation, runtimeModelId) {
|
|
|
1677
1703
|
const isForeignReasoning = !isSameProviderAndModel || typeof candidateSig === "string" && candidateSig.trim().startsWith("{");
|
|
1678
1704
|
if (isGptRequest && !isForeignReasoning) continue;
|
|
1679
1705
|
if (!isForeignReasoning) {
|
|
1680
|
-
const part = {
|
|
1681
|
-
thought: true,
|
|
1682
|
-
text: item.thinking || ""
|
|
1683
|
-
};
|
|
1684
1706
|
const sig = resolveThoughtSignature(true, candidateSig);
|
|
1685
1707
|
if (sig) {
|
|
1686
1708
|
pendingThinkingSig = sig;
|
|
1687
1709
|
}
|
|
1688
|
-
|
|
1710
|
+
if (!isToolTurn) {
|
|
1711
|
+
parts.push({ thought: true, text: item.thinking || "" });
|
|
1712
|
+
}
|
|
1689
1713
|
} else {
|
|
1690
1714
|
let text = item.thinking || "";
|
|
1691
1715
|
if (!text && typeof candidateSig === "string" && candidateSig.trim().startsWith("{")) {
|
|
@@ -1815,17 +1839,22 @@ function buildAntigravityRequestBody(params) {
|
|
|
1815
1839
|
const tools = convertTools(getCurrentTools(transcript.messages));
|
|
1816
1840
|
const conversation = withoutInitialSystemMessage(transcript.messages);
|
|
1817
1841
|
const sessionId = deriveSessionId(conversation, params.sessionId);
|
|
1842
|
+
const cascadeId = resolveSessionCascade(sessionId);
|
|
1818
1843
|
const trajectoryId = params.trajectoryId && typeof params.trajectoryId === "string" && params.trajectoryId.trim().length > 0 ? params.trajectoryId.trim() : resolveSessionTrajectory(sessionId);
|
|
1819
1844
|
const contents = translateTurnTrace(conversation, runtimeModelId);
|
|
1820
1845
|
const requestIndex = contents.filter(
|
|
1821
1846
|
(c) => c.role === "model" && !c.parts?.some((p) => p.functionResponse)
|
|
1822
1847
|
).length;
|
|
1823
|
-
const requestId = `agent/${
|
|
1848
|
+
const requestId = `agent/${cascadeId}/${Date.now()}/${trajectoryId}/${contents.length}`;
|
|
1824
1849
|
const modelEnum = plan.modelEnum;
|
|
1825
1850
|
const labels = {
|
|
1851
|
+
// agy names the conversation twice on 1.2.16 (cascade_id and its root) and the
|
|
1852
|
+
// per-turn trajectory once; the root is the same cascade for a plain session.
|
|
1853
|
+
cascade_id: cascadeId,
|
|
1826
1854
|
last_step_index: String(Math.max(0, contents.length - 1)),
|
|
1827
1855
|
model_enum: modelEnum,
|
|
1828
1856
|
request_id: `${trajectoryId}-${requestIndex}`,
|
|
1857
|
+
root_cascade_id: cascadeId,
|
|
1829
1858
|
trajectory_id: trajectoryId,
|
|
1830
1859
|
used_claude: String(plan.isClaude),
|
|
1831
1860
|
used_claude_conservative: String(plan.isClaude),
|