initial commit

This commit is contained in:
Badri Narayanan S
2025-12-19 19:20:28 +05:30
parent 52d72b7bff
commit 5ae29947b1
18 changed files with 3925 additions and 494 deletions

View File

@@ -9,7 +9,6 @@
import { execSync } from 'child_process';
import { homedir } from 'os';
import { join } from 'path';
import fetch from 'node-fetch';
import { TOKEN_REFRESH_INTERVAL_MS, ANTIGRAVITY_AUTH_PORT } from './constants.js';
// Cache for the extracted token
@@ -138,27 +137,6 @@ export async function getToken() {
return cachedToken;
}
/**
* Get the full configuration from Antigravity
*/
export async function getConfig() {
if (needsRefresh()) {
await getToken(); // This will refresh the cache
}
return cachedConfig;
}
/**
* Get available models from the cached config
*/
export async function getAvailableModels() {
const config = await getConfig();
if (!config?.initialUserStatus?.cascadeModelConfigData?.clientModelConfigs) {
return [];
}
return config.initialUserStatus.cascadeModelConfigData.clientModelConfigs;
}
/**
* Force refresh the token (useful if requests start failing)
*/
@@ -169,13 +147,7 @@ export async function forceRefresh() {
return getToken();
}
// Alias for forceRefresh
export const refreshToken = forceRefresh;
export default {
getToken,
getConfig,
getAvailableModels,
forceRefresh,
refreshToken
forceRefresh
};