clawmoney 0.13.0 → 0.13.1
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.
|
@@ -68,6 +68,7 @@ interface AntigravityAccountsFile {
|
|
|
68
68
|
version: 1;
|
|
69
69
|
accounts: AntigravityAccount[];
|
|
70
70
|
}
|
|
71
|
+
export declare function configureAntigravityDispatcher(): void;
|
|
71
72
|
export declare function ensureClawmoneyDir(): void;
|
|
72
73
|
export declare function loadAccounts(): AntigravityAccountsFile;
|
|
73
74
|
export declare function saveAccounts(file: AntigravityAccountsFile): void;
|
|
@@ -83,8 +83,13 @@ const ANTIGRAVITY_VERSION = "1.21.9";
|
|
|
83
83
|
const CLAWMONEY_DIR = join(homedir(), ".clawmoney");
|
|
84
84
|
const ACCOUNTS_FILE = join(CLAWMONEY_DIR, "antigravity-accounts.json");
|
|
85
85
|
// ── Proxy ──
|
|
86
|
+
//
|
|
87
|
+
// Exported so the `antigravity login` command can run the same proxy
|
|
88
|
+
// setup before it hits oauth2.googleapis.com / userinfo / loadCodeAssist.
|
|
89
|
+
// Without this, providers behind the GFW see `fetch failed` at the
|
|
90
|
+
// token-exchange step even when the browser callback succeeds.
|
|
86
91
|
let dispatcherConfigured = false;
|
|
87
|
-
function
|
|
92
|
+
export function configureAntigravityDispatcher() {
|
|
88
93
|
if (dispatcherConfigured)
|
|
89
94
|
return;
|
|
90
95
|
dispatcherConfigured = true;
|
|
@@ -101,6 +106,7 @@ function configureDispatcher() {
|
|
|
101
106
|
setGlobalDispatcher(new ProxyAgent(url));
|
|
102
107
|
logger.info(`[antigravity-api] upstream proxy ${url}`);
|
|
103
108
|
}
|
|
109
|
+
const configureDispatcher = configureAntigravityDispatcher;
|
|
104
110
|
// ── Account storage ──
|
|
105
111
|
export function ensureClawmoneyDir() {
|
|
106
112
|
mkdirSync(CLAWMONEY_DIR, { recursive: true });
|
|
@@ -223,6 +229,7 @@ async function getFreshAccount() {
|
|
|
223
229
|
* sub2api and opencode-antigravity-auth behavior.
|
|
224
230
|
*/
|
|
225
231
|
export async function resolveAntigravityProjectId(accessToken) {
|
|
232
|
+
configureDispatcher();
|
|
226
233
|
const body = JSON.stringify({
|
|
227
234
|
metadata: {
|
|
228
235
|
ideType: "ANTIGRAVITY",
|
|
@@ -510,6 +517,7 @@ export async function storeNewAntigravityAccount(input) {
|
|
|
510
517
|
* the browser flow. Exported so the CLI login command can call it.
|
|
511
518
|
*/
|
|
512
519
|
export async function exchangeAntigravityAuthCode(input) {
|
|
520
|
+
configureDispatcher();
|
|
513
521
|
const start = Date.now();
|
|
514
522
|
const resp = await fetch(OAUTH_TOKEN_URL, {
|
|
515
523
|
method: "POST",
|
|
@@ -547,6 +555,7 @@ export async function exchangeAntigravityAuthCode(input) {
|
|
|
547
555
|
* failure — we'll just store the account without an email label.
|
|
548
556
|
*/
|
|
549
557
|
export async function fetchAntigravityUserEmail(accessToken) {
|
|
558
|
+
configureDispatcher();
|
|
550
559
|
try {
|
|
551
560
|
const resp = await fetch(OAUTH_USERINFO_URL, {
|
|
552
561
|
headers: { authorization: `Bearer ${accessToken}` },
|