2 Commits

  • fix: Provider sync on every startup + sandbox fixes (v2.0.4)
    Critical fixes:
    - ALWAYS sync active AG X provider to endpoints.json on startup
      (previously only synced on first run, causing LS to use stale data)
    - Add --no-sandbox to proxy process spawns (fixes SIGTRAP crash on Linux)
    - Add --no-sandbox for all Electron modes (not just headless)
    - Add --ag-reset flag to re-trigger welcome screen
    - Bump version to 2.0.4
    
    Root causes fixed:
    1. endpoints.json was never updated after first-run, so LS used wrong provider
    2. Electron child processes (translation proxy) crashed due to SUID sandbox
    3. No way to re-show provider selection after initial setup
6 changed files with 147 additions and 41 deletions

38
CHANGELOG.md Normal file
View File

@@ -0,0 +1,38 @@
# AG X Changelog
## v2.0.3 (2025-05-22)
### Features
- **Multi-Provider Support**: Choose between Google OAuth or Custom Provider at first launch
- **Provider Settings UI**: Built-in settings page to configure custom API endpoints
- **API Proxy**: Transparent proxy that routes requests to your chosen provider
- **Translation Proxy**: Supports translation services for multi-language responses
- **Welcome Screen**: First-run experience lets you select your preferred provider
- **System Tray Integration**: Minimize to tray with status indicators
### Fixes
- Fixed provider selection flow - selecting a custom provider now correctly opens the app
- Fixed endpoint configuration sync between AG X UI and Language Server proxy
- Fixed OAuth redirect handling for custom providers
- Fixed settings persistence across app restarts
### Architecture
- `dist/main.js` - Electron main process with provider orchestration
- `dist/languageServer.js` - Language Server proxy with endpoint management
- `dist/provider/welcome.html` - First-run provider selection screen
- `dist/provider/settings.html` - Provider configuration settings page
- `dist/providerSettings.js` - Provider settings window management
- `dist/services/apiProxy.js` - API request proxy to custom endpoints
- `dist/services/providerService.js` - Provider CRUD operations
- `dist/services/translationProxy.js` - Translation service proxy
## v2.0.2 (2025-05-22)
- Initial AG X fork from Antigravity
- Custom provider support
- Settings UI improvements
## v2.0.1 (2025-05-22)
- Base Antigravity fork
- Desktop app packaging (.deb)

130
README.md
View File

