@expiren/opencode-antigravity-auth 1.6.3 → 1.6.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/dist/index.js +80 -44
- package/dist/index.js.map +2 -2
- package/dist/src/plugin/config/models.d.ts +6 -0
- package/dist/src/plugin/config/models.d.ts.map +1 -1
- package/dist/src/plugin/config/models.js +44 -22
- package/dist/src/plugin/config/models.js.map +1 -1
- package/dist/src/plugin/storage.d.ts.map +1 -1
- package/dist/src/plugin/storage.js +50 -29
- package/dist/src/plugin/storage.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -671,6 +671,40 @@ async function loadAccounts() {
|
|
|
671
671
|
return null;
|
|
672
672
|
}
|
|
673
673
|
}
|
|
674
|
+
async function atomicWriteFile(targetPath, content) {
|
|
675
|
+
const tempPath = `${targetPath}.${randomBytes(6).toString("hex")}.tmp`;
|
|
676
|
+
await fs.writeFile(tempPath, content, { encoding: "utf-8", mode: 384 });
|
|
677
|
+
const RETRY_DELAYS = [50, 100, 200];
|
|
678
|
+
let lastError;
|
|
679
|
+
for (let attempt = 0; attempt <= RETRY_DELAYS.length; attempt++) {
|
|
680
|
+
try {
|
|
681
|
+
await fs.rename(tempPath, targetPath);
|
|
682
|
+
return;
|
|
683
|
+
} catch (error) {
|
|
684
|
+
lastError = error;
|
|
685
|
+
const code = error.code;
|
|
686
|
+
if (code !== "EPERM" && code !== "EACCES") {
|
|
687
|
+
break;
|
|
688
|
+
}
|
|
689
|
+
if (attempt < RETRY_DELAYS.length) {
|
|
690
|
+
await new Promise((r) => setTimeout(r, RETRY_DELAYS[attempt]));
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
try {
|
|
695
|
+
await fs.copyFile(tempPath, targetPath);
|
|
696
|
+
try {
|
|
697
|
+
await fs.unlink(tempPath);
|
|
698
|
+
} catch {
|
|
699
|
+
}
|
|
700
|
+
} catch {
|
|
701
|
+
try {
|
|
702
|
+
await fs.unlink(tempPath);
|
|
703
|
+
} catch {
|
|
704
|
+
}
|
|
705
|
+
throw lastError;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
674
708
|
async function saveAccounts(storage) {
|
|
675
709
|
const path5 = getStoragePath();
|
|
676
710
|
const configDir = dirname(path5);
|
|
@@ -679,18 +713,8 @@ async function saveAccounts(storage) {
|
|
|
679
713
|
await withFileLock(path5, async () => {
|
|
680
714
|
const existing = await loadAccountsUnsafe();
|
|
681
715
|
const merged = existing ? mergeAccountStorage(existing, storage) : storage;
|
|
682
|
-
const tempPath = `${path5}.${randomBytes(6).toString("hex")}.tmp`;
|
|
683
716
|
const content = JSON.stringify(merged, null, 2);
|
|
684
|
-
|
|
685
|
-
await fs.writeFile(tempPath, content, { encoding: "utf-8", mode: 384 });
|
|
686
|
-
await fs.rename(tempPath, path5);
|
|
687
|
-
} catch (error) {
|
|
688
|
-
try {
|
|
689
|
-
await fs.unlink(tempPath);
|
|
690
|
-
} catch {
|
|
691
|
-
}
|
|
692
|
-
throw error;
|
|
693
|
-
}
|
|
717
|
+
await atomicWriteFile(path5, content);
|
|
694
718
|
});
|
|
695
719
|
}
|
|
696
720
|
async function saveAccountsReplace(storage) {
|
|
@@ -699,18 +723,8 @@ async function saveAccountsReplace(storage) {
|
|
|
699
723
|
await fs.mkdir(configDir, { recursive: true });
|
|
700
724
|
await ensureGitignore(configDir);
|
|
701
725
|
await withFileLock(path5, async () => {
|
|
702
|
-
const tempPath = `${path5}.${randomBytes(6).toString("hex")}.tmp`;
|
|
703
726
|
const content = JSON.stringify(storage, null, 2);
|
|
704
|
-
|
|
705
|
-
await fs.writeFile(tempPath, content, { encoding: "utf-8", mode: 384 });
|
|
706
|
-
await fs.rename(tempPath, path5);
|
|
707
|
-
} catch (error) {
|
|
708
|
-
try {
|
|
709
|
-
await fs.unlink(tempPath);
|
|
710
|
-
} catch {
|
|
711
|
-
}
|
|
712
|
-
throw error;
|
|
713
|
-
}
|
|
727
|
+
await atomicWriteFile(path5, content);
|
|
714
728
|
});
|
|
715
729
|
}
|
|
716
730
|
async function loadAccountsUnsafe() {
|
|
@@ -1672,27 +1686,41 @@ var DEFAULT_MODALITIES = {
|
|
|
1672
1686
|
input: ["text", "image", "pdf"],
|
|
1673
1687
|
output: ["text"]
|
|
1674
1688
|
};
|
|
1689
|
+
var MODEL_RELEASE_DATE = "";
|
|
1690
|
+
function defineModel(id, model) {
|
|
1691
|
+
return {
|
|
1692
|
+
id,
|
|
1693
|
+
release_date: MODEL_RELEASE_DATE,
|
|
1694
|
+
attachment: model.modalities.input.some((modality) => modality !== "text"),
|
|
1695
|
+
temperature: true,
|
|
1696
|
+
tool_call: true,
|
|
1697
|
+
...model
|
|
1698
|
+
};
|
|
1699
|
+
}
|
|
1675
1700
|
var OPENCODE_MODEL_DEFINITIONS = {
|
|
1676
|
-
"antigravity-gemini-3-pro": {
|
|
1701
|
+
"antigravity-gemini-3-pro": defineModel("antigravity-gemini-3-pro", {
|
|
1677
1702
|
name: "Gemini 3 Pro (Antigravity)",
|
|
1703
|
+
reasoning: true,
|
|
1678
1704
|
limit: { context: 1048576, output: 65535 },
|
|
1679
1705
|
modalities: DEFAULT_MODALITIES,
|
|
1680
1706
|
variants: {
|
|
1681
1707
|
low: { thinkingLevel: "low" },
|
|
1682
1708
|
high: { thinkingLevel: "high" }
|
|
1683
1709
|
}
|
|
1684
|
-
},
|
|
1685
|
-
"antigravity-gemini-3.1-pro": {
|
|
1710
|
+
}),
|
|
1711
|
+
"antigravity-gemini-3.1-pro": defineModel("antigravity-gemini-3.1-pro", {
|
|
1686
1712
|
name: "Gemini 3.1 Pro (Antigravity)",
|
|
1713
|
+
reasoning: true,
|
|
1687
1714
|
limit: { context: 1048576, output: 65535 },
|
|
1688
1715
|
modalities: DEFAULT_MODALITIES,
|
|
1689
1716
|
variants: {
|
|
1690
1717
|
low: { thinkingLevel: "low" },
|
|
1691
1718
|
high: { thinkingLevel: "high" }
|
|
1692
1719
|
}
|
|
1693
|
-
},
|
|
1694
|
-
"antigravity-gemini-3-flash": {
|
|
1720
|
+
}),
|
|
1721
|
+
"antigravity-gemini-3-flash": defineModel("antigravity-gemini-3-flash", {
|
|
1695
1722
|
name: "Gemini 3 Flash (Antigravity)",
|
|
1723
|
+
reasoning: true,
|
|
1696
1724
|
limit: { context: 1048576, output: 65536 },
|
|
1697
1725
|
modalities: DEFAULT_MODALITIES,
|
|
1698
1726
|
variants: {
|
|
@@ -1701,51 +1729,59 @@ var OPENCODE_MODEL_DEFINITIONS = {
|
|
|
1701
1729
|
medium: { thinkingLevel: "medium" },
|
|
1702
1730
|
high: { thinkingLevel: "high" }
|
|
1703
1731
|
}
|
|
1704
|
-
},
|
|
1705
|
-
"antigravity-claude-sonnet-4-6": {
|
|
1732
|
+
}),
|
|
1733
|
+
"antigravity-claude-sonnet-4-6": defineModel("antigravity-claude-sonnet-4-6", {
|
|
1706
1734
|
name: "Claude Sonnet 4.6 (Antigravity)",
|
|
1735
|
+
reasoning: false,
|
|
1707
1736
|
limit: { context: 2e5, output: 64e3 },
|
|
1708
1737
|
modalities: DEFAULT_MODALITIES
|
|
1709
|
-
},
|
|
1710
|
-
"antigravity-claude-opus-4-6-thinking": {
|
|
1738
|
+
}),
|
|
1739
|
+
"antigravity-claude-opus-4-6-thinking": defineModel("antigravity-claude-opus-4-6-thinking", {
|
|
1711
1740
|
name: "Claude Opus 4.6 Thinking (Antigravity)",
|
|
1741
|
+
reasoning: true,
|
|
1712
1742
|
limit: { context: 2e5, output: 64e3 },
|
|
1713
1743
|
modalities: DEFAULT_MODALITIES,
|
|
1714
1744
|
variants: {
|
|
1715
1745
|
low: { thinkingConfig: { thinkingBudget: 8192 } },
|
|
1716
1746
|
max: { thinkingConfig: { thinkingBudget: 32768 } }
|
|
1717
1747
|
}
|
|
1718
|
-
},
|
|
1719
|
-
"gemini-2.5-flash": {
|
|
1748
|
+
}),
|
|
1749
|
+
"gemini-2.5-flash": defineModel("gemini-2.5-flash", {
|
|
1720
1750
|
name: "Gemini 2.5 Flash (Gemini CLI)",
|
|
1751
|
+
reasoning: true,
|
|
1721
1752
|
limit: { context: 1048576, output: 65536 },
|
|
1722
1753
|
modalities: DEFAULT_MODALITIES
|
|
1723
|
-
},
|
|
1724
|
-
"gemini-2.5-pro": {
|
|
1754
|
+
}),
|
|
1755
|
+
"gemini-2.5-pro": defineModel("gemini-2.5-pro", {
|
|
1725
1756
|
name: "Gemini 2.5 Pro (Gemini CLI)",
|
|
1757
|
+
reasoning: true,
|
|
1726
1758
|
limit: { context: 1048576, output: 65536 },
|
|
1727
1759
|
modalities: DEFAULT_MODALITIES
|
|
1728
|
-
},
|
|
1729
|
-
"gemini-3-flash-preview": {
|
|
1760
|
+
}),
|
|
1761
|
+
"gemini-3-flash-preview": defineModel("gemini-3-flash-preview", {
|
|
1730
1762
|
name: "Gemini 3 Flash Preview (Gemini CLI)",
|
|
1763
|
+
reasoning: true,
|
|
1731
1764
|
limit: { context: 1048576, output: 65536 },
|
|
1732
1765
|
modalities: DEFAULT_MODALITIES
|
|
1733
|
-
},
|
|
1734
|
-
"gemini-3-pro-preview": {
|
|
1766
|
+
}),
|
|
1767
|
+
"gemini-3-pro-preview": defineModel("gemini-3-pro-preview", {
|
|
1735
1768
|
name: "Gemini 3 Pro Preview (Gemini CLI)",
|
|
1769
|
+
reasoning: true,
|
|
1736
1770
|
limit: { context: 1048576, output: 65535 },
|
|
1737
1771
|
modalities: DEFAULT_MODALITIES
|
|
1738
|
-
},
|
|
1739
|
-
"gemini-3.1-pro-preview": {
|
|
1772
|
+
}),
|
|
1773
|
+
"gemini-3.1-pro-preview": defineModel("gemini-3.1-pro-preview", {
|
|
1740
1774
|
name: "Gemini 3.1 Pro Preview (Gemini CLI)",
|
|
1775
|
+
reasoning: true,
|
|
1741
1776
|
limit: { context: 1048576, output: 65535 },
|
|
1742
1777
|
modalities: DEFAULT_MODALITIES
|
|
1743
|
-
},
|
|
1744
|
-
"gemini-3.1-pro-preview-customtools": {
|
|
1778
|
+
}),
|
|
1779
|
+
"gemini-3.1-pro-preview-customtools": defineModel("gemini-3.1-pro-preview-customtools", {
|
|
1745
1780
|
name: "Gemini 3.1 Pro Preview Custom Tools (Gemini CLI)",
|
|
1781
|
+
reasoning: true,
|
|
1746
1782
|
limit: { context: 1048576, output: 65535 },
|
|
1747
1783
|
modalities: DEFAULT_MODALITIES
|
|
1748
|
-
}
|
|
1784
|
+
})
|
|
1749
1785
|
};
|
|
1750
1786
|
|
|
1751
1787
|
// src/plugin/config/updater.ts
|