@@ -1,43 +1,109 @@
# AG X (Antigravity fork) v2.0.3
# AG X Antigravity Fork
AI-Powered Code Intelligence — agentic desktop application with multi-provider AI support.
**AG X** is a fork of the Antigravity desktop application with enhanced multi-provider support. It allows you to use Google OAuth or any custom OpenAI-compatible API provider.
## What's New in v2.0.3
### 🐛 Critical Fix: Provider Selection Flow
- **Welcome screen now shows BEFORE the Language Server starts** — on first run, the user picks a provider before the LS launches, preventing the Google OAuth prompt from appearing for non-Google providers.
- **Provider config syncs to `~/.codex/endpoints.json`** — the provider choice from the welcome screen and settings panel is properly synced to the endpoints config that the translation proxy reads.
- **"Another AI Provider" flow fixed** — when user picks a custom provider, the settings panel opens and the app waits for the user to configure and save their provider before starting the Language Server.
### Changes
| File | Change |
|---|---|
| `main.js` | Restructured startup: welcome screen before LS start |
| `main.js` | Added `syncProviderToEndpoints()` function |
| `main.js` | Google Gemini handler sets active endpoint in `endpoints.json` |
| `main.js` | Custom provider handler waits for settings save before continuing |
| `providerSettings.js` | Save handler syncs to `endpoints.json` and emits `provider:settings-saved` |
| `providerSettings.js` | Added close-settings IPC listener |
| `settings.html` | Save handler shows restart notification and auto-closes |
![AG X Icon](icon.png)
## Features
- 🔮 Google Gemini (OAuth) — zero config
- 🔌 15+ AI Providers (OpenAI, Anthropic, DeepSeek, Ollama, etc.)
- 🧠 Built-in translation proxy for non-native backends
- 🔄 Auto-update support
- 🖥️ System tray integration
## Installation
- 🔄 **Multi-Provider Support** — Switch between Google OAuth and custom API providers
-**Custom Endpoints** — Configure your own OpenAI-compatible API endpoints
- 🌐 **Translation Proxy** — Built-in translation service proxy for multi-language support
- 🔧 **Provider Settings UI** — Easy-to-use settings page for managing providers
- 📦 **Debian Package** — Installable `.deb` package for Ubuntu/Debian
- 🖥️ **System Tray** — Minimize to system tray with status indicators
- 🔒 **Secure Storage** — Provider configurations stored locally and securely
## Quick Start
### Install from .deb
```bash
sudo dpkg -i ag-x_2.0.3_amd64.deb
sudo apt-get install -f # fix any missing dependencies
```
## First Run
On first launch, AG X shows a welcome screen where you choose:
1. **Google Gemini** — Sign in with Google (OAuth, no API key needed)
2. **Another AI Provider** — Pick from 15+ providers and enter your API key
### First Run
1. Launch AG X from your application menu or run `ag-x`
2. On first launch, you'll see the **Welcome Screen**
3. Choose your provider:
- **Google OAuth** — Use the default Antigravity/Google authentication
- **Custom Provider** — Enter your own API endpoint URL and API key
4. Start using the app!
### Configure Provider
After initial setup, you can change your provider at any time:
- Click the AG X tray icon → **Settings**
- Or use the in-app provider settings
## Project Structure
```
ag-x/
├── dist/ # Application source (compiled)
│ ├── main.js # Electron main process
│ ├── languageServer.js # Language Server proxy
│ ├── preload.js # Electron preload script
│ ├── providerSettings.js # Provider settings window
│ ├── provider/
│ │ ├── welcome.html # First-run welcome screen
│ │ └── settings.html # Provider settings page
│ ├── services/
│ │ ├── apiProxy.js # API request proxy
│ │ ├── providerService.js # Provider management
│ │ ├── translationProxy.js # Translation proxy
│ │ └── settingsService.js # Settings persistence
│ └── ...
├── releases/
│ └── ag-x_2.0.3_amd64.deb # Debian installer package
├── icon.png # Application icon
├── trayTemplate.png # Tray icon template
├── trayTemplate@2x.png # Tray icon template (Retina)
├── package.json # Node.js package manifest
├── CHANGELOG.md # Version history
└── README.md # This file
```
## Configuration
- Provider settings: `~/.ag-x/ag-x/provider_config.json`
- Proxy endpoints: `~/.codex/endpoints.json`
- Menu → AI Provider Settings to change provider anytime
AG X stores configuration in:
- `~/.ag-x/ag-x/provider_config.json` — Provider settings
- `~/.codex/endpoints.json` — Language Server endpoint configuration
### Custom Provider Format
```json
{
"providerType": "custom",
"apiEndpoint": "https://your-api.example.com/v1",
"apiKey": "your-api-key",
"models": ["gpt-4", "gpt-3.5-turbo"]
}
```
## Building from Source
### Prerequisites
- Node.js 18+
- npm 9+
### Build Steps
```bash
npm install
npm run build
npm run package:linux
```
The `.deb` package will be in `releases/`.
## License
Fork of Antigravity. See original project for license details.
## Links
- **Repository**: [https://github.rommark.dev/admin/antigravity-ai-providers](https://github.rommark.dev/admin/antigravity-ai-providers)
- **Original**: Antigravity Desktop App

View File

@@ -238,7 +238,7 @@ function ensureProxyStarted() {
// Use Electron's built-in Node.js to run our translation proxy
const proxyScript = path_1.default.join(__dirname, 'services', 'translationProxy.js');
const nodeBin = process.execPath;
_proxyProcess = (0, child_process_1.spawn)(nodeBin, [proxyScript], {
_proxyProcess = (0, child_process_1.spawn)(nodeBin, ['--no-sandbox', proxyScript], {
stdio: 'ignore',
detached: true,
env: { ...process.env }

14
dist/main.js vendored
View File

@@ -81,12 +81,15 @@ let apiProxy;
const HEADLESS = process.env.ELECTRON_OZONE_PLATFORM_HINT === 'headless';
// When set, skip LS startup and load this URL directly (for dev iteration).
const DEV_URL = process.env.DEV_URL;
const AG_RESET = process.argv.includes('--ag-reset');
if (HEADLESS) {
electron_1.app.commandLine.appendSwitch('ozone-platform', 'headless');
electron_1.app.commandLine.appendSwitch('headless');
electron_1.app.commandLine.appendSwitch('disable-gpu');
electron_1.app.commandLine.appendSwitch('no-sandbox');
}
// Always disable sandbox for Linux compatibility (SUID sandbox issues)
electron_1.app.commandLine.appendSwitch('no-sandbox');
if (!electron_1.app.commandLine.hasSwitch('remote-debugging-port')) {
electron_1.app.commandLine.appendSwitch('remote-debugging-port', '0');
}
@@ -218,17 +221,16 @@ electron_1.app
const csrf = crypto.randomUUID();
console.log(`Starting app (v${electron_1.app.getVersion()}) with dynamic port…`);
// Check if first run BEFORE starting LS so we can configure provider first
const isFirstRun = !fs_1.existsSync(providerService.configPath);
const isFirstRun = !fs_1.existsSync(providerService.configPath) || AG_RESET;
if (isFirstRun && !HEADLESS) {
console.log('[Welcome] First run detected — showing provider choice screen');
await showWelcomeScreen('about:blank');
console.log('[Welcome] User selected provider:', providerService.getActiveProvider());
// Sync to endpoints.json (for Google, the handler already set the endpoint;
// for custom, the settings save handler synced. This is a safety sync.)
if (providerService.getActiveProvider() !== 'google_gemini') {
}
// ALWAYS sync the active AG X provider to endpoints.json on every startup.
// This ensures the Language Server reads the correct provider config.
console.log('[Sync] Syncing active provider to endpoints.json on startup');
syncProviderToEndpoints(providerService);
}
}
let handle;
const targetPort = Number(process.env.JETSKI_LS_PORT) || constants_1.DYNAMIC_PORT;
try {

View File

@@ -71,7 +71,7 @@ class ApiProxy {
// Use Electron's Node.js binary to run our translation proxy
const proxyScript = path.join(__dirname, 'translationProxy.js');
const nodeBin = process.execPath;
this.proxyProcess = child_process.spawn(nodeBin, [proxyScript], {
this.proxyProcess = child_process.spawn(nodeBin, ['--no-sandbox', proxyScript], {
stdio: ['ignore', 'pipe', 'pipe'],
detached: false,
env: { ...process.env },

View File

@@ -1,7 +1,7 @@
{
"name": "ag-x",
"productName": "AG X",
"version": "2.0.3",
"version": "2.0.4",
"description": "AG X - Agentic Desktop Application",
"homepage": "https://ag-x.dev",
"author": {