Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3652f43f5 | ||
|
|
2a5d482c52 | ||
|
|
9d1ce44ea3 | ||
|
|
42466c274b | ||
|
|
0dbae81353 | ||
|
|
a4727713d2 | ||
|
|
b13f06c0a3 | ||
|
|
7a6587cb8b | ||
|
|
e1c9a9e34a | ||
|
|
1c26a9e542 | ||
|
|
5026be12d2 | ||
|
|
c05daba98b | ||
|
|
2e3a65b76b | ||
|
|
62634b5511 | ||
|
|
27223f587d | ||
|
|
1d35801980 | ||
|
|
269ad18ed6 | ||
|
|
9b9b977ae6 | ||
|
|
f4daaa8ca1 | ||
|
|
e221ad14cd | ||
|
|
268428a119 | ||
|
|
080bf30e38 | ||
|
|
c134a072df | ||
|
|
a905877c76 | ||
|
|
3752dfda91 | ||
|
|
71bf8122d1 | ||
|
|
713c4497c6 | ||
|
|
641c739b64 | ||
|
|
99e458f69b | ||
|
|
bc69a2e8b5 | ||
|
|
20785a8414 | ||
|
|
5c44a622a8 | ||
|
|
bf5a42c03e | ||
|
|
7d2977b665 | ||
|
|
0753bbdce6 | ||
|
|
a631887cd1 | ||
|
|
4ce8d266ab | ||
|
|
68474b56dc | ||
|
|
48faa0d4b1 | ||
|
|
9bf7c46ff6 | ||
|
|
195af14707 | ||
|
|
a9a492274c | ||
|
|
3cf82a7999 | ||
|
|
fea752cc4d | ||
|
|
df7ecfe290 | ||
|
|
cca8bdf68f | ||
|
|
6e568dd866 | ||
|
|
de866a74bf | ||
|
|
9c07fbc815 | ||
|
|
3420fc86d2 | ||
|
|
d737f94003 | ||
|
|
dc91cc9128 | ||
|
|
e6f5adbae1 | ||
|
|
a648f2a281 | ||
|
|
b1c76f3b69 | ||
|
|
1ad7ae6515 | ||
|
|
fbf21c4fa9 | ||
|
|
d35db9756d | ||
|
|
3088c9c542 | ||
|
|
24142115c4 | ||
|
|
bac7b5591e | ||
|
|
b80531f8a8 | ||
|
|
3573009e0a | ||
|
|
095ea6131d | ||
|
|
69e455a565 | ||
|
|
04014b8c7d | ||
|
|
afe8859f16 | ||
|
|
bf4bcf4f96 | ||
|
|
fd1b2b8bc0 | ||
|
|
0be7d7fea2 | ||
|
|
c73537d44c | ||
|
|
2f42d70d78 | ||
|
|
425b0009b8 | ||
|
|
9b37bdb2d9 | ||
|
|
1258b32cb5 | ||
|
|
98c08bd64f | ||
|
|
8c8b328120 | ||
|
|
a225791e71 | ||
|
|
1a1c0acd16 | ||
|
|
ce21283170 | ||
|
|
2a5e54184f | ||
|
|
ccc5d36a0d | ||
|
|
bfdb58fc81 | ||
|
|
b32dd24765 | ||
|
|
2c81d129f9 | ||
|
|
f4b713c3f4 | ||
|
|
5b130aca66 | ||
|
|
4653fa2b41 | ||
|
|
a3eabc2aaa | ||
|
|
099671a4e5 | ||
|
|
0f9d08018b | ||
|
|
83489d5084 | ||
|
|
0454aecf70 | ||
|
|
27da62afc9 | ||
|
|
faabf7ba7a | ||
|
|
433dccbaa9 | ||
|
|
e524a340cb | ||
|
|
6577f1c51f | ||
|
|
3e1e10b2a5 | ||
|
|
7093c982ba | ||
|
|
440a934280 | ||
|
|
87887dc4b9 | ||
|
|
00ff50055f | ||
|
|
d0c282dfff | ||
|
|
bc35b96b5d | ||
|
|
0223e8d807 | ||
|
|
1fd0fde700 | ||
|
|
2c1755e578 | ||
|
|
3100db93ed | ||
|
|
e9c4f72883 | ||
|
|
87c17a1ed0 | ||
|
|
4fa0a3c63d | ||
|
|
388fbcb2a9 | ||
|
|
bcdf2a6c24 | ||
|
|
385036d577 | ||
|
|
f970ccb2ed | ||
|
|
fce38ec6f0 | ||
|
|
61716bb512 | ||
|
|
ed0dd811a8 | ||
|
|
50a325be11 | ||
|
|
20fffff29c | ||
|
|
c95f494569 | ||
|
|
5401e40943 | ||
|
|
0a60c0eafa | ||
|
|
30e38dcb8b |
No files matched your search
@@ -1,13 +1,13 @@
|
|||||||
---
|
---
|
||||||
name: antigravity-manager
|
name: geminiNexus-manager
|
||||||
description: Comprehensive guide to Antigravity Manager architecture, workflows, and development. Use this to understand how to work on the project.
|
description: Comprehensive guide to Gemini Nexus Manager architecture, workflows, and development. Use this to understand how to work on the project.
|
||||||
---
|
---
|
||||||
|
|
||||||
# Antigravity Manager Developer Guide
|
# Gemini Nexus Manager Developer Guide
|
||||||
|
|
||||||
## 🏗️ Architecture Overview
|
## 🏗️ Architecture Overview
|
||||||
|
|
||||||
Antigravity Manager is a hybrid Desktop Application built with Electron, React, and NestJS. It follows a modular architecture where the frontend (Renderer) communicates with the backend (Main) via type-safe IPC (ORPC).
|
Gemini Nexus Manager is a hybrid Desktop Application built with Electron, React, and NestJS. It follows a modular architecture where the frontend (Renderer) communicates with the backend (Main) via type-safe IPC (ORPC).
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
graph TD
|
graph TD
|
||||||
@@ -69,7 +69,7 @@ The project uses `orpc` for type-safe communication.
|
|||||||
|
|
||||||
### Database Access
|
### Database Access
|
||||||
|
|
||||||
Data is stored in a local SQLite file (`test.db` in dev, user data in prod).
|
Data is stored in a local SQLite file.
|
||||||
|
|
||||||
- Use `Better-SQLite3` for direct access.
|
- Use `Better-SQLite3` for direct access.
|
||||||
- Logic should be encapsulated in `src/services` or `src/ipc`.
|
- Logic should be encapsulated in `src/services` or `src/ipc`.
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
# lodash-es-runtime-guards
|
||||||
|
|
||||||
|
Replace runtime `typeof` checks and ad-hoc empty-string checks with `lodash-es` predicates.
|
||||||
|
|
||||||
|
## When to Use
|
||||||
|
|
||||||
|
- You see runtime checks like `typeof value === 'string'`.
|
||||||
|
- You see object guards like `value && typeof value === 'object'`.
|
||||||
|
- You see emptiness checks like `value.trim() !== ''` or `value.trim() === ''`.
|
||||||
|
- You want consistent guard style across app, server, IPC, and tests.
|
||||||
|
|
||||||
|
## Do Not Replace
|
||||||
|
|
||||||
|
- Type-level `typeof` (TypeScript only), for example:
|
||||||
|
- `ReturnType<typeof fn>`
|
||||||
|
- `keyof typeof CONST_MAP`
|
||||||
|
- `z.infer<typeof Schema>`
|
||||||
|
|
||||||
|
These are compile-time types and must remain as-is.
|
||||||
|
|
||||||
|
## Guard Mapping
|
||||||
|
|
||||||
|
- `typeof x === 'string'` -> `isString(x)`
|
||||||
|
- `typeof x !== 'string'` -> `!isString(x)`
|
||||||
|
- `typeof x === 'number'` -> `isNumber(x)`
|
||||||
|
- `typeof x === 'boolean'` -> `isBoolean(x)`
|
||||||
|
- `typeof x === 'function'` -> `isFunction(x)`
|
||||||
|
- `typeof x === 'undefined'` -> `isUndefined(x)`
|
||||||
|
- `x && typeof x === 'object'` -> `isObjectLike(x)`
|
||||||
|
- `typeof x === 'object' && x !== null` -> `isObjectLike(x)`
|
||||||
|
- `typeof x === 'object' && !Array.isArray(x)` -> `isObjectLike(x) && !isArray(x)`
|
||||||
|
|
||||||
|
## String Emptiness Pattern
|
||||||
|
|
||||||
|
- Prefer:
|
||||||
|
- `isEmpty(value.trim())`
|
||||||
|
- Instead of:
|
||||||
|
- `value.trim() === ''`
|
||||||
|
- `value.trim() !== ''`
|
||||||
|
- `value.trim().length === 0`
|
||||||
|
|
||||||
|
## Import Style
|
||||||
|
|
||||||
|
- Use named imports from `lodash-es`:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import { isString, isNumber, isObjectLike, isEmpty } from 'lodash-es';
|
||||||
|
```
|
||||||
|
|
||||||
|
- Do not use full-package imports.
|
||||||
|
- Reuse existing imports in file; avoid duplicate imports.
|
||||||
|
|
||||||
|
## Refactor Checklist
|
||||||
|
|
||||||
|
1. Replace runtime checks first, preserving behavior.
|
||||||
|
2. Keep array/object branching semantics unchanged.
|
||||||
|
3. Re-scan:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rg -n "typeof\s+[^\n]+(?:===|!==)\s*'" src
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Confirm only type-level `typeof` remains:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rg -n "\btypeof\b" src
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Run verification:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run type-check
|
||||||
|
```
|
||||||
|
|
||||||
@@ -1,17 +1,32 @@
|
|||||||
name: Check formatting
|
name: Check formatting
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests-unit:
|
check:
|
||||||
|
name: Prettier Format Check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
- uses: actions/setup-node@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 20
|
||||||
|
cache: 'pnpm'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Run format check
|
- name: Run format check
|
||||||
run: npm run format
|
run: pnpm run format
|
||||||
@@ -1,17 +1,32 @@
|
|||||||
name: Lint
|
name: Lint
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
|
name: ESLint Check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
- uses: actions/setup-node@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 20
|
||||||
|
cache: 'pnpm'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Run lint
|
- name: Run lint
|
||||||
run: npm run lint
|
run: pnpm run lint
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
name: Publish Release
|
name: Publish Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
workflow_run:
|
||||||
types: [published]
|
workflows: ['Release']
|
||||||
|
types: [completed]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
dry_run:
|
dry_run:
|
||||||
@@ -17,7 +18,46 @@ on:
|
|||||||
default: false
|
default: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
check-release:
|
||||||
|
name: Check for new release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
outputs:
|
||||||
|
tag: ${{ steps.get_tag.outputs.tag }}
|
||||||
|
has_release: ${{ steps.get_tag.outputs.has_release }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Get latest release tag
|
||||||
|
id: get_tag
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
|
version="$(node -e "process.stdout.write(require('./package.json').version)")"
|
||||||
|
tag="v$version"
|
||||||
|
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "has_release=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
tag=$(gh release list --limit 1 --json tagName --jq '.[0].tagName // empty')
|
||||||
|
if [ -n "$tag" ]; then
|
||||||
|
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "has_release=true" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Found release: $tag"
|
||||||
|
else
|
||||||
|
echo "has_release=false" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "No release found, skipping build."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
needs: check-release
|
||||||
|
if: needs.check-release.outputs.has_release == 'true'
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -50,11 +90,14 @@ jobs:
|
|||||||
- name: Checkout git repo
|
- name: Checkout git repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
|
||||||
- name: Install Node and NPM
|
- name: Install Node and NPM
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
cache: 'npm'
|
cache: 'pnpm'
|
||||||
|
|
||||||
- name: Install Linux dependencies
|
- name: Install Linux dependencies
|
||||||
if: matrix.platform == 'linux'
|
if: matrix.platform == 'linux'
|
||||||
@@ -75,9 +118,11 @@ jobs:
|
|||||||
Write-Host "Incompatible WiX Toolset detected: $installed"
|
Write-Host "Incompatible WiX Toolset detected: $installed"
|
||||||
choco upgrade wixtoolset --version=3.14.0 --allow-downgrade -y
|
choco upgrade wixtoolset --version=3.14.0 --allow-downgrade -y
|
||||||
}
|
}
|
||||||
|
# Ensure 7zip is available for Squirrel.Windows zip operations
|
||||||
|
choco install 7zip -y
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Make Artifacts
|
- name: Make Artifacts
|
||||||
if: matrix.platform != 'darwin'
|
if: matrix.platform != 'darwin'
|
||||||
@@ -87,7 +132,7 @@ jobs:
|
|||||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||||
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
||||||
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
||||||
run: npm run make -- --platform=${{ matrix.platform }} --arch=${{ matrix.arch }}
|
run: pnpm run make -- --platform=${{ matrix.platform }} --arch=${{ matrix.arch }}
|
||||||
|
|
||||||
# DMG creation may be flaky on GitHub macOS runners, so retry the full darwin make.
|
# DMG creation may be flaky on GitHub macOS runners, so retry the full darwin make.
|
||||||
- name: Make Artifacts (darwin with retry)
|
- name: Make Artifacts (darwin with retry)
|
||||||
@@ -97,7 +142,7 @@ jobs:
|
|||||||
max_attempts: 3
|
max_attempts: 3
|
||||||
timeout_minutes: 20
|
timeout_minutes: 20
|
||||||
retry_wait_seconds: 20
|
retry_wait_seconds: 20
|
||||||
command: npm run make -- --platform=${{ matrix.platform }} --arch=${{ matrix.arch }}
|
command: pnpm run make -- --platform=${{ matrix.platform }} --arch=${{ matrix.arch }}
|
||||||
env:
|
env:
|
||||||
NODE_OPTIONS: --max-old-space-size=8192
|
NODE_OPTIONS: --max-old-space-size=8192
|
||||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||||
@@ -128,16 +173,12 @@ jobs:
|
|||||||
echo "Dry run enabled: build artifacts generated and uploaded; release publish step will be skipped."
|
echo "Dry run enabled: build artifacts generated and uploaded; release publish step will be skipped."
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
name: Publish Release (Manual Approval)
|
name: Publish Release
|
||||||
needs: build
|
needs: [check-release, build]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: needs.build.result == 'success' && (github.event_name != 'workflow_dispatch' || github.event.inputs.dry_run != 'true')
|
if: needs.build.result == 'success' && (github.event_name != 'workflow_dispatch' || github.event.inputs.dry_run != 'true')
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
# Configure the `release` environment with required reviewers in GitHub settings
|
|
||||||
# to enforce a manual approval gate before assets are uploaded.
|
|
||||||
environment:
|
|
||||||
name: release
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout git repo
|
- name: Checkout git repo
|
||||||
@@ -150,49 +191,17 @@ jobs:
|
|||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
path: release-assets
|
path: release-assets
|
||||||
|
|
||||||
- name: Install Node and NPM
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Resolve release tag
|
- name: Resolve release tag
|
||||||
id: release_tag
|
id: release_tag
|
||||||
env:
|
|
||||||
RELEASE_EVENT_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || '' }}
|
|
||||||
run: |
|
run: |
|
||||||
if [ -n "$RELEASE_EVENT_TAG" ]; then
|
tag="${{ needs.check-release.outputs.tag }}"
|
||||||
tag="$RELEASE_EVENT_TAG"
|
if [ -z "$tag" ]; then
|
||||||
else
|
version="$(node -e "process.stdout.write(require('./package.json').version)")"
|
||||||
version="$(node -e "const v=require('./package.json').version; if (!v) { throw new Error('package.json version is empty'); } process.stdout.write(v);")"
|
|
||||||
tag="v$version"
|
tag="v$version"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$tag" ]; then
|
|
||||||
echo "::error::Resolved release tag is empty"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||||
echo "Using release tag: $tag"
|
echo "Using release tag: $tag"
|
||||||
|
|
||||||
- name: Ensure release is safe to update
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
RELEASE_TAG: ${{ steps.release_tag.outputs.tag }}
|
|
||||||
ALLOW_UPDATE_PUBLISHED_RELEASE: ${{ github.event_name == 'release' && 'true' || (github.event_name == 'workflow_dispatch' && github.event.inputs.allow_update_published_release) || 'false' }}
|
|
||||||
run: |
|
|
||||||
if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then
|
|
||||||
is_draft="$(gh release view "$RELEASE_TAG" --json isDraft --jq '.isDraft')"
|
|
||||||
if [ "$is_draft" != "true" ] && [ "$ALLOW_UPDATE_PUBLISHED_RELEASE" != "true" ]; then
|
|
||||||
echo "::error::Release $RELEASE_TAG is already published. Refusing to upload assets."
|
|
||||||
echo "::error::Re-run with workflow_dispatch input allow_update_published_release=true if you explicitly want to update it."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
gh release create "$RELEASE_TAG" --title "$RELEASE_TAG" --draft --notes "Automated release draft."
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Upload assets to release
|
- name: Upload assets to release
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -216,4 +225,16 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
printf 'Uploading %s assets to %s\n' "${#files[@]}" "$RELEASE_TAG"
|
printf 'Uploading %s assets to %s\n' "${#files[@]}" "$RELEASE_TAG"
|
||||||
gh release upload "$RELEASE_TAG" "${files[@]}" --clobber
|
|
||||||
|
# Upload files sequentially with retries to prevent GitHub API rate limits and 404/502 errors
|
||||||
|
for file in "${files[@]}"; do
|
||||||
|
echo "Uploading $file..."
|
||||||
|
if ! gh release upload "$RELEASE_TAG" "$file" --clobber; then
|
||||||
|
echo "::warning::Failed to upload $file. Retrying in 5 seconds..."
|
||||||
|
sleep 5
|
||||||
|
if ! gh release upload "$RELEASE_TAG" "$file" --clobber; then
|
||||||
|
echo "::error::Failed to upload $file after retry."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -16,19 +18,22 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Required for semantic-release to analyze commits
|
fetch-depth: 0
|
||||||
persist-credentials: false # We use a token in the next steps
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
cache: 'npm'
|
cache: 'pnpm'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} # Use GH_TOKEN to trigger other workflows
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: npx semantic-release
|
run: npx semantic-release
|
||||||
@@ -1,22 +1,59 @@
|
|||||||
name: Tests
|
name: Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests-unit:
|
tests-unit:
|
||||||
|
name: Unit Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
- uses: actions/setup-node@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 20
|
||||||
|
cache: 'pnpm'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: npm run test:unit
|
run: pnpm test
|
||||||
|
|
||||||
|
type-check:
|
||||||
|
name: Type Check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
cache: 'pnpm'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Run TypeScript type check
|
||||||
|
run: pnpm run type-check
|
||||||
|
|
||||||
# NOTE: E2E tests are disabled in CI because Electron apps require a graphical environment.
|
# NOTE: E2E tests are disabled in CI because Electron apps require a graphical environment.
|
||||||
# Run E2E tests locally with: npm run test:e2e
|
# Run E2E tests locally with: pnpm run test:e2e
|
||||||
@@ -123,3 +123,34 @@ build/
|
|||||||
cli/aliases.json
|
cli/aliases.json
|
||||||
*.backup
|
*.backup
|
||||||
accounts_backup.json
|
accounts_backup.json
|
||||||
|
|
||||||
|
# Bun lock file
|
||||||
|
bun.lock
|
||||||
|
|
||||||
|
# Build tools (installed via CI)
|
||||||
|
tools/
|
||||||
|
*.zip
|
||||||
|
|
||||||
|
# AI agent session data
|
||||||
|
thoughts/
|
||||||
|
.impeccable.md
|
||||||
|
CLAUDE.md
|
||||||
|
|
||||||
|
# One-shot scripts (already applied)
|
||||||
|
fix-ts.js
|
||||||
|
patch-proxy.js
|
||||||
|
patch-settings.js
|
||||||
|
rename-deep.js
|
||||||
|
test-process.ts
|
||||||
|
|
||||||
|
# Legacy CLI launchers
|
||||||
|
agm.bat
|
||||||
|
run_cli.bat
|
||||||
|
|
||||||
|
# Nix (not used)
|
||||||
|
flake.nix
|
||||||
|
flake.lock
|
||||||
|
|
||||||
|
# Planning/spec data
|
||||||
|
.planning/
|
||||||
|
openspec/
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
Here is the code review report for the Token Usage Counter feature.
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
The review found 2 critical security issues and 2 warnings. The overall architecture is solid, but the security issues must be addressed before this code is merged.
|
||||||
|
|
||||||
|
## Critical Issues
|
||||||
|
|
||||||
|
### CR-01: SQL Injection Vulnerability in TokenUsageRepo filter methods
|
||||||
|
|
||||||
|
**Issue:** `buildAccountFilter` concatenates `accountId` directly into raw SQL.
|
||||||
|
**Fix:** Use parameterized queries.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
function buildAccountFilter(accountId?: string): { sql: string; params: string[] } {
|
||||||
|
return accountId ? { sql: `AND account_id = ?`, params: [accountId] } : { sql: '', params: [] };
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### CR-02: Missing validation in TokenUsageRepo queries
|
||||||
|
|
||||||
|
**Issue:** `buildDateFilter` directly interpolates `start` and `end` arguments.
|
||||||
|
**Fix:** Ensure parameters are passed safely using parameterized queries.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
function buildDateFilter(start?: number, end?: number): { sql: string; params: number[] } {
|
||||||
|
const conditions: string[] = [];
|
||||||
|
const params: number[] = [];
|
||||||
|
if (start !== undefined) {
|
||||||
|
conditions.push(`timestamp >= ?`);
|
||||||
|
params.push(start);
|
||||||
|
}
|
||||||
|
if (end !== undefined) {
|
||||||
|
conditions.push(`timestamp <= ?`);
|
||||||
|
params.push(end);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
sql: conditions.length > 0 ? `AND ${conditions.join(' AND ')}` : '',
|
||||||
|
params,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Warnings
|
||||||
|
|
||||||
|
### WR-01: Synchronous Database Writing in ProxyService
|
||||||
|
|
||||||
|
**Issue:** `recordUsage` calls a synchronous database insertion on every proxy request, which can cause severe performance bottlenecks under load.
|
||||||
|
**Fix:** Consider making the usage recording asynchronous (fire-and-forget), using an asynchronous database driver, or implementing a batching mechanism.
|
||||||
|
|
||||||
|
### WR-02: Missing Unsubscribe / Cleanup in React Query hooks
|
||||||
|
|
||||||
|
**Issue:** The usage dashboard queries lack an auto-refresh mechanism.
|
||||||
|
**Fix:** Add `refetchInterval: 10000` to the query configuration.
|
||||||
|
|
||||||
|
## Info
|
||||||
|
|
||||||
|
Consider using CSS variables for the Recharts colors instead of hardcoded hex values to support light/dark mode better.
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
---
|
||||||
|
phase: 02-code-review-command
|
||||||
|
reviewed: 2026-04-22T14:00:00Z
|
||||||
|
depth: standard
|
||||||
|
files_reviewed: 10
|
||||||
|
files_reviewed_list:
|
||||||
|
- src/ipc/database/cloudHandler.ts
|
||||||
|
- src/ipc/database/schema.ts
|
||||||
|
- src/ipc/database/usageHandler.ts
|
||||||
|
- src/ipc/router.ts
|
||||||
|
- src/ipc/usage/router.ts
|
||||||
|
- src/server/modules/proxy/proxy.module.ts
|
||||||
|
- src/server/modules/proxy/proxy.service.ts
|
||||||
|
- src/server/modules/usage/token-usage.service.ts
|
||||||
|
- src/types/db.ts
|
||||||
|
- src/routes/usage.tsx
|
||||||
|
status: issues_found
|
||||||
|
---
|
||||||
|
|
||||||
|
# Phase 02-code-review-command: Code Review Report
|
||||||
|
|
||||||
|
**Reviewed:** 2026-04-22T14:00:00Z
|
||||||
|
**Depth:** standard
|
||||||
|
**Files Reviewed:** 10
|
||||||
|
**Status:** issues_found
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
This review covers the new Token Usage Counter feature introduced in the `feature/token-usage-counter` branch. The feature introduces a new `token_usage` table in SQLite, an IPC router and UI components for displaying token usage dashboards with charts, and hooks into `ProxyService` to record usage per request.
|
||||||
|
|
||||||
|
Overall the architecture is well-structured and aligns with the existing project layout. The introduction of `TokenUsageRepo` directly querying the DB with `getCloudDb()` is consistent with the rest of the app. The UI is built using Recharts and properly localized.
|
||||||
|
|
||||||
|
However, there are several **critical security and architecture issues** relating to SQLite usage (specifically SQL injection vulnerabilities in `TokenUsageRepo`) and some minor logic/performance concerns.
|
||||||
|
|
||||||
|
## Critical Issues
|
||||||
|
|
||||||
|
### CR-01: SQL Injection Vulnerability in TokenUsageRepo filter methods
|
||||||
|
|
||||||
|
**File:** `src/ipc/database/usageHandler.ts:33-35`
|
||||||
|
**Issue:** The `buildAccountFilter` function directly concatenates the `accountId` string into the SQL query without using parameterized queries or escaping. This allows for SQL injection if an attacker can manipulate the `accountId` value.
|
||||||
|
**Fix:**
|
||||||
|
Use parameterized queries (e.g., `?` placeholders) and pass the `accountId` as an argument to `raw.prepare().all(accountId)`.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
function buildAccountFilter(accountId?: string): { sql: string; params: string[] } {
|
||||||
|
return accountId ? { sql: `AND account_id = ?`, params: [accountId] } : { sql: '', params: [] };
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### CR-02: Missing try-catch and cleanup around database connection in TokenUsageRepo queries
|
||||||
|
|
||||||
|
**File:** `src/ipc/database/usageHandler.ts:89`
|
||||||
|
**Issue:** In `TokenUsageRepo`, the schema explicitly sets `timestamp` as an `integer`, but `start` and `end` arguments are directly interpolated into the query via `buildDateFilter` (lines 23-29). If `start` or `end` are somehow strings, this could also lead to SQL injection.
|
||||||
|
**Fix:**
|
||||||
|
Ensure `start` and `end` are strictly validated as integers before passing to the query, or use parameterized queries.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
function buildDateFilter(start?: number, end?: number): { sql: string; params: number[] } {
|
||||||
|
const conditions: string[] = [];
|
||||||
|
const params: number[] = [];
|
||||||
|
if (start !== undefined) {
|
||||||
|
conditions.push(`timestamp >= ?`);
|
||||||
|
params.push(start);
|
||||||
|
}
|
||||||
|
if (end !== undefined) {
|
||||||
|
conditions.push(`timestamp <= ?`);
|
||||||
|
params.push(end);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
sql: conditions.length > 0 ? `AND ${conditions.join(' AND ')}` : '',
|
||||||
|
params,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Warnings
|
||||||
|
|
||||||
|
### WR-01: Synchronous Database Writing in ProxyService
|
||||||
|
|
||||||
|
**File:** `src/server/modules/proxy/proxy.service.ts:57`
|
||||||
|
**Issue:** The `recordUsage` method calls `this.tokenUsageService.recordUsage()`, which internally calls `TokenUsageRepo.recordUsage()`. `TokenUsageRepo.recordUsage()` performs a synchronous database insertion (`orm.insert(...).run()`) and closes the connection. Since this is called for every single proxy request (in `handleAnthropicMessages` and `handleOpenAIMessages`), the synchronous opening, inserting, and closing of the database connection could severely impact the performance and throughput of the proxy service under high load.
|
||||||
|
**Fix:** Consider making the usage recording asynchronous (fire-and-forget), using an asynchronous database driver, or implementing a batching mechanism for token usage recording to avoid blocking the proxy request cycle.
|
||||||
|
|
||||||
|
### WR-02: Missing Unsubscribe / Cleanup in React Query hooks
|
||||||
|
|
||||||
|
**File:** `src/routes/usage.tsx`
|
||||||
|
**Issue:** The `useQuery` hooks are configured properly, but the UI lacks an auto-refresh mechanism. Given this is a dashboard tracking live API usage, it might be beneficial to include a `refetchInterval` or a manual refresh button.
|
||||||
|
**Fix:** Add `refetchInterval: 10000` to the query configuration.
|
||||||
|
|
||||||
|
## Info
|
||||||
|
|
||||||
|
### IN-01: UI Chart Colors and Styling
|
||||||
|
|
||||||
|
**File:** `src/routes/usage.tsx:23`
|
||||||
|
**Issue:** The `COLORS` array is hardcoded with hex values. In a themable application (e.g., light/dark mode), these colors might not adapt correctly, potentially causing visibility issues on certain backgrounds.
|
||||||
|
**Fix:** Consider using CSS variables from the theme (e.g., `hsl(var(--primary))`) instead of hardcoded hex colors for Recharts components.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
_Reviewed: 2026-04-22T14:00:00Z_
|
||||||
|
_Reviewer: OpenCode (gsd-code-reviewer)_
|
||||||
|
_Depth: standard_
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
# Proxy Page — Feature Brainstorm
|
||||||
|
|
||||||
|
> Generated from designer agent analysis of `src/routes/proxy.tsx`
|
||||||
|
> Date: 2026-04-22
|
||||||
|
|
||||||
|
## Current State
|
||||||
|
|
||||||
|
The proxy page (`src/routes/proxy.tsx`) is a 724-line monolith that exposes basic proxy controls (start/stop, port, protocol, API key, code examples) but leaves significant value on the table. The backend (`ProxyService`, `ProxyModule`) already implements many advanced features with no UI exposure.
|
||||||
|
|
||||||
|
## Proposed New Features
|
||||||
|
|
||||||
|
### 1. Live Traffic Monitor
|
||||||
|
|
||||||
|
- Real-time SSE/WebSocket feed of proxied requests
|
||||||
|
- Show request method, model, account used, latency, token count
|
||||||
|
- Filter by status (success, rate-limited, error)
|
||||||
|
- Inspired by: Request logging already exists in `TrafficLogger`
|
||||||
|
|
||||||
|
### 2. IDE Quick-Connect Panel
|
||||||
|
|
||||||
|
- One-click copy of ready-to-use configurations for:
|
||||||
|
- Cursor (`settings.json` snippet)
|
||||||
|
- OpenCode (`.env` snippet)
|
||||||
|
- Windsurf (`config.yaml` snippet)
|
||||||
|
- Claude Code / CLI tools
|
||||||
|
- Include the local IP, port, and API key pre-filled
|
||||||
|
- QR code for mobile/quick access
|
||||||
|
|
||||||
|
### 3. API Playground
|
||||||
|
|
||||||
|
- Built-in Swagger/OpenAPI UI or custom test panel
|
||||||
|
- Pre-loaded with all supported endpoints:
|
||||||
|
- `/v1/chat/completions` (OpenAI-compatible)
|
||||||
|
- `/v1/messages` (Anthropic-compatible)
|
||||||
|
- `/v1beta/models/...generateContent` (Gemini-native)
|
||||||
|
- Allow sending test requests and viewing formatted responses
|
||||||
|
- Show exact curl equivalent for every request
|
||||||
|
|
||||||
|
### 4. Health Dashboard
|
||||||
|
|
||||||
|
- Real-time metrics cards:
|
||||||
|
- Requests/minute
|
||||||
|
- Average latency (p50, p95, p99)
|
||||||
|
- Error rate %
|
||||||
|
- Active connections
|
||||||
|
- Circuit breaker status (open/closed/half-open)
|
||||||
|
- Sparkline charts for the last 5 minutes
|
||||||
|
- Color-coded status indicators
|
||||||
|
|
||||||
|
### 5. Model Availability Status
|
||||||
|
|
||||||
|
- Live grid showing which models are currently available
|
||||||
|
- Per-model indicators:
|
||||||
|
- Green: available
|
||||||
|
- Yellow: rate-limited (retry after)
|
||||||
|
- Red: unavailable / quota exhausted
|
||||||
|
- Show last-used time and remaining quota (if known)
|
||||||
|
- Collapse/expand by provider (Gemini, Anthropic)
|
||||||
|
|
||||||
|
### 6. Error Feed
|
||||||
|
|
||||||
|
- Scrollable log of recent errors
|
||||||
|
- Columns: timestamp, endpoint, model, account, error code, message
|
||||||
|
- Click to expand full request/response
|
||||||
|
- Filter by error type (rate limit, timeout, auth, network)
|
||||||
|
- Export to JSON/CSV
|
||||||
|
|
||||||
|
### 7. Connection Visualizer
|
||||||
|
|
||||||
|
- Diagram showing: IDE → Proxy → Account Pool → Upstream API
|
||||||
|
- Animated flow dots representing live requests
|
||||||
|
- Highlight currently active account
|
||||||
|
- Show queue depth / waiting requests
|
||||||
|
- Simple but effective for understanding routing
|
||||||
|
|
||||||
|
### 8. One-Click Diagnostics
|
||||||
|
|
||||||
|
- "Run Diagnostics" button that performs:
|
||||||
|
- Check if proxy port is accessible
|
||||||
|
- Test each configured account
|
||||||
|
- Verify model mapping resolution
|
||||||
|
- Check upstream API reachability
|
||||||
|
- Validate API key format
|
||||||
|
- Output: green checkmarks or detailed error report with fix suggestions
|
||||||
|
|
||||||
|
### 9. Session Stats
|
||||||
|
|
||||||
|
- Summary of current session since proxy started:
|
||||||
|
- Total requests handled
|
||||||
|
- Total tokens proxied
|
||||||
|
- Unique accounts used
|
||||||
|
- Top 3 models used
|
||||||
|
- Uptime counter
|
||||||
|
- Resettable per-session (not persisted)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Implementation Notes
|
||||||
|
|
||||||
|
- Many of these features require new IPC endpoints in `src/ipc/proxy/router.ts`
|
||||||
|
- Health metrics likely already exist in `ProxyService` but need exposure
|
||||||
|
- Traffic logging exists via `TrafficLogger` — just needs UI
|
||||||
|
- Model availability data is already fetched for the account pool page
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
# Proxy Page — UI/UX Improvements
|
||||||
|
|
||||||
|
> Generated from designer agent analysis of `src/routes/proxy.tsx`
|
||||||
|
> Date: 2026-04-22
|
||||||
|
|
||||||
|
## Current Pain Points
|
||||||
|
|
||||||
|
1. **Visual noise**: Gradient backgrounds (`bg-gradient-to-br`) feel dated and clash with the dark, technical aesthetic
|
||||||
|
2. **Information overload**: All content is visible at once — no progressive disclosure
|
||||||
|
3. **Code examples dominate**: Large, always-visible code blocks push important controls below the fold
|
||||||
|
4. **Inconsistent density**: Too much padding in some areas, cramped in others
|
||||||
|
5. **Security concern**: API key is displayed in plain text with only a basic copy button
|
||||||
|
6. **No status context**: User can't see which account/model is being used for requests
|
||||||
|
|
||||||
|
## Proposed Improvements
|
||||||
|
|
||||||
|
### 1. Remove Gradient Backgrounds
|
||||||
|
|
||||||
|
- Replace `bg-gradient-to-br from-slate-800 to-slate-900` with solid `bg-card` or subtle borders
|
||||||
|
- Use elevation (borders, subtle shadows) instead of gradients to create hierarchy
|
||||||
|
- Align with the rest of the app which uses flat, technical styling
|
||||||
|
|
||||||
|
### 2. Tabs-Based Layout
|
||||||
|
|
||||||
|
Organize the page into tabs:
|
||||||
|
|
||||||
|
- **Status** (default): Service state, quick actions, health metrics
|
||||||
|
- **Routing**: Model mapping, account scheduling, protocol settings
|
||||||
|
- **API Docs**: Code examples, endpoint documentation, IDE configs
|
||||||
|
- **Logs**: Live traffic feed, error history
|
||||||
|
|
||||||
|
### 3. Compact Protocol Selector
|
||||||
|
|
||||||
|
- Current: large buttons with icons
|
||||||
|
- Proposed: `Select` dropdown or compact segmented control
|
||||||
|
- Save horizontal space for more important controls
|
||||||
|
|
||||||
|
### 4. Collapsible Code Examples
|
||||||
|
|
||||||
|
- Wrap each code block in a `Collapsible` or `Accordion`
|
||||||
|
- Show only the title + language icon by default
|
||||||
|
- Expand on click
|
||||||
|
- Add nested tabs for different languages (cURL, Python, JavaScript, TypeScript)
|
||||||
|
|
||||||
|
### 5. Security-Focused API Key Display
|
||||||
|
|
||||||
|
- Mask the API key by default (show `sk-••••••••`)
|
||||||
|
- Reveal on explicit "Show" toggle
|
||||||
|
- Add "Regenerate" button with confirmation dialog
|
||||||
|
- Show "Last used" timestamp
|
||||||
|
- Add warning if key is the default/weak key
|
||||||
|
|
||||||
|
### 6. Configurable Model Mapping Table
|
||||||
|
|
||||||
|
- Instead of a static list, show an editable table:
|
||||||
|
- Requested model | Resolved model | Provider | Status
|
||||||
|
- Allow users to add custom mappings
|
||||||
|
- Show which mappings are active/inactive
|
||||||
|
- Validate that resolved models exist in the account pool
|
||||||
|
|
||||||
|
### 7. Account Quota Context
|
||||||
|
|
||||||
|
- Show the currently selected "primary" account with its quota bar
|
||||||
|
- If auto-switching is enabled, show "Pool Mode: Active (N accounts)"
|
||||||
|
- Link to the account pool page for detailed management
|
||||||
|
|
||||||
|
### 8. Toast Copy Feedback
|
||||||
|
|
||||||
|
- When user clicks "Copy", show a `Toast` or `Sonner` notification
|
||||||
|
- Current: no feedback — user doesn't know if copy succeeded
|
||||||
|
- Message: "Copied to clipboard" or "Failed to copy"
|
||||||
|
|
||||||
|
### 9. Health Metrics Stub
|
||||||
|
|
||||||
|
- Even if backend metrics aren't wired yet, create the UI skeleton
|
||||||
|
- Show placeholder charts with "Coming soon" badge
|
||||||
|
- This sets expectations and makes the page feel more complete
|
||||||
|
|
||||||
|
### 10. Empty States
|
||||||
|
|
||||||
|
- When proxy is stopped, show a clear empty state:
|
||||||
|
- Icon: `ServerOff` from lucide
|
||||||
|
- Message: "Proxy is not running"
|
||||||
|
- Action: "Start Proxy" button prominently displayed
|
||||||
|
- When no accounts are configured, show a CTA to add accounts
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Design Principles
|
||||||
|
|
||||||
|
- **Density over whitespace**: This is a developer tool — show more information per pixel
|
||||||
|
- **Progressive disclosure**: Hide advanced options behind tabs/accordions
|
||||||
|
- **Immediate feedback**: Every action should have a visible result (toast, spinner, state change)
|
||||||
|
- **Security first**: API keys and sensitive data should never be displayed casually
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
# Proxy Page — Advanced Features Hidden in Backend
|
||||||
|
|
||||||
|
> Generated from oracle agent analysis of `src/server/modules/proxy/`
|
||||||
|
> Date: 2026-04-22
|
||||||
|
|
||||||
|
## Discovery
|
||||||
|
|
||||||
|
The backend (`ProxyService`, `ProxyController`, `ProxyModule`) implements many sophisticated features that are **completely invisible** in the current UI. The proxy page only shows: port, protocol, API key, and basic start/stop.
|
||||||
|
|
||||||
|
## Hidden Backend Features
|
||||||
|
|
||||||
|
### 1. Advanced Routing & Scheduling Controls
|
||||||
|
|
||||||
|
**Backend location**: `proxy.service.ts`, `proxy-scheduler.service.ts`
|
||||||
|
**What's implemented**:
|
||||||
|
|
||||||
|
- `scheduler.maxRequestsPerAccount`: Limit requests per account before switching
|
||||||
|
- `scheduler.maxWaitTime`: Max time to wait for an available account
|
||||||
|
- `scheduler.retryAttempts`: Number of retries per request
|
||||||
|
- `scheduler.backoffStrategy`: `exponential` | `linear` | `fixed`
|
||||||
|
- `scheduler.priorityAccounts`: Array of account IDs to prioritize
|
||||||
|
|
||||||
|
**UI exposure**: None. These are hardcoded or set via config files only.
|
||||||
|
|
||||||
|
### 2. Live Traffic Inspector
|
||||||
|
|
||||||
|
**Backend location**: `traffic-logger.service.ts`
|
||||||
|
**What's implemented**:
|
||||||
|
|
||||||
|
- `TrafficLogger` captures every request/response with metadata
|
||||||
|
- Fields: timestamp, requestId, accountId, model, promptTokens, completionTokens, latency, status, error
|
||||||
|
- Log rotation and cleanup policies
|
||||||
|
- Export to JSON/CSV
|
||||||
|
|
||||||
|
**UI exposure**: None. Logs are only written to files.
|
||||||
|
|
||||||
|
### 3. Circuit Breaker Dashboard
|
||||||
|
|
||||||
|
**Backend location**: `proxy-circuit-breaker.service.ts`
|
||||||
|
**What's implemented**:
|
||||||
|
|
||||||
|
- Per-account circuit breaker state: `CLOSED`, `OPEN`, `HALF_OPEN`
|
||||||
|
- Failure threshold and recovery timeout
|
||||||
|
- When open: requests fail fast without hitting the API
|
||||||
|
- Metrics: failure rate, last failure time, consecutive successes
|
||||||
|
|
||||||
|
**UI exposure**: None. Circuit breaker state is internal only.
|
||||||
|
|
||||||
|
### 4. Parity Testing Sandbox
|
||||||
|
|
||||||
|
**Backend location**: `proxy-parity.service.ts`
|
||||||
|
**What's implemented**:
|
||||||
|
|
||||||
|
- Send identical requests to multiple models simultaneously
|
||||||
|
- Compare responses for consistency
|
||||||
|
- Detect model drift or API changes
|
||||||
|
- Configurable test suites
|
||||||
|
|
||||||
|
**UI exposure**: None. Only accessible via manual API calls or scripts.
|
||||||
|
|
||||||
|
### 5. Custom Model Mapping Table
|
||||||
|
|
||||||
|
**Backend location**: `proxy-model-mapper.service.ts`
|
||||||
|
**What's implemented**:
|
||||||
|
|
||||||
|
- Dynamic model resolution: `claude-opus-4` → `gemini-3-flash`
|
||||||
|
- User-defined mappings stored in database
|
||||||
|
- Regex-based model matching
|
||||||
|
- Fallback chain: if mapped model unavailable, try next
|
||||||
|
|
||||||
|
**UI exposure**: A static, read-only list is shown. No editing capability.
|
||||||
|
|
||||||
|
### 6. Upstream Proxy Configuration
|
||||||
|
|
||||||
|
**Backend location**: `proxy-upstream.service.ts`
|
||||||
|
**What's implemented**:
|
||||||
|
|
||||||
|
- `upstreamProxy.url`: Route all traffic through another proxy
|
||||||
|
- `upstreamProxy.auth`: Basic auth or bearer token for upstream
|
||||||
|
- `upstreamProxy.bypassList`: Domains to bypass
|
||||||
|
|
||||||
|
**UI exposure**: None. Set via environment variables only.
|
||||||
|
|
||||||
|
### 7. IDE Integration Quick-Setup
|
||||||
|
|
||||||
|
**Backend location**: `proxy-config.service.ts` — `generateIdeConfig()`
|
||||||
|
**What's implemented**:
|
||||||
|
|
||||||
|
- Generates ready-to-paste configs for:
|
||||||
|
- Cursor (`settings.json`)
|
||||||
|
- VS Code + Cline/Roo Code
|
||||||
|
- OpenCode (`.env`)
|
||||||
|
- Claude Code (`claude_desktop_config.json`)
|
||||||
|
- Generic OpenAI client
|
||||||
|
- Includes local IP detection, port, and API key
|
||||||
|
|
||||||
|
**UI exposure**: Code examples are generic curl snippets. No IDE-specific configs.
|
||||||
|
|
||||||
|
### 8. Health & Performance Metrics
|
||||||
|
|
||||||
|
**Backend location**: `proxy-metrics.service.ts`
|
||||||
|
**What's implemented**:
|
||||||
|
|
||||||
|
- Request latency histogram (p50, p95, p99)
|
||||||
|
- Requests per minute counter
|
||||||
|
- Error rate by status code
|
||||||
|
- Active connection gauge
|
||||||
|
- Token throughput (tokens/minute)
|
||||||
|
- Account utilization percentage
|
||||||
|
|
||||||
|
**UI exposure**: None. Metrics are only exposed via a `/metrics` endpoint for Prometheus.
|
||||||
|
|
||||||
|
### 9. Request Replay & Debug Tool
|
||||||
|
|
||||||
|
**Backend location**: `proxy-replay.service.ts`
|
||||||
|
**What's implemented**:
|
||||||
|
|
||||||
|
- Store recent requests (last 100 by default)
|
||||||
|
- Replay any request with one click
|
||||||
|
- Modify headers/body before replay
|
||||||
|
- Compare original vs. replayed response
|
||||||
|
- Export request as curl command
|
||||||
|
|
||||||
|
**UI exposure**: None.
|
||||||
|
|
||||||
|
### 10. Global Timeout & Max Wait Controls
|
||||||
|
|
||||||
|
**Backend location**: `proxy-config.service.ts`
|
||||||
|
**What's implemented**:
|
||||||
|
|
||||||
|
- `requestTimeout`: Global timeout for all upstream requests
|
||||||
|
- `connectTimeout`: TCP connection timeout
|
||||||
|
- `maxWaitTime`: Max time to wait for an available account
|
||||||
|
- `idleTimeout`: Close idle connections after N seconds
|
||||||
|
|
||||||
|
**UI exposure**: None. Hardcoded defaults.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Recommendation
|
||||||
|
|
||||||
|
Create a new "Advanced" tab on the proxy page that exposes these features progressively:
|
||||||
|
|
||||||
|
1. **Phase 1**: Read-only views (circuit breaker status, health metrics, traffic logs)
|
||||||
|
2. **Phase 2**: Interactive controls (model mapping editor, scheduler settings)
|
||||||
|
3. **Phase 3**: Power-user tools (replay, parity testing, upstream proxy config)
|
||||||
|
|
||||||
|
This would transform the proxy page from a simple on/off switch into a comprehensive API gateway dashboard.
|
||||||
@@ -0,0 +1,179 @@
|
|||||||
|
# Proxy Page — Code Organization Refactoring Plan
|
||||||
|
|
||||||
|
> Generated from oracle agent analysis of `src/routes/proxy.tsx`
|
||||||
|
> Date: 2026-04-22
|
||||||
|
|
||||||
|
## Current State
|
||||||
|
|
||||||
|
`src/routes/proxy.tsx` is a **724-line monolith** containing:
|
||||||
|
|
||||||
|
- Route definition
|
||||||
|
- State management (useState, useEffect, useMemo)
|
||||||
|
- Data fetching (useQuery equivalents for proxy config, local IPs)
|
||||||
|
- Derived state (code examples, URLs)
|
||||||
|
- UI rendering (service card, model mapping, code examples, local access banner)
|
||||||
|
- Event handlers (start/stop, copy, protocol change)
|
||||||
|
- Constants and helper functions
|
||||||
|
|
||||||
|
## Target Architecture
|
||||||
|
|
||||||
|
Split into **7+ files** following the project's conventions:
|
||||||
|
|
||||||
|
```
|
||||||
|
src/
|
||||||
|
├── routes/
|
||||||
|
│ └── proxy.tsx # ~50 lines — route definition + composition
|
||||||
|
├── components/
|
||||||
|
│ └── proxy/
|
||||||
|
│ ├── ProxyServiceCard.tsx
|
||||||
|
│ ├── ProxyModelMappingCard.tsx
|
||||||
|
│ ├── ProxyUsageExamplesCard.tsx
|
||||||
|
│ └── ProxyLocalAccessBanner.tsx
|
||||||
|
├── hooks/
|
||||||
|
│ ├── useProxyConfig.ts
|
||||||
|
│ ├── useLocalIps.ts
|
||||||
|
│ └── useProxyExamples.ts
|
||||||
|
├── constants/
|
||||||
|
│ └── proxy.ts # API endpoints, default ports, protocols
|
||||||
|
└── utils/
|
||||||
|
└── proxy.ts # URL builders, formatters, parsers
|
||||||
|
```
|
||||||
|
|
||||||
|
## File Breakdown
|
||||||
|
|
||||||
|
### 1. `src/hooks/useProxyConfig.ts`
|
||||||
|
|
||||||
|
**Responsibility**: Fetch and mutate proxy configuration
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
export function useProxyConfig() {
|
||||||
|
// Fetches from ipc.client.proxy.getConfig()
|
||||||
|
// Provides: config, isLoading, error, updateConfig, startProxy, stopProxy
|
||||||
|
// Handles optimistic updates for start/stop toggling
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. `src/hooks/useLocalIps.ts`
|
||||||
|
|
||||||
|
**Responsibility**: Get local IP addresses for the access banner
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
export function useLocalIps() {
|
||||||
|
// Fetches from ipc.client.system.getLocalIps()
|
||||||
|
// Returns: ips[], isLoading, error
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. `src/hooks/useProxyExamples.ts`
|
||||||
|
|
||||||
|
**Responsibility**: Generate code examples based on current config
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
export function useProxyExamples(config: ProxyConfig, localIps: string[]) {
|
||||||
|
// Returns memoized examples for curl, Python, Node.js
|
||||||
|
// Updates when port, protocol, or API key changes
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. `src/components/proxy/ProxyServiceCard.tsx`
|
||||||
|
|
||||||
|
**Responsibility**: The main service control card
|
||||||
|
|
||||||
|
- Start/stop toggle
|
||||||
|
- Port input
|
||||||
|
- Protocol selector
|
||||||
|
- API key display (with mask/reveal)
|
||||||
|
- Status indicator
|
||||||
|
|
||||||
|
### 5. `src/components/proxy/ProxyModelMappingCard.tsx`
|
||||||
|
|
||||||
|
**Responsibility**: Model mapping display/editor
|
||||||
|
|
||||||
|
- Read-only list (current state)
|
||||||
|
- Future: editable table with add/remove
|
||||||
|
- Show provider badges
|
||||||
|
|
||||||
|
### 6. `src/components/proxy/ProxyUsageExamplesCard.tsx`
|
||||||
|
|
||||||
|
**Responsibility**: Code examples section
|
||||||
|
|
||||||
|
- Collapsible/accordion layout
|
||||||
|
- Tabs for different languages
|
||||||
|
- Copy-to-clipboard buttons
|
||||||
|
- Syntax highlighting (if available)
|
||||||
|
|
||||||
|
### 7. `src/components/proxy/ProxyLocalAccessBanner.tsx`
|
||||||
|
|
||||||
|
**Responsibility**: "Access your proxy locally" banner
|
||||||
|
|
||||||
|
- Show local IPs
|
||||||
|
- QR code (future)
|
||||||
|
- Copy URL buttons
|
||||||
|
|
||||||
|
### 8. `src/constants/proxy.ts`
|
||||||
|
|
||||||
|
**Responsibility**: Constants
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
export const DEFAULT_PROXY_PORT = 3000;
|
||||||
|
export const PROTOCOLS = ['http', 'https'] as const;
|
||||||
|
export const EXAMPLE_MODELS = ['gpt-4o', 'claude-3-opus', 'gemini-pro'];
|
||||||
|
```
|
||||||
|
|
||||||
|
### 9. `src/utils/proxy.ts`
|
||||||
|
|
||||||
|
**Responsibility**: Pure helper functions
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
export function buildProxyUrl(protocol: string, ip: string, port: number): string;
|
||||||
|
export function maskApiKey(key: string): string;
|
||||||
|
export function formatCurlExample(url: string, model: string, apiKey: string): string;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Route File After Refactoring
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// src/routes/proxy.tsx — ~50 lines
|
||||||
|
import { createFileRoute } from '@tanstack/react-router';
|
||||||
|
import { useProxyConfig } from '@/hooks/useProxyConfig';
|
||||||
|
import { useLocalIps } from '@/hooks/useLocalIps';
|
||||||
|
import { ProxyServiceCard } from '@/components/proxy/ProxyServiceCard';
|
||||||
|
import { ProxyModelMappingCard } from '@/components/proxy/ProxyModelMappingCard';
|
||||||
|
import { ProxyUsageExamplesCard } from '@/components/proxy/ProxyUsageExamplesCard';
|
||||||
|
import { ProxyLocalAccessBanner } from '@/components/proxy/ProxyLocalAccessBanner';
|
||||||
|
|
||||||
|
function ProxyPage() {
|
||||||
|
const { config, isLoading, startProxy, stopProxy } = useProxyConfig();
|
||||||
|
const { ips } = useLocalIps();
|
||||||
|
|
||||||
|
if (isLoading) return <ProxySkeleton />;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-6 p-6">
|
||||||
|
<ProxyServiceCard config={config} onStart={startProxy} onStop={stopProxy} />
|
||||||
|
<ProxyModelMappingCard mappings={config.modelMappings} />
|
||||||
|
<ProxyUsageExamplesCard config={config} ips={ips} />
|
||||||
|
<ProxyLocalAccessBanner ips={ips} port={config.port} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Route = createFileRoute('/proxy')({ component: ProxyPage });
|
||||||
|
```
|
||||||
|
|
||||||
|
## Migration Steps
|
||||||
|
|
||||||
|
1. Create new files (hooks, components, constants, utils)
|
||||||
|
2. Move code from `proxy.tsx` to appropriate files
|
||||||
|
3. Update imports in `proxy.tsx`
|
||||||
|
4. Extract and test each hook independently
|
||||||
|
5. Add Storybook stories for each component (if Storybook is used)
|
||||||
|
6. Verify no regression in functionality
|
||||||
|
|
||||||
|
## Benefits
|
||||||
|
|
||||||
|
- **Testability**: Each hook and component can be unit tested in isolation
|
||||||
|
- **Reusability**: `useLocalIps` can be used in other pages (e.g., settings)
|
||||||
|
- **Maintainability**: 50-line route file vs. 724-line monolith
|
||||||
|
- **Code review**: Smaller files = faster, more focused PRs
|
||||||
|
- **Onboarding**: New developers can understand the page in minutes
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
# Proxy Page — Code Quality Issues
|
||||||
|
|
||||||
|
> Generated from fixer agent analysis of `src/routes/proxy.tsx`
|
||||||
|
> Date: 2026-04-22
|
||||||
|
|
||||||
|
## Severity Legend
|
||||||
|
|
||||||
|
- 🔴 **Critical**: Bugs or crashes
|
||||||
|
- 🟡 **High**: Performance or reliability issues
|
||||||
|
- 🟢 **Medium**: Maintainability or best practice violations
|
||||||
|
|
||||||
|
## Issues Found
|
||||||
|
|
||||||
|
### 1. 🔴 State Duplication Between Proxy Config and Local State
|
||||||
|
|
||||||
|
**Location**: Lines ~120-180
|
||||||
|
**Issue**: The component maintains both `proxyConfig` (from IPC) and local `useState` copies for `port`, `protocol`, `apiKey`. These can drift out of sync if the backend config changes externally.
|
||||||
|
**Fix**: Use a single source of truth. Either:
|
||||||
|
|
||||||
|
- Derive local state from `proxyConfig` with `useEffect` sync
|
||||||
|
- Or use `useQuery` with `staleTime: 0` and no local cache
|
||||||
|
|
||||||
|
### 2. 🟡 Race Condition in Start/Stop Toggle
|
||||||
|
|
||||||
|
**Location**: Lines ~200-250
|
||||||
|
**Issue**: If user clicks start/stop rapidly, multiple IPC calls fire in parallel. The UI shows intermediate states that may not reflect the actual backend state.
|
||||||
|
**Fix**: Disable the toggle button while a transition is in progress. Add an `isTransitioning` flag.
|
||||||
|
|
||||||
|
### 3. 🟢 Clipboard Error Handling
|
||||||
|
|
||||||
|
**Location**: Lines ~300-320
|
||||||
|
**Issue**: `navigator.clipboard.writeText()` can fail (permission denied, not in secure context). The code has no try/catch.
|
||||||
|
**Fix**:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
async function copyToClipboard(text: string) {
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(text);
|
||||||
|
toast.success('Copied!');
|
||||||
|
} catch {
|
||||||
|
toast.error('Failed to copy');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 🟢 Unstable Callbacks Causing Re-renders
|
||||||
|
|
||||||
|
**Location**: Throughout
|
||||||
|
**Issue**: Event handlers are defined inline in JSX, causing child components to re-render unnecessarily.
|
||||||
|
**Fix**: Wrap handlers in `useCallback`:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const handleStart = useCallback(() => startProxy(), [startProxy]);
|
||||||
|
const handleStop = useCallback(() => stopProxy(), [stopProxy]);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. 🟡 Memory Leak in setTimeout
|
||||||
|
|
||||||
|
**Location**: Lines ~400-420
|
||||||
|
**Issue**: A `setTimeout` is used for a "copy feedback" animation but is never cleared on unmount.
|
||||||
|
**Fix**: Use `useEffect` cleanup:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
useEffect(() => {
|
||||||
|
const timer = setTimeout(() => setCopied(false), 2000);
|
||||||
|
return () => clearTimeout(timer);
|
||||||
|
}, [copied]);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. 🟢 Missing Loading States for Mutations
|
||||||
|
|
||||||
|
**Location**: Lines ~200-250
|
||||||
|
**Issue**: When starting/stopping the proxy, there's no loading spinner or disabled state on the button.
|
||||||
|
**Fix**: Add `isPending` state to the mutation hook and disable the button + show spinner while pending.
|
||||||
|
|
||||||
|
### 7. 🟢 Hardcoded i18n Strings
|
||||||
|
|
||||||
|
**Location**: Throughout
|
||||||
|
**Issue**: Many UI strings are hardcoded in English instead of using `useTranslation()`:
|
||||||
|
|
||||||
|
- "Proxy Service"
|
||||||
|
- "Start Proxy"
|
||||||
|
- "Stop Proxy"
|
||||||
|
- "Copy"
|
||||||
|
- "Copied!"
|
||||||
|
**Fix**: Extract all strings to `src/localization/i18n.ts` and use `t('proxy.startProxy')`, etc.
|
||||||
|
|
||||||
|
### 8. 🟢 Magic Numbers
|
||||||
|
|
||||||
|
**Location**: Lines ~450-500
|
||||||
|
**Issue**: Port validation uses hardcoded `3000`, `65535` without constants.
|
||||||
|
**Fix**:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const MIN_PORT = 1024;
|
||||||
|
const MAX_PORT = 65535;
|
||||||
|
const DEFAULT_PORT = 3000;
|
||||||
|
```
|
||||||
|
|
||||||
|
### 9. 🟢 Unsafe Type Cast
|
||||||
|
|
||||||
|
**Location**: Lines ~550-600
|
||||||
|
**Issue**: `event.target.value` is cast to `Protocol` without validation.
|
||||||
|
**Fix**:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const protocol = event.target.value;
|
||||||
|
if (!PROTOCOLS.includes(protocol)) return;
|
||||||
|
setProtocol(protocol as Protocol);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 10. 🟡 Dangerous Parsing of Local IPs
|
||||||
|
|
||||||
|
**Location**: Lines ~650-700
|
||||||
|
**Issue**: `localIps` is parsed from a shell command output using string splitting that could break on unexpected formats.
|
||||||
|
**Fix**: Use a robust parser or, better, expose `os.networkInterfaces()` via a safe IPC endpoint.
|
||||||
|
|
||||||
|
### 11. 🟢 Unnecessary Re-renders from Inline Objects
|
||||||
|
|
||||||
|
**Location**: Lines ~350-380
|
||||||
|
**Issue**: Inline style objects and arrays are recreated on every render, breaking `React.memo` optimizations in child components.
|
||||||
|
**Fix**: Extract static styles outside the component or memoize:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const cardStyle = useMemo(() => ({ padding: '1.5rem' }), []);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 12. 🟢 No Validation on Port Input
|
||||||
|
|
||||||
|
**Location**: Lines ~150-170
|
||||||
|
**Issue**: User can type any value into the port field, including non-numbers, negatives, or out-of-range values.
|
||||||
|
**Fix**: Add input validation:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
min={1024}
|
||||||
|
max={65535}
|
||||||
|
value={port}
|
||||||
|
onChange={(e) => {
|
||||||
|
const value = parseInt(e.target.value, 10);
|
||||||
|
if (value >= 1024 && value <= 65535) setPort(value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Testing Recommendations
|
||||||
|
|
||||||
|
- Add unit tests for `useProxyConfig` hook (mock IPC client)
|
||||||
|
- Test race conditions: rapid start/stop clicks
|
||||||
|
- Test clipboard failure path
|
||||||
|
- Test port validation edge cases (0, 80, 65536, NaN)
|
||||||
|
- Test with `react-testing-library` + `user-event`
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
# Proxy Page — Architecture Overview
|
||||||
|
|
||||||
|
> Generated from explorer agent mapping of proxy-related files
|
||||||
|
> Date: 2026-04-22
|
||||||
|
|
||||||
|
## File Map
|
||||||
|
|
||||||
|
### Frontend
|
||||||
|
|
||||||
|
| File | Lines | Role |
|
||||||
|
| -------------------------------------------- | ----- | ---------------------------------------- |
|
||||||
|
| `src/routes/proxy.tsx` | 724 | Main proxy page (monolith) |
|
||||||
|
| `src/components/ModelVisibilitySettings.tsx` | ~200 | Model visibility toggle grid |
|
||||||
|
| `src/components/AccountProxySettings.tsx` | ~180 | Per-account proxy configuration |
|
||||||
|
| `src/hooks/useCloudAccounts.ts` | ~50 | Fetches cloud accounts for proxy routing |
|
||||||
|
|
||||||
|
### Backend (NestJS)
|
||||||
|
|
||||||
|
| File | Role |
|
||||||
|
| ----------------------------------------------------------- | ------------------------------------------- |
|
||||||
|
| `src/server/modules/proxy/proxy.module.ts` | NestJS module definition |
|
||||||
|
| `src/server/modules/proxy/proxy.service.ts` | 1883 lines — core proxy logic, all handlers |
|
||||||
|
| `src/server/modules/proxy/proxy.controller.ts` | HTTP endpoints for proxy control |
|
||||||
|
| `src/server/modules/proxy/proxy-scheduler.service.ts` | Account rotation & scheduling |
|
||||||
|
| `src/server/modules/proxy/proxy-circuit-breaker.service.ts` | Per-account circuit breaker |
|
||||||
|
| `src/server/modules/proxy/traffic-logger.service.ts` | Request/response logging |
|
||||||
|
| `src/server/modules/proxy/proxy-metrics.service.ts` | Prometheus metrics |
|
||||||
|
| `src/server/modules/proxy/proxy-model-mapper.service.ts` | Model name resolution |
|
||||||
|
| `src/server/modules/proxy/proxy-parity.service.ts` | Parity testing |
|
||||||
|
| `src/server/modules/proxy/proxy-replay.service.ts` | Request replay |
|
||||||
|
| `src/server/modules/proxy/proxy-config.service.ts` | Config management |
|
||||||
|
| `src/server/modules/proxy/proxy-upstream.service.ts` | Upstream proxy support |
|
||||||
|
|
||||||
|
### IPC Layer
|
||||||
|
|
||||||
|
| File | Role |
|
||||||
|
| ------------------------- | ---------------------------- |
|
||||||
|
| `src/ipc/router.ts` | Main IPC router composition |
|
||||||
|
| `src/ipc/proxy/router.ts` | Proxy-specific IPC endpoints |
|
||||||
|
| `src/ipc/manager.ts` | IPC client initialization |
|
||||||
|
|
||||||
|
### Types & Schema
|
||||||
|
|
||||||
|
| File | Role |
|
||||||
|
| --------------------- | ------------------------------------------------ |
|
||||||
|
| `src/types/config.ts` | `ProxyConfig` Zod schema — reveals hidden fields |
|
||||||
|
| `src/types/proxy.ts` | Request/response types |
|
||||||
|
|
||||||
|
## Hidden ProxyConfig Fields
|
||||||
|
|
||||||
|
The `ProxyConfig` schema in `src/types/config.ts` contains many fields never shown in the UI:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface ProxyConfig {
|
||||||
|
// Shown in UI
|
||||||
|
enabled: boolean;
|
||||||
|
port: number;
|
||||||
|
protocol: 'http' | 'https';
|
||||||
|
apiKey: string;
|
||||||
|
|
||||||
|
// Hidden from UI
|
||||||
|
scheduler: {
|
||||||
|
maxRequestsPerAccount: number;
|
||||||
|
maxWaitTime: number;
|
||||||
|
retryAttempts: number;
|
||||||
|
backoffStrategy: 'exponential' | 'linear' | 'fixed';
|
||||||
|
priorityAccounts: string[];
|
||||||
|
};
|
||||||
|
upstreamProxy?: {
|
||||||
|
url: string;
|
||||||
|
auth?: { username: string; password: string };
|
||||||
|
bypassList: string[];
|
||||||
|
};
|
||||||
|
circuitBreaker: {
|
||||||
|
failureThreshold: number;
|
||||||
|
recoveryTimeout: number;
|
||||||
|
halfOpenMaxCalls: number;
|
||||||
|
};
|
||||||
|
logging: {
|
||||||
|
enabled: boolean;
|
||||||
|
maxEntries: number;
|
||||||
|
retentionDays: number;
|
||||||
|
};
|
||||||
|
metrics: {
|
||||||
|
enabled: boolean;
|
||||||
|
histogramBuckets: number[];
|
||||||
|
};
|
||||||
|
modelMappings: Array<{
|
||||||
|
from: string;
|
||||||
|
to: string;
|
||||||
|
provider: string;
|
||||||
|
enabled: boolean;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Data Flow
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────┐ IPC ┌──────────────────┐
|
||||||
|
│ proxy.tsx │ ◄──────────► │ proxy/router.ts │
|
||||||
|
│ (React UI) │ │ (IPC handlers) │
|
||||||
|
└─────────────────┘ └────────┬─────────┘
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
┌──────────────────────┐
|
||||||
|
│ ProxyController │
|
||||||
|
│ (HTTP endpoints) │
|
||||||
|
└────────┬─────────────┘
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
┌──────────────────────┐
|
||||||
|
│ ProxyService │
|
||||||
|
│ (Core orchestrator) │
|
||||||
|
└────────┬─────────────┘
|
||||||
|
│
|
||||||
|
┌──────────────────┼──────────────────┐
|
||||||
|
│ │ │
|
||||||
|
▼ ▼ ▼
|
||||||
|
┌─────────────┐ ┌───────────────┐ ┌──────────────┐
|
||||||
|
│ Scheduler │ │ CircuitBreaker│ │Model Mapper │
|
||||||
|
└─────────────┘ └───────────────┘ └──────────────┘
|
||||||
|
│ │ │
|
||||||
|
▼ ▼ ▼
|
||||||
|
┌─────────────┐ ┌───────────────┐ ┌──────────────┐
|
||||||
|
│TrafficLogger│ │MetricsService │ │ParityService │
|
||||||
|
└─────────────┘ └───────────────┘ └──────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
## Key Observations
|
||||||
|
|
||||||
|
1. **Backend is significantly more capable than the UI suggests** — 12 services vs. 1 page
|
||||||
|
2. **IPC layer is thin** — most backend services are not exposed via IPC, only HTTP
|
||||||
|
3. **ProxyConfig schema is the source of truth** — it documents everything the backend can do
|
||||||
|
4. **No real-time communication** — UI polls for status; no WebSocket or SSE for live updates
|
||||||
|
5. **Separation of concerns is good on backend**, terrible on frontend (724-line monolith)
|
||||||
|
|
||||||
|
## Recommended Architecture Changes
|
||||||
|
|
||||||
|
1. Extend `src/ipc/proxy/router.ts` to expose all `ProxyConfig` fields
|
||||||
|
2. Add IPC endpoints for:
|
||||||
|
- `proxy.getTrafficLogs()`
|
||||||
|
- `proxy.getCircuitBreakerStatus()`
|
||||||
|
- `proxy.getMetrics()`
|
||||||
|
- `proxy.replayRequest()`
|
||||||
|
3. Create a WebSocket or SSE channel for live traffic updates
|
||||||
|
4. Refactor frontend into the 7-file structure proposed in `04-code-organization.md`
|
||||||
@@ -12,6 +12,30 @@
|
|||||||
"outFiles": ["${workspaceFolder}/.vite/build/**/*.js"],
|
"outFiles": ["${workspaceFolder}/.vite/build/**/*.js"],
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"autoAttachChildProcesses": true
|
"autoAttachChildProcesses": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Debug Main Process (Proxyman)",
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"runtimeExecutable": "cmd.exe",
|
||||||
|
"runtimeArgs": ["/c", "npm", "run", "start"],
|
||||||
|
"sourceMaps": true,
|
||||||
|
"outFiles": ["${workspaceFolder}/.vite/build/**/*.js"],
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"autoAttachChildProcesses": true,
|
||||||
|
"env": {
|
||||||
|
"NODE_USE_ENV_PROXY": "1",
|
||||||
|
"HTTP_PROXY": "http://127.0.0.1:9090",
|
||||||
|
"HTTPS_PROXY": "http://127.0.0.1:9090",
|
||||||
|
"ALL_PROXY": "http://127.0.0.1:9090",
|
||||||
|
"NO_PROXY": "localhost,127.0.0.1,::1",
|
||||||
|
"ELECTRON_PROXY_SERVER": "http://127.0.0.1:9090",
|
||||||
|
"ELECTRON_PROXY_BYPASS_LIST": "<local>;localhost;127.0.0.1;::1",
|
||||||
|
"DEBUG_PROXY_TRACE": "1",
|
||||||
|
"NODE_EXTRA_CA_CERTS": "C:\\Users\\Administrator\\AppData\\Roaming\\Proxyman\\certificate\\certs\\ca.pem",
|
||||||
|
"NODE_TLS_REJECT_UNAUTHORIZED": "0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ This document is a user-level guide for AI assistants working in this repository
|
|||||||
|
|
||||||
- **Runtime**: Node.js (Electron environment)
|
- **Runtime**: Node.js (Electron environment)
|
||||||
- **Node**: Recommended Node.js 20+
|
- **Node**: Recommended Node.js 20+
|
||||||
- **Package manager**: `npm` (this project includes `package-lock.json`; use npm only)
|
- **Package manager**: `pnpm` (this project includes `pnpm-lock.yaml`; use pnpm only)
|
||||||
- **Build tools**: Electron Forge + Vite
|
- **Build tools**: Electron Forge + Vite
|
||||||
- **Terminal**: Windows (PowerShell) / VSCode MCP tools can be used safely
|
- **Terminal**: Windows (PowerShell) / VSCode MCP tools can be used safely
|
||||||
|
|
||||||
@@ -75,32 +75,32 @@ This document is a user-level guide for AI assistants working in this repository
|
|||||||
|
|
||||||
## 📦 Common Scripts
|
## 📦 Common Scripts
|
||||||
|
|
||||||
Use `npm` for all commands:
|
Use `pnpm` for all commands:
|
||||||
|
|
||||||
- **Development (Dev)**:
|
- **Development (Dev)**:
|
||||||
- `npm start` - Start Electron dev environment (Electron Forge)
|
- `pnpm start` - Start Electron dev environment (Electron Forge)
|
||||||
- `npm run lint` - Run ESLint checks
|
- `pnpm run lint` - Run ESLint checks
|
||||||
- `npm run format` - Run Prettier check
|
- `pnpm run format` - Run Prettier check
|
||||||
- `npm run format:write` - Auto-format with Prettier
|
- `pnpm run format:write` - Auto-format with Prettier
|
||||||
- `npm run type-check` - Run TypeScript type check
|
- `pnpm run type-check` - Run TypeScript type check
|
||||||
|
|
||||||
- **Build**:
|
- **Build**:
|
||||||
- `npm run package` - Package app (application bundle only)
|
- `pnpm run package` - Package app (application bundle only)
|
||||||
- `npm run make` - Build and generate distributable installers
|
- `pnpm run make` - Build and generate distributable installers
|
||||||
- `npm run publish` - Publish app
|
- `pnpm run publish` - Publish app
|
||||||
|
|
||||||
- **Testing**:
|
- **Testing**:
|
||||||
- `npm test` - Run Vitest tests
|
- `pnpm test` - Run Vitest tests
|
||||||
- `npm run test:watch` - Run Vitest in watch mode
|
- `pnpm run test:watch` - Run Vitest in watch mode
|
||||||
- `npm run test:unit` - Same as above for unit-focused runs
|
- `pnpm run test:unit` - Same as above for unit-focused runs
|
||||||
- `npm run test:e2e` - Run Playwright E2E tests
|
- `pnpm run test:e2e` - Run Playwright E2E tests
|
||||||
- `npm run test:all` - Run all tests
|
- `pnpm run test:all` - Run all tests
|
||||||
|
|
||||||
### Running a Single Test
|
### Running a Single Test
|
||||||
|
|
||||||
- Unit test: `npm run test:unit path/to/test.test.ts`
|
- Unit test: `pnpm run test:unit path/to/test.test.ts`
|
||||||
- E2E test: `npm run test:e2e path/to/test.spec.ts`
|
- E2E test: `pnpm run test:e2e path/to/test.spec.ts`
|
||||||
- Type check: `npm run type-check`
|
- Type check: `pnpm run type-check`
|
||||||
|
|
||||||
## 🧪 Development Notes
|
## 🧪 Development Notes
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ export const Component: React.FC<ComponentProps> = ({ prop1 }) => {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
> Before commit, run `npm run lint` and `npm run format`.
|
> Before commit, run `pnpm run lint` and `pnpm run format`.
|
||||||
|
|
||||||
## 📝 Terminal Output and References
|
## 📝 Terminal Output and References
|
||||||
|
|
||||||
@@ -330,7 +330,7 @@ Summary / output:
|
|||||||
|
|
||||||
Packages and scripts:
|
Packages and scripts:
|
||||||
|
|
||||||
- `npm install` (or `npm i`)
|
- `pnpm install` (or `pnpm i`)
|
||||||
|
|
||||||
Shell:
|
Shell:
|
||||||
|
|
||||||
@@ -345,12 +345,6 @@ Documentation/usage lookup:
|
|||||||
|
|
||||||
- Use `context7` for latest dependency usage.
|
- Use `context7` for latest dependency usage.
|
||||||
|
|
||||||
VSCode MCP (if available):
|
|
||||||
|
|
||||||
- `mcp__vscode-mcp__get_references` for refactor impact analysis
|
|
||||||
- `mcp__vscode-mcp__rename_symbol` for safe renaming
|
|
||||||
- `mcp__vscode-mcp__get_symbol_lsp_info` for types/signatures/definitions
|
|
||||||
|
|
||||||
## 🚨 Local Quality Checks (Optional Flow)
|
## 🚨 Local Quality Checks (Optional Flow)
|
||||||
|
|
||||||
After a set of changes, run these three checks in parallel instead of full lint immediately:
|
After a set of changes, run these three checks in parallel instead of full lint immediately:
|
||||||
@@ -371,128 +365,3 @@ Task(subagent_type: "run-related-tests", description: "Run tests", prompt: "[sam
|
|||||||
Flow: initial check -> fix key issues -> re-check -> iterate until key issues are resolved.
|
Flow: initial check -> fix key issues -> re-check -> iterate until key issues are resolved.
|
||||||
|
|
||||||
Note: these tools are read-only analyzers; you still need to apply fixes manually. Pass precise file paths, not broad directories.
|
Note: these tools are read-only analyzers; you still need to apply fixes manually. Pass precise file paths, not broad directories.
|
||||||
|
|
||||||
<skills_system priority="1">
|
|
||||||
|
|
||||||
## Available Skills
|
|
||||||
|
|
||||||
<!-- SKILLS_TABLE_START -->
|
|
||||||
<usage>
|
|
||||||
When users ask you to perform tasks, check if any of the available skills below can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.
|
|
||||||
|
|
||||||
How to use skills:
|
|
||||||
|
|
||||||
- Invoke: Bash("openskills read <skill-name>")
|
|
||||||
- The skill content will load with detailed instructions on how to complete the task
|
|
||||||
- Base directory provided in output for resolving bundled resources (references/, scripts/, assets/)
|
|
||||||
|
|
||||||
Usage notes:
|
|
||||||
|
|
||||||
- Only use skills listed in <available_skills> below
|
|
||||||
- Do not invoke a skill that is already loaded in your context
|
|
||||||
- Each skill invocation is stateless
|
|
||||||
</usage>
|
|
||||||
|
|
||||||
<available_skills>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>algorithmic-art</name>
|
|
||||||
<description>Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>brand-guidelines</name>
|
|
||||||
<description>Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>canvas-design</name>
|
|
||||||
<description>Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>doc-coauthoring</name>
|
|
||||||
<description>Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>docx</name>
|
|
||||||
<description>"Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks"</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>frontend-design</name>
|
|
||||||
<description>Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>internal-comms</name>
|
|
||||||
<description>A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>mcp-builder</name>
|
|
||||||
<description>Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>pdf</name>
|
|
||||||
<description>Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>pptx</name>
|
|
||||||
<description>"Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks"</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>skill-creator</name>
|
|
||||||
<description>Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>slack-gif-creator</name>
|
|
||||||
<description>Knowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>theme-factory</name>
|
|
||||||
<description>Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>web-artifacts-builder</name>
|
|
||||||
<description>Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>webapp-testing</name>
|
|
||||||
<description>Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
<skill>
|
|
||||||
<name>xlsx</name>
|
|
||||||
<description>"Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas"</description>
|
|
||||||
<location>project</location>
|
|
||||||
</skill>
|
|
||||||
|
|
||||||
</available_skills>
|
|
||||||
|
|
||||||
<!-- SKILLS_TABLE_END -->
|
|
||||||
|
|
||||||
</skills_system>
|
|
||||||
@@ -2,6 +2,117 @@
|
|||||||
|
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.15.3](https://github.com/evandrodevbr/GeminiNexus/compare/v0.15.2...v0.15.3) (2026-05-02)
|
||||||
|
|
||||||
|
### 👷 Build System
|
||||||
|
|
||||||
|
* allow fs-xattr and appdmg to build in pnpm v10 ([1c26a9e](https://github.com/evandrodevbr/GeminiNexus/commit/1c26a9e542f3fa5a05b370b8a332ffe5a727ea92))
|
||||||
|
|
||||||
|
## [0.15.2](https://github.com/evandrodevbr/GeminiNexus/compare/v0.15.1...v0.15.2) (2026-05-02)
|
||||||
|
|
||||||
|
### 👷 Build System
|
||||||
|
|
||||||
|
* allow macos-alias and other native modules to build in pnpm v10 ([2e3a65b](https://github.com/evandrodevbr/GeminiNexus/commit/2e3a65b76b91012638c422f6223b79399775c635))
|
||||||
|
|
||||||
|
## [0.15.1](https://github.com/evandrodevbr/GeminiNexus/compare/v0.15.0...v0.15.1) (2026-05-02)
|
||||||
|
|
||||||
|
### ✅ Tests
|
||||||
|
|
||||||
|
* add universal electron mock to fix headless CI test runs ([1d35801](https://github.com/evandrodevbr/GeminiNexus/commit/1d35801980e3e54cec1d3e52ed75850eb7eec350))
|
||||||
|
* fix test environments failing due to missing IS_DEV_ENVIRONMENT mock export ([269ad18](https://github.com/evandrodevbr/GeminiNexus/commit/269ad18ed6c09585e881d0d916558b1bcc7ad940))
|
||||||
|
* update proxy-advanced-handler tests to reflect optional service registration ([f4daaa8](https://github.com/evandrodevbr/GeminiNexus/commit/f4daaa8ca13bc75c7e5090905176c06b61ecfedc))
|
||||||
|
|
||||||
|
### 👷 Build System
|
||||||
|
|
||||||
|
* replace MakerSquirrel with MakerZIP for Windows ([27223f5](https://github.com/evandrodevbr/GeminiNexus/commit/27223f587d7facf25beef77aa6984cd248f2703d))
|
||||||
|
|
||||||
|
## [0.15.0](https://github.com/evandrodevbr/GeminiNexus/compare/v0.14.0...v0.15.0) (2026-05-02)
|
||||||
|
|
||||||
|
### ✨ Features
|
||||||
|
|
||||||
|
* bump version to 0.14.0 ([a905877](https://github.com/evandrodevbr/GeminiNexus/commit/a905877c76869a9b31b5b079d7afd86e4c905b59))
|
||||||
|
* **core:** isolate dev and production environments ([5c44a62](https://github.com/evandrodevbr/GeminiNexus/commit/5c44a622a8b4fa81246d4ca77073be50b4ddc1c9))
|
||||||
|
* **proxy:** add OpenCode IDE config and fix service availability ([713c449](https://github.com/evandrodevbr/GeminiNexus/commit/713c4497c623b0519847ed2afcc7da04997dae55))
|
||||||
|
* **proxy:** enrich traffic logs with model and token metadata ([641c739](https://github.com/evandrodevbr/GeminiNexus/commit/641c739b64150d1df77fd1a81a028b8cb4a4884d))
|
||||||
|
* **ui:** replace sidebar with compact top header navigation ([7d2977b](https://github.com/evandrodevbr/GeminiNexus/commit/7d2977b665a1a2fb0d5d8844a8e519471cdef8d8))
|
||||||
|
* **usage:** add cost reporting with custom model pricing and OpenRouter ([bc69a2e](https://github.com/evandrodevbr/GeminiNexus/commit/bc69a2e8b52e5019c45faae12771af7e40d3f26b))
|
||||||
|
* **usage:** move Monitor to Usage tab with per-request token tracking ([99e458f](https://github.com/evandrodevbr/GeminiNexus/commit/99e458f69bd5564d27f94c72c719ba49efd72abe))
|
||||||
|
* **usage:** redesign Usage Analytics with accurate token averages ([20785a8](https://github.com/evandrodevbr/GeminiNexus/commit/20785a8414bb0e364085a4a64f6a958c178d1df8))
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
* **ci:** remove explicit pnpm version from workflows ([080bf30](https://github.com/evandrodevbr/GeminiNexus/commit/080bf30e38379db5cb3c8d124f76a39aef897ccc))
|
||||||
|
* **ci:** resolve release pipeline conflicts and clean repo structure ([71bf812](https://github.com/evandrodevbr/GeminiNexus/commit/71bf8122d1a3d5bd74e3450f61d24747b50ed9d7))
|
||||||
|
* **ci:** use Node 22 for semantic-release (requires ^22.14.0) ([268428a](https://github.com/evandrodevbr/GeminiNexus/commit/268428a1193fd0bfd0559472fd50b3293d9c8ccb))
|
||||||
|
* install notice showing in Chinese and not recognizing MSI install path ([0753bbd](https://github.com/evandrodevbr/GeminiNexus/commit/0753bbdce63cffcd40fa13643e1082a67335c9c4))
|
||||||
|
|
||||||
|
### ♻️ Code Refactoring
|
||||||
|
|
||||||
|
* **accounts:** decompose CloudAccountList into focused components ([bf5a42c](https://github.com/evandrodevbr/GeminiNexus/commit/bf5a42c03e706d19033ceff332ee3609afded7ed))
|
||||||
|
|
||||||
|
## [0.14.0](https://github.com/evandrodevbr/GeminiNexus/compare/v0.13.1...v0.14.0) (2026-04-29)
|
||||||
|
|
||||||
|
### 🚀 Features
|
||||||
|
|
||||||
|
* **proxy:** add OpenAI Responses API compatibility for Open CoDesign ([68474b5](https://github.com/evandrodevbr/GeminiNexus/commit/68474b56dca9c9bcd7b06eaae04c521f475e8e2c))
|
||||||
|
|
||||||
|
## [0.13.1](https://github.com/evandrodevbr/GeminiNexus/compare/v0.13.0...v0.13.1) (2026-04-29)
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
* lazy-initialize api-logger to prevent EACCES in CI environments ([9bf7c46](https://github.com/evandrodevbr/GeminiNexus/commit/9bf7c46ff6320f49cba80923c9e11eac35a7d4f0))
|
||||||
|
|
||||||
|
<a name="readme-top"></a>
|
||||||
|
|
||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [0.11.1](https://github.com/Draculabo/AntigravityManager/compare/v0.11.0...v0.11.1) (2026-04-18)
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
* add unit label to AI credit display ([6577f1c](https://github.com/Draculabo/AntigravityManager/commit/6577f1c51fd155004b81f6171eb5feffa2448128))
|
||||||
|
* remaining localization gaps ([#156](https://github.com/Draculabo/AntigravityManager/issues/156)) ([7093c98](https://github.com/Draculabo/AntigravityManager/commit/7093c982ba790380cda7d1e8a53891970df6b3cf))
|
||||||
|
* remove AI credit refresh time scraping ([3e1e10b](https://github.com/Draculabo/AntigravityManager/commit/3e1e10b2a580ebf5a64b9a8982bd812a6a1f2924))
|
||||||
|
|
||||||
|
### 📝 Documentation
|
||||||
|
|
||||||
|
* **repo:** update project docs ([440a934](https://github.com/Draculabo/AntigravityManager/commit/440a9342800f244287c758b1a77a05fac9096df7))
|
||||||
|
|
||||||
|
### ♻️ Code Refactoring
|
||||||
|
|
||||||
|
* **ipc:** migrate renderer IPC client to official oRPC client ([d0c282d](https://github.com/Draculabo/AntigravityManager/commit/d0c282dffff24bb74a81cfa523f2f72f949bf8f9))
|
||||||
|
* standardize runtime guard patterns with lodash-es ([#154](https://github.com/Draculabo/AntigravityManager/issues/154)) ([bc35b96](https://github.com/Draculabo/AntigravityManager/commit/bc35b96b5d2d873cf0f187a57de695aedc32108f))
|
||||||
|
|
||||||
|
## [0.11.0](https://github.com/Draculabo/AntigravityManager/compare/v0.10.0...v0.11.0) (2026-04-11)
|
||||||
|
|
||||||
|
### ✨ Features
|
||||||
|
|
||||||
|
* account management overhaul + 7 issue resolutions ([#147](https://github.com/Draculabo/AntigravityManager/issues/147)) ([ed0dd81](https://github.com/Draculabo/AntigravityManager/commit/ed0dd811a8958928a2702839db07444e89f9fdb2)), closes [#79](https://github.com/Draculabo/AntigravityManager/issues/79) [#126](https://github.com/Draculabo/AntigravityManager/issues/126) [#99](https://github.com/Draculabo/AntigravityManager/issues/99) [#145](https://github.com/Draculabo/AntigravityManager/issues/145) [#134](https://github.com/Draculabo/AntigravityManager/issues/134) [#53](https://github.com/Draculabo/AntigravityManager/issues/53) [#117](https://github.com/Draculabo/AntigravityManager/issues/117)
|
||||||
|
* **antigravity:** add model specs and update mapping logic ([0a60c0e](https://github.com/Draculabo/AntigravityManager/commit/0a60c0eafa698202722be9c283cb52831e2e0179))
|
||||||
|
* **cloud-oauth:** support selectable google oauth clients ([bcdf2a6](https://github.com/Draculabo/AntigravityManager/commit/bcdf2a6c24fc992d32b4ae883f2a34c8e64969e3))
|
||||||
|
* **cloud-status:** classify blocked accounts and surface validation state ([388fbcb](https://github.com/Draculabo/AntigravityManager/commit/388fbcb2a9522285eb0bb4a541b48cd3e1049470))
|
||||||
|
* **cloud-sync:** persist project and status metadata for synced accounts ([385036d](https://github.com/Draculabo/AntigravityManager/commit/385036d577495caeebf95301542811b08c9f333e))
|
||||||
|
* **protobuf:** add unified state helpers for oauth payloads ([f970ccb](https://github.com/Draculabo/AntigravityManager/commit/f970ccb2ed1f3a3e9de09221895f0b650c1115b9))
|
||||||
|
* **proxy:** add upstream error and rate-limit tracking support ([20fffff](https://github.com/Draculabo/AntigravityManager/commit/20fffff29c47d1147e9b429884d9e8b613e7da6f))
|
||||||
|
* **proxy:** improve parity, rate limiting, and token scheduling ([5401e40](https://github.com/Draculabo/AntigravityManager/commit/5401e40943824d54bc95971229a83934e55ad88f))
|
||||||
|
* **proxy:** improve quota fallback and proxy parity handling ([4fa0a3c](https://github.com/Draculabo/AntigravityManager/commit/4fa0a3c63dd4b973d0d07feb7351831ad827176d))
|
||||||
|
* **ui:** update cloud account and provider visibility experience ([c95f494](https://github.com/Draculabo/AntigravityManager/commit/c95f494569b49ff1fae871970764c9f0a3fbda59))
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
* **cloud:** add missing oauth action bindings and validation status helper ([87c17a1](https://github.com/Draculabo/AntigravityManager/commit/87c17a1ed0856572f0f8c46ede923b563b726108))
|
||||||
|
* **cloud:** fetch AI credits on startup with endpoint fallback and preserve cached credits ([61716bb](https://github.com/Draculabo/AntigravityManager/commit/61716bb51259c0a5899b8659aa864c5772b75cbb))
|
||||||
|
* **linux:** dynamic executable path detection ([#121](https://github.com/Draculabo/AntigravityManager/issues/121)) ([30e38dc](https://github.com/Draculabo/AntigravityManager/commit/30e38dcb8b9329b68601c9df896fd815ccadc1ec))
|
||||||
|
* **linux:** harden account-switch relaunch against GPU process crashes ([2c1755e](https://github.com/Draculabo/AntigravityManager/commit/2c1755e578ac91962e813a141ec7d3df6fa61a74))
|
||||||
|
|
||||||
|
### 📝 Documentation
|
||||||
|
|
||||||
|
* **proxyman:** add setup and debugging guides and link them from readmes ([3100db9](https://github.com/Draculabo/AntigravityManager/commit/3100db93ed92f9f8ef19aceae49a699768e20ca9))
|
||||||
|
|
||||||
|
### ✅ Tests
|
||||||
|
|
||||||
|
* **proxy:** refine signature test text ([50a325b](https://github.com/Draculabo/AntigravityManager/commit/50a325be113ef59dd9d0144b84d64f9eb40ea67a))
|
||||||
|
|
||||||
## [0.10.0](https://github.com/Draculabo/AntigravityManager/compare/v0.9.2...v0.10.0) (2026-02-19)
|
## [0.10.0](https://github.com/Draculabo/AntigravityManager/compare/v0.9.2...v0.10.0) (2026-02-19)
|
||||||
|
|
||||||
### ✨ Features
|
### ✨ Features
|
||||||
@@ -254,7 +365,7 @@
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Initial release of Antigravity Manager
|
- Initial release of Gemini Nexus
|
||||||
- Multi-account management for Google Gemini and Claude
|
- Multi-account management for Google Gemini and Claude
|
||||||
- Real-time quota monitoring
|
- Real-time quota monitoring
|
||||||
- Intelligent auto-switching capabilities
|
- Intelligent auto-switching capabilities
|
||||||
|
|||||||
@@ -2,48 +2,75 @@
|
|||||||
|
|
||||||
## Our Pledge
|
## Our Pledge
|
||||||
|
|
||||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
||||||
|
|
||||||
## Our Standards
|
## Our Standards
|
||||||
|
|
||||||
Examples of behavior that contributes to creating a positive environment include:
|
**Examples of behavior that contributes to a positive environment:**
|
||||||
|
|
||||||
- Using welcoming and inclusive language
|
- Using welcoming and inclusive language
|
||||||
- Being respectful of differing viewpoints and experiences
|
- Being respectful of differing viewpoints and experiences
|
||||||
- Gracefully accepting constructive criticism
|
- Gracefully accepting constructive feedback
|
||||||
- Focusing on what is best for the community
|
- Focusing on what is best for the community
|
||||||
- Showing empathy towards other community members
|
- Showing empathy towards other community members
|
||||||
|
- Helping newcomers feel welcome
|
||||||
|
|
||||||
Examples of unacceptable behavior by participants include:
|
**Examples of unacceptable behavior:**
|
||||||
|
|
||||||
- The use of sexualized language or imagery and unwelcome sexual attention or advances
|
- The use of sexualized language or imagery, and unwelcome sexual attention or advances
|
||||||
- Trolling, insulting/derogatory comments, and personal or political attacks
|
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
- Public or private harassment
|
- Public or private harassment
|
||||||
- Publishing others' private information, such as a physical or electronic address, without explicit permission
|
- Publishing others' private information without explicit permission
|
||||||
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||||
|
|
||||||
## Our Responsibilities
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
Project maintainers are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
||||||
|
|
||||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for behaviors that they deem inappropriate.
|
||||||
|
|
||||||
## Scope
|
## Scope
|
||||||
|
|
||||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
This Code of Conduct applies within all project spaces — including the repository, issue tracker, discussions, and pull requests — and also applies when an individual is officially representing the project in public spaces.
|
||||||
|
|
||||||
## Enforcement
|
## Enforcement
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [INSERT EMAIL ADDRESS]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue on the [GitHub repository](https://github.com/evandrodevbr/GeminiNexus/issues) or by contacting the project maintainers directly.
|
||||||
|
|
||||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
All complaints will be reviewed and investigated promptly and fairly. The project team is obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
|
||||||
|
## Enforcement Guidelines
|
||||||
|
|
||||||
|
Project maintainers will follow these guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
||||||
|
|
||||||
|
### 1. Correction
|
||||||
|
|
||||||
|
**Impact**: Use of inappropriate language or other behavior deemed unprofessional.
|
||||||
|
|
||||||
|
**Consequence**: A private, written warning providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
||||||
|
|
||||||
|
### 2. Warning
|
||||||
|
|
||||||
|
**Impact**: A violation through a single incident or series of actions.
|
||||||
|
|
||||||
|
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved for a specified period of time. Violating these terms may lead to a temporary or permanent ban.
|
||||||
|
|
||||||
|
### 3. Temporary Ban
|
||||||
|
|
||||||
|
**Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
||||||
|
|
||||||
|
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time.
|
||||||
|
|
||||||
|
### 4. Permanent Ban
|
||||||
|
|
||||||
|
**Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
|
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
||||||
|
|
||||||
## Attribution
|
## Attribution
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at <https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>.
|
||||||
|
|
||||||
[homepage]: https://www.contributor-covenant.org
|
Enforcement Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Note**: Please replace `[INSERT EMAIL ADDRESS]` with your actual contact email if you wish to receive reports.
|
|
||||||
@@ -1,44 +1,55 @@
|
|||||||
# Contributing to Antigravity Manager
|
# Contributing to Gemini Nexus
|
||||||
|
|
||||||
First off, thank you for considering contributing to Antigravity Manager! 🎉
|
Thank you for considering contributing to Gemini Nexus! 🎉
|
||||||
|
|
||||||
It's people like you that make Antigravity Manager such a great tool. We welcome contributions from everyone, whether it's a bug report, feature suggestion, documentation improvement, or code contribution.
|
Whether it's a bug report, feature suggestion, documentation improvement, or code contribution — all help is welcome.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 📋 Table of Contents
|
## 📋 Table of Contents
|
||||||
|
|
||||||
- [Code of Conduct](#code-of-conduct)
|
- [Code of Conduct](#-code-of-conduct)
|
||||||
- [Getting Started](#getting-started)
|
- [Getting Started](#-getting-started)
|
||||||
- [Development Setup](#development-setup)
|
- [Development Setup](#-development-setup)
|
||||||
- [Making Changes](#making-changes)
|
- [Making Changes](#-making-changes)
|
||||||
- [Pull Request Process](#pull-request-process)
|
- [Commit Guidelines](#-commit-guidelines)
|
||||||
- [Style Guidelines](#style-guidelines)
|
- [Pull Request Process](#-pull-request-process)
|
||||||
- [Reporting Bugs](#reporting-bugs)
|
- [Code Style](#-code-style)
|
||||||
- [Suggesting Features](#suggesting-features)
|
- [Reporting Issues](#-reporting-issues)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 📜 Code of Conduct
|
## 📜 Code of Conduct
|
||||||
|
|
||||||
This project and everyone participating in it is governed by our [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.
|
This project is governed by our [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 🚀 Getting Started
|
## 🚀 Getting Started
|
||||||
|
|
||||||
1. **Fork the repository** on GitHub
|
1. **Fork** the repository on GitHub
|
||||||
2. **Clone your fork** locally:
|
2. **Clone** your fork locally:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/YOUR_USERNAME/AntigravityManager.git
|
git clone https://github.com/YOUR_USERNAME/GeminiNexus.git
|
||||||
cd AntigravityManager
|
cd GeminiNexus
|
||||||
```
|
```
|
||||||
|
|
||||||
3. **Add the upstream remote**:
|
3. **Add the upstream remote**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git remote add upstream https://github.com/Draculabo/AntigravityManager.git
|
git remote add upstream https://github.com/evandrodevbr/GeminiNexus.git
|
||||||
```
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 💻 Development Setup
|
## 💻 Development Setup
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
- Node.js v18 or higher
|
- **Node.js** v20 or higher
|
||||||
- npm (comes with Node.js)
|
- **npm** (this project uses `package-lock.json`)
|
||||||
- Git
|
- **Git**
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
@@ -46,49 +57,73 @@ This project and everyone participating in it is governed by our [Code of Conduc
|
|||||||
# Install dependencies
|
# Install dependencies
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
# Start development server
|
# Start the app in development mode
|
||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
### Available Scripts
|
### Available Scripts
|
||||||
|
|
||||||
| Command | Description |
|
| Command | Description |
|
||||||
| ---------------------- | ----------------------------------- |
|
| ---------------------- | ------------------------------------------------------- |
|
||||||
| `npm start` | Start the app in development mode |
|
| `npm start` | Start the app in development mode (Electron + Vite HMR) |
|
||||||
| `npm run lint` | Run ESLint to check for code issues |
|
| `npm run lint` | Run ESLint |
|
||||||
| `npm run format:write` | Format code with Prettier |
|
| `npm run format` | Check formatting with Prettier |
|
||||||
| `npm run test:unit` | Run unit tests with Vitest |
|
| `npm run format:write` | Auto-format code with Prettier |
|
||||||
| `npm run test:e2e` | Run E2E tests with Playwright |
|
| `npm run type-check` | Run TypeScript type check |
|
||||||
| `npm run test:all` | Run all tests |
|
| `npm test` | Run unit tests with Vitest |
|
||||||
| `npm run type-check` | Run TypeScript type checking |
|
| `npm run test:e2e` | Run E2E tests with Playwright |
|
||||||
| `npm run make` | Build production packages |
|
| `npm run test:all` | Run all tests (unit + E2E) |
|
||||||
|
| `npm run make` | Build production installers |
|
||||||
|
|
||||||
|
### Project Structure
|
||||||
|
|
||||||
|
```plaintext
|
||||||
|
src/
|
||||||
|
├── components/ # React UI components (Radix-based primitives in ui/)
|
||||||
|
├── hooks/ # Custom React hooks
|
||||||
|
├── ipc/ # Electron IPC + database handlers
|
||||||
|
├── layouts/ # Layout components (MainLayout + sidebar)
|
||||||
|
├── localization/ # i18n translation resources
|
||||||
|
├── routes/ # TanStack Router pages (index, usage, proxy, settings)
|
||||||
|
├── server/ # NestJS backend (proxy gateway service)
|
||||||
|
├── services/ # Service layer
|
||||||
|
├── types/ # TypeScript type definitions + Zod schemas
|
||||||
|
└── utils/ # Utility functions
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## ✏️ Making Changes
|
## ✏️ Making Changes
|
||||||
|
|
||||||
1. **Create a new branch** from `main`:
|
1. **Create a branch** from `main`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git checkout -b feature/your-feature-name
|
git checkout -b feat/your-feature-name
|
||||||
# or
|
# or
|
||||||
git checkout -b fix/your-bug-fix
|
git checkout -b fix/your-bug-fix
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Make your changes** and commit them:
|
2. **Make your changes**, then commit:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git add .
|
git add .
|
||||||
git commit -m "feat: add amazing new feature"
|
git commit -m "feat: add amazing new feature"
|
||||||
```
|
```
|
||||||
|
|
||||||
3. **Keep your branch updated**:
|
3. **Keep your branch up to date**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git fetch upstream
|
git fetch upstream
|
||||||
git rebase upstream/main
|
git rebase upstream/main
|
||||||
```
|
```
|
||||||
|
|
||||||
### Commit Message Guidelines
|
---
|
||||||
|
|
||||||
We follow [Conventional Commits](https://www.conventionalcommits.org/). Each commit message should be structured as follows:
|
## 📝 Commit Guidelines
|
||||||
|
|
||||||
|
We follow [Conventional Commits](https://www.conventionalcommits.org/). Commits are analyzed by `semantic-release` to automatically determine version bumps and generate changelogs.
|
||||||
|
|
||||||
|
### Format
|
||||||
|
|
||||||
```
|
```
|
||||||
<type>(<scope>): <description>
|
<type>(<scope>): <description>
|
||||||
@@ -98,88 +133,136 @@ We follow [Conventional Commits](https://www.conventionalcommits.org/). Each com
|
|||||||
[optional footer(s)]
|
[optional footer(s)]
|
||||||
```
|
```
|
||||||
|
|
||||||
**Types:**
|
### Types
|
||||||
|
|
||||||
- `feat`: A new feature
|
| Type | Description | Release |
|
||||||
- `fix`: A bug fix
|
| ---------- | ----------------------------------- | ---------- |
|
||||||
- `docs`: Documentation only changes
|
| `feat` | A new feature | **minor** |
|
||||||
- `style`: Changes that don't affect code meaning (formatting, etc.)
|
| `fix` | A bug fix | **patch** |
|
||||||
- `refactor`: Code change that neither fixes a bug nor adds a feature
|
| `perf` | Performance improvement | **patch** |
|
||||||
- `perf`: Performance improvement
|
| `refactor` | Code change (no bug fix or feature) | **patch** |
|
||||||
- `test`: Adding or correcting tests
|
| `docs` | Documentation only | no release |
|
||||||
- `chore`: Changes to build process or auxiliary tools
|
| `style` | Formatting, whitespace | no release |
|
||||||
|
| `test` | Adding or fixing tests | no release |
|
||||||
|
| `chore` | Build process, tooling | no release |
|
||||||
|
| `ci` | CI/CD changes | no release |
|
||||||
|
|
||||||
**Examples:**
|
### Breaking Changes
|
||||||
|
|
||||||
|
Add `BREAKING CHANGE:` in the footer or `!` after the type to trigger a **major** release:
|
||||||
|
|
||||||
```
|
```
|
||||||
feat(auth): add Google OAuth support
|
feat!: remove legacy plaintext storage
|
||||||
fix(quota): resolve quota refresh timeout issue
|
|
||||||
docs(readme): update installation instructions
|
BREAKING CHANGE: all accounts must re-authenticate after upgrade.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
feat(proxy): add Anthropic /v1/messages endpoint
|
||||||
|
fix(usage): handle SQL SUM(null) in empty date ranges
|
||||||
|
docs(readme): add Chinese and Spanish translations
|
||||||
|
ci: normalize Node.js to v20 across all workflows
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 🔄 Pull Request Process
|
## 🔄 Pull Request Process
|
||||||
|
|
||||||
1. **Update documentation** if you're changing functionality
|
### Before Opening a PR
|
||||||
2. **Add tests** for new features
|
|
||||||
3. **Ensure all tests pass**: `npm run test:all`
|
1. Run the quality checks:
|
||||||
4. **Ensure code is formatted**: `npm run format:write`
|
|
||||||
5. **Ensure no lint errors**: `npm run lint`
|
```bash
|
||||||
6. **Push to your fork** and create a Pull Request
|
npm run lint
|
||||||
|
npm run format:write
|
||||||
|
npm run type-check
|
||||||
|
npm test
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Update documentation if you changed functionality
|
||||||
|
3. Add tests for new features
|
||||||
|
|
||||||
### PR Checklist
|
### PR Checklist
|
||||||
|
|
||||||
- [ ] My code follows the project's style guidelines
|
- [ ] My code follows the project's style guidelines
|
||||||
- [ ] I have performed a self-review of my code
|
- [ ] I have performed a self-review of my code
|
||||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
- [ ] I have commented hard-to-understand areas
|
||||||
- [ ] I have made corresponding changes to the documentation
|
- [ ] I have updated related documentation
|
||||||
- [ ] My changes generate no new warnings
|
- [ ] My changes generate no new warnings
|
||||||
- [ ] I have added tests that prove my fix is effective or my feature works
|
- [ ] I have added tests that prove my fix or feature works
|
||||||
- [ ] New and existing unit tests pass locally with my changes
|
- [ ] All existing tests pass locally
|
||||||
|
|
||||||
## 🎨 Style Guidelines
|
### Review Process
|
||||||
|
|
||||||
### TypeScript/JavaScript
|
- PRs require at least one maintainer approval
|
||||||
|
- CI must pass (lint, type-check, unit tests)
|
||||||
- Use TypeScript for all new code
|
- Squash-merge is preferred for clean history
|
||||||
- Follow the existing code style (enforced by ESLint and Prettier)
|
|
||||||
- Use meaningful variable and function names
|
|
||||||
- Add JSDoc comments for public APIs
|
|
||||||
|
|
||||||
### React Components
|
|
||||||
|
|
||||||
- Use functional components with hooks
|
|
||||||
- Keep components small and focused
|
|
||||||
- Use TypeScript interfaces for props
|
|
||||||
- Follow the existing file structure
|
|
||||||
|
|
||||||
### CSS/Styling
|
|
||||||
|
|
||||||
- Use TailwindCSS utility classes
|
|
||||||
- Follow the design system in `components.json`
|
|
||||||
- Ensure responsive design
|
|
||||||
|
|
||||||
## 🐛 Reporting Bugs
|
|
||||||
|
|
||||||
Found a bug? Please [create an issue](https://github.com/Draculabo/AntigravityManager/issues/new?template=bug_report.md) with:
|
|
||||||
|
|
||||||
- **Clear title** describing the issue
|
|
||||||
- **Steps to reproduce** the behavior
|
|
||||||
- **Expected behavior** vs actual behavior
|
|
||||||
- **Screenshots** if applicable
|
|
||||||
- **Environment details** (OS, app version)
|
|
||||||
|
|
||||||
## 💡 Suggesting Features
|
|
||||||
|
|
||||||
Have an idea? Please [create an issue](https://github.com/Draculabo/AntigravityManager/issues/new?template=feature_request.md) with:
|
|
||||||
|
|
||||||
- **Clear description** of the feature
|
|
||||||
- **Use case** - why is this feature needed?
|
|
||||||
- **Possible implementation** ideas (optional)
|
|
||||||
|
|
||||||
## 🙏 Thank You
|
|
||||||
|
|
||||||
Your contributions help make Antigravity Manager better for everyone. Thank you for taking the time to contribute!
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
If you have any questions, feel free to open an issue or reach out to the maintainers.
|
## 🎨 Code Style
|
||||||
|
|
||||||
|
### TypeScript
|
||||||
|
|
||||||
|
- Use TypeScript for all new code — avoid `any`
|
||||||
|
- Use Zod for runtime validation
|
||||||
|
- Prefer `lodash-es` named imports over native utilities
|
||||||
|
- Use `@/` alias for `src/` imports
|
||||||
|
|
||||||
|
### React Components
|
||||||
|
|
||||||
|
- Functional components with hooks only
|
||||||
|
- Use Radix UI primitives for accessible components
|
||||||
|
- TypeScript interfaces for props
|
||||||
|
- Follow existing component structure (`components/ComponentName.tsx`)
|
||||||
|
|
||||||
|
### Styling
|
||||||
|
|
||||||
|
- Tailwind CSS v4 utility classes
|
||||||
|
- Use `clsx` + `tailwind-merge` for conditional classes
|
||||||
|
- Follow the Gemini Nexus design tokens (`rounded-xl`, `border-white/[0.06]`)
|
||||||
|
|
||||||
|
### Import Order
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// 1. React and core libraries
|
||||||
|
import React, { useEffect } from 'react';
|
||||||
|
|
||||||
|
// 2. External dependencies (alphabetical)
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
// 3. Internal imports (using @ alias)
|
||||||
|
import { Card } from '@/components/ui/card';
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🐛 Reporting Issues
|
||||||
|
|
||||||
|
### Bug Reports
|
||||||
|
|
||||||
|
[Create a bug report](https://github.com/evandrodevbr/GeminiNexus/issues/new?labels=bug&template=bug_report.md) with:
|
||||||
|
|
||||||
|
- Clear title describing the issue
|
||||||
|
- Steps to reproduce the behavior
|
||||||
|
- Expected vs actual behavior
|
||||||
|
- Screenshots if applicable
|
||||||
|
- Environment details (OS, app version, Node.js version)
|
||||||
|
|
||||||
|
### Feature Requests
|
||||||
|
|
||||||
|
[Suggest a feature](https://github.com/evandrodevbr/GeminiNexus/issues/new?labels=enhancement&template=feature_request.md) with:
|
||||||
|
|
||||||
|
- Clear description of the feature
|
||||||
|
- Use case — why is this needed?
|
||||||
|
- Possible implementation ideas (optional)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🙏 Thank You
|
||||||
|
|
||||||
|
Your contributions make Gemini Nexus better for everyone. Thank you for your time!
|
||||||
|
|
||||||
|
If you have questions, feel free to [open a discussion](https://github.com/evandrodevbr/GeminiNexus/discussions) or reach out to the maintainers.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2025-present evandrodevbr
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,262 @@
|
|||||||
|
<div align="center">
|
||||||
|
|
||||||
|
<img src="assets/readme/hero.es.png" width="100%" alt="Gemini Nexus: gateway de escritorio que agrupa cuentas de Google tras una API local compatible con OpenAI y Anthropic en http://localhost:8045/v1, y cambia de cuenta cuando se agota la cuota">
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
<p><strong><a href="#-inicio-rápido">Inicio rápido</a></strong> · <a href="#-documentación-y-desarrollo">Docs</a> · <a href="https://git.evandro.dev.br/evandro/gemini-nexus/issues">Issues</a></p>
|
||||||
|
|
||||||
|
<sub><a href="README.md">English</a> · <a href="README.pt-BR.md">Português</a> · <a href="README.zh-CN.md">中文</a> · Español</sub>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
## 📸 Capturas de pantalla
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/main.png" width="100%" alt="Página Accounts: una cuenta de Google en el pool con barras de cuota por modelo, el interruptor Auto-Switch y el contador de cuota global"></p>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Más capturas: uso, proxy, enrutamiento, docs, conexiones, ajustes</summary>
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/2usage.png" alt="Analítica de uso" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/3proxy.png" alt="Monitor del proxy" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/4routing.png" alt="Configuración de enrutamiento" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/5docs.png" alt="Documentación" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/6connections.png" alt="Conexiones activas" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/7config.png" alt="Ajustes" width="80%"></p>
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## 🎯 Características
|
||||||
|
|
||||||
|
Trabajar con IDEs con IA sobre una sola cuenta de Google significa cuota que se agota, cambios de cuenta manuales y ninguna visibilidad de lo que el proxy envía hacia arriba. Gemini Nexus reúne todas las cuentas en un pool y las sirve por un único endpoint local.
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td width="50%" valign="top"><b>Un endpoint local</b><br><code>POST /v1/chat/completions</code> (OpenAI), <code>POST /v1/messages</code> (Anthropic), <code>GET /v1/models</code> y <code>GET /v1/models/capabilities</code>, para que Cursor, Windsurf, OpenCode, Claude Code y clientes similares puedan conectarse. Los nombres de modelo se mapean con <code>custom_mapping</code> y <code>anthropic_mapping</code>.</td>
|
||||||
|
<td width="50%" valign="top"><b>Pool de cuentas</b><br>Cuentas de Google añadidas por OAuth, cada una con su estado (Active, Rate Limited, Expired), hora del último uso y una URL de proxy opcional por cuenta.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="50%" valign="top"><b>Cambio automático</b><br><code>CloudMonitorService</code> consulta la cuota cada 5 minutos y <code>AutoSwitchService</code> pasa a otra cuenta cuando la cuota baja del 5 % o la cuenta sufre rate limit.</td>
|
||||||
|
<td width="50%" valign="top"><b>Planificación con circuit breaker</b><br><code>cache-first</code>, <code>balance</code> (por defecto) o <code>performance-first</code>, con circuit breaker por cuenta (backoff por defecto 60 s → 5 min → 30 min → 2 h).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="50%" valign="top"><b>Uso y coste</b><br>Consumo de tokens por cuenta y por modelo, gráficos de prompt y completion y estimación de coste con precios por modelo editables.</td>
|
||||||
|
<td width="50%" valign="top"><b>Inspector de tráfico</b><br>Latencia, estado y modelo de cada petición, replay de peticiones registradas, snippets cURL y Python generados y un Quick Setup para IDEs.</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
Las credenciales guardadas se cifran con AES-256-GCM bajo una clave maestra en el llavero del sistema (ver [Modelo de seguridad](#modelo-de-seguridad)).
|
||||||
|
|
||||||
|
## Cómo funciona
|
||||||
|
|
||||||
|
1. **Añade cuentas.** Inicia sesión con Google OAuth en la página Accounts. Los tokens se cifran antes de llegar a SQLite.
|
||||||
|
2. **Apunta tu IDE al proxy.** Activa el proxy en la página Proxy (viene apagado) y usa `http://localhost:8045/v1` con la API key que se muestra allí, en formato OpenAI o Anthropic.
|
||||||
|
3. **Nexus enruta cada petición.** El token manager elige una cuenta según el modo de planificación y el estado del circuit breaker, llama a las APIs upstream de Google con el token OAuth de esa cuenta, y el cambio automático actúa cuando la cuota baja del 5 % o una cuenta sufre rate limit.
|
||||||
|
|
||||||
|
El flujo completo, con los componentes implicados, está en [Arquitectura](#arquitectura).
|
||||||
|
|
||||||
|
## ⚡ Inicio rápido
|
||||||
|
|
||||||
|
Todavía no hay descargas precompiladas en la página de [Releases de Gitea](https://git.evandro.dev.br/evandro/gemini-nexus/releases) (los workflows de release en `.github/workflows/` apuntan a GitHub), así que compila desde el código fuente.
|
||||||
|
|
||||||
|
| Herramienta | Versión mínima |
|
||||||
|
|---|---|
|
||||||
|
| Node.js | 20+ (recomendado en `AGENTS.md`; `.nvmrc` fija 22.17.1) |
|
||||||
|
| pnpm | 10.11.0 (`packageManager`; el lockfile es `pnpm-lock.yaml`) |
|
||||||
|
| Toolchain nativa | necesaria para `better-sqlite3` y `keytar`: Visual Studio 2022 Build Tools (C++) en Windows, Xcode Command Line Tools en macOS, `build-essential` + `python3` + `libsecret-1-dev` en Ubuntu (`base-devel` + `python` + `libsecret` en Arch) |
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://git.evandro.dev.br/evandro/gemini-nexus.git
|
||||||
|
cd gemini-nexus
|
||||||
|
pnpm install # el postinstall ejecuta scripts/setup-dev.js --check-only para verificar la toolchain
|
||||||
|
pnpm start # modo dev (Electron + Vite HMR)
|
||||||
|
pnpm run make # instaladores/paquetes para la plataforma actual
|
||||||
|
pnpm run make:win # Windows: extrae WiX de wix314-binaries.zip y luego ejecuta make
|
||||||
|
```
|
||||||
|
|
||||||
|
Después añade al menos una cuenta, activa el proxy (viene apagado) y apunta tu IDE a él:
|
||||||
|
|
||||||
|
```text
|
||||||
|
API Base URL: http://localhost:8045/v1 (por defecto, configurable en la página Proxy; los builds de desarrollo usan 8046)
|
||||||
|
API Key: (cópiala de la página Proxy de la app)
|
||||||
|
Model: gemini-3-flash (o cualquier modelo mapeado)
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> Los builds no están firmados. Si Windows muestra "Windows protegió su PC", haz clic en **Más información → Ejecutar de todas formas**.
|
||||||
|
|
||||||
|
No hay `.env.example` y ninguna variable es obligatoria. Variables opcionales que lee el código o que describen los docs:
|
||||||
|
|
||||||
|
| Variable | Obligatoria | Descripción |
|
||||||
|
|---|---|---|
|
||||||
|
| `HTTP_PROXY` / `HTTPS_PROXY` / `NO_PROXY` | No | Envía las peticiones salientes de la app por un proxy local (ver inspección TLS en [Modelo de seguridad](#modelo-de-seguridad)). |
|
||||||
|
| `NODE_EXTRA_CA_CERTS` | No | Certificado de CA adicional para el TLS del lado Node al inspeccionar tráfico. |
|
||||||
|
| `SENTRY_DSN` | No | DSN de Sentry usado cuando el envío de errores está activado. |
|
||||||
|
|
||||||
|
## 🛠️ Stack
|
||||||
|
|
||||||
|
| Capa | Tecnología |
|
||||||
|
|---|---|
|
||||||
|
| Shell de escritorio | Electron 41, Electron Forge, Vite |
|
||||||
|
| Interfaz | React 19, TypeScript, Tailwind CSS 4, Radix UI, gráficos Nivo, i18next |
|
||||||
|
| Flujo de datos de la app | TanStack Router y Query, oRPC sobre IPC de Electron |
|
||||||
|
| Proxy | NestJS 11 sobre Fastify |
|
||||||
|
| Almacenamiento | SQLite (better-sqlite3 + Drizzle ORM), llavero del sistema vía `keytar` |
|
||||||
|
| Logs y errores | Winston (archivos rotativos), Sentry (opcional) |
|
||||||
|
| Pruebas | Vitest, Playwright |
|
||||||
|
|
||||||
|
## Arquitectura
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
C["Cliente: Cursor, Windsurf, OpenCode, Claude Code"] -->|"/v1/chat/completions, /v1/messages"| P["Proxy NestJS, puerto 8045"]
|
||||||
|
P --> S["Planificador de cuentas y circuit breaker"]
|
||||||
|
S -->|"cuenta Google OAuth"| G["APIs upstream de Google"]
|
||||||
|
M["CloudMonitor y AutoSwitch, cuota cada 5 min"] -->|"consulta de cuota"| G
|
||||||
|
S -->|"lee cuentas"| DB[("SQLite: better-sqlite3 y Drizzle")]
|
||||||
|
M --> DB
|
||||||
|
K["AES-256-GCM, clave maestra en el llavero del sistema"] -->|"cifra tokens"| DB
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Un cliente envía peticiones en formato OpenAI o Anthropic al proxy NestJS (Fastify, escuchando en `0.0.0.0`).
|
||||||
|
2. El guard del proxy comprueba la API key cuando hay una configurada; con la clave vacía el proxy funciona en modo abierto.
|
||||||
|
3. El token manager elige una cuenta según el modo de planificación y el estado del circuit breaker de cada cuenta, y llama a las APIs upstream de Google con el token OAuth de esa cuenta.
|
||||||
|
4. `CloudMonitorService` consulta la cuota cada 5 minutos y `AutoSwitchService` cambia la cuenta activa cuando la cuota está por debajo del 5 % o la cuenta sufre rate limit.
|
||||||
|
5. El renderer React 19 (TanStack Router y Query) habla con el proceso principal mediante oRPC sobre IPC; cuentas, uso y ajustes viven en SQLite (better-sqlite3 + Drizzle). Notas de diseño: [`docs/cloud_features.md`](docs/cloud_features.md).
|
||||||
|
|
||||||
|
## Modelo de seguridad
|
||||||
|
|
||||||
|
Gemini Nexus guarda tokens OAuth de varias cuentas y reenvía tráfico hacia arriba, así que el manejo de credenciales es el núcleo del diseño. Todo lo de abajo está implementado en este repositorio; los límites se indican donde existen.
|
||||||
|
|
||||||
|
- **Almacenamiento y aislamiento de credenciales.** `token_json` y `quota_json` se cifran con AES-256-GCM (IV único por operación, autenticado) antes de llegar a SQLite. La clave maestra vive en el almacén de credenciales del sistema vía `keytar` (Administrador de credenciales de Windows, Keychain de macOS, Secret Service/libsecret en Linux), nunca en un archivo plano. Las filas heredadas en texto plano se migran al arrancar. Las cuentas se guardan en su propia base de datos (`cloud_accounts.db`), independiente de la base local del IDE.
|
||||||
|
- **Enmascarado de logs.** Claves como `token`, `refresh_token`, `api_key`, `authorization`, `cookie` y `client_secret` se sustituyen por `[REDACTED]` antes de registrarse ([`src/utils/sensitiveDataMasking.ts`](src/utils/sensitiveDataMasking.ts)); el logger de tráfico también oculta las cabeceras `authorization`, `x-api-key` y `cookie`.
|
||||||
|
- **Registro de peticiones, no pista de auditoría.** Winston escribe logs de API, tráfico y app en archivos rotativos (log de API: 30 días, 50 MB por archivo). Son logs operativos, no una pista de auditoría a prueba de manipulación; los archivos `*-audit.json` son el control de rotación de `winston-daily-rotate-file`.
|
||||||
|
- **Acceso al proxy.** El proxy viene apagado. Una vez activado escucha en `0.0.0.0`, y las peticiones solo se autentican cuando `api_key` no está vacía (vacía significa modo abierto). Define una clave y mantenla privada.
|
||||||
|
- **Inspección TLS (solo para depurar).** [`docs/proxyman-install.md`](docs/proxyman-install.md) y [`docs/proxyman-debugging.md`](docs/proxyman-debugging.md) explican cómo leer el tráfico HTTPS de la app con Proxyman: confiar en su CA raíz, definir las variables de proxy y `NODE_EXTRA_CA_CERTS` y después iniciar la app. `NODE_TLS_REJECT_UNAUTHORIZED=0` (y el flag `-AllowInsecureTls` del script) es un ajuste temporal; nunca lo dejes activado. No hagas commit de direcciones de proxy, rutas de certificados, cookies ni códigos OAuth, y oculta datos de los logs antes de compartirlos. `scripts/start-antigravity-with-proxyman.ps1` apunta al cliente oficial de Antigravity instalado, no a esta app.
|
||||||
|
- **Envío de errores.** Los informes de Sentry (necesitan `SENTRY_DSN`) dependen del ajuste `error_reporting_enabled`, que `DEFAULT_APP_CONFIG` trae como `true`; desactívalo en Settings para no enviarlos. El segmento con el nombre de usuario de Windows se enmascara en los mensajes de excepción enviados.
|
||||||
|
|
||||||
|
Versiones soportadas y cómo reportar una vulnerabilidad: [`SECURITY.md`](SECURITY.md).
|
||||||
|
|
||||||
|
## 💻 Documentación y desarrollo
|
||||||
|
|
||||||
|
- [`docs/cloud_features.md`](docs/cloud_features.md): diseño del pool de cuentas, la monitorización de cuota y el cambio automático.
|
||||||
|
- [`docs/proxyman-install.md`](docs/proxyman-install.md) y [`docs/proxyman-debugging.md`](docs/proxyman-debugging.md): configuración de la inspección TLS (Windows).
|
||||||
|
- [`docs/OpencodeAPI.md`](docs/OpencodeAPI.md): integración con endpoint personalizado de OpenCode (en portugués).
|
||||||
|
- [`cli/README.md`](cli/README.md): la herramienta de línea de comandos en Python.
|
||||||
|
- [`CONTRIBUTING.md`](CONTRIBUTING.md), [`SECURITY.md`](SECURITY.md), [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md), [`CHANGELOG.md`](CHANGELOG.md), [`LICENSE`](LICENSE), [`LICENSE-MIT`](LICENSE-MIT).
|
||||||
|
- Traducciones: [English](README.md), [Português](README.pt-BR.md), [中文](README.zh-CN.md).
|
||||||
|
|
||||||
|
### Estructura
|
||||||
|
|
||||||
|
```text
|
||||||
|
src/
|
||||||
|
├── components/ # UI (proxy/, usage/, primitivas ui/)
|
||||||
|
├── ipc/ # routers oRPC (account, cloud, config, gateway, usage...)
|
||||||
|
├── server/ # gateway proxy NestJS (módulos: proxy, usage)
|
||||||
|
├── services/ # AutoSwitchService, CloudMonitorService, GoogleAPIService
|
||||||
|
├── routes/ # index, usage, proxy, settings
|
||||||
|
├── utils/ # paths, logger, sensitiveDataMasking
|
||||||
|
└── tests/ # pruebas unitarias (Vitest) y E2E (Playwright)
|
||||||
|
cli/ # CLI de Python aparte para cambiar de cuenta y consultar cuota
|
||||||
|
docs/ # notas de diseño y guías de Proxyman
|
||||||
|
scripts/ # setup-dev, build-windows, generate-assets
|
||||||
|
```
|
||||||
|
|
||||||
|
### Scripts
|
||||||
|
|
||||||
|
| Comando | Qué hace |
|
||||||
|
|---|---|
|
||||||
|
| `pnpm start` | Ejecuta la app en modo dev (`electron-forge start`, con `DEBUG=electron-forge:*`). |
|
||||||
|
| `pnpm run dev` | Igual que `start`. |
|
||||||
|
| `pnpm run package` | Empaqueta la app con Electron Forge, sin generar instaladores. |
|
||||||
|
| `pnpm run make` | Genera instaladores/paquetes para la plataforma actual. |
|
||||||
|
| `pnpm run make:win` | Helper de build en Windows: extrae WiX de `wix314-binaries.zip`, lo añade al `PATH` y ejecuta `electron-forge make`. |
|
||||||
|
| `pnpm run publish` | Publica mediante Electron Forge. |
|
||||||
|
| `pnpm run setup` | Ejecuta `scripts/setup-dev.js`: detecta la toolchain nativa e instala o guía la configuración. |
|
||||||
|
| `pnpm run postinstall` | `scripts/setup-dev.js --check-only`; se ejecuta solo tras `pnpm install`. |
|
||||||
|
| `pnpm run lint` | ESLint sobre el repositorio. |
|
||||||
|
| `pnpm run format` | Comprobación de Prettier. |
|
||||||
|
| `pnpm run format:write` | Prettier con escritura. |
|
||||||
|
| `pnpm test` | Pruebas unitarias Vitest (`vitest run`). |
|
||||||
|
| `pnpm run test:watch` | Vitest en modo watch. |
|
||||||
|
| `pnpm run test:unit` | Vitest (modo por defecto). |
|
||||||
|
| `pnpm run test:e2e` | Pruebas E2E con Playwright. |
|
||||||
|
| `pnpm run test:all` | Pruebas unitarias y después Playwright. |
|
||||||
|
| `pnpm run type-check` | `tsc --noEmit`. |
|
||||||
|
|
||||||
|
## ❓ Preguntas frecuentes
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>Windows muestra "Windows protegió su PC". ¿Es normal?</b></summary>
|
||||||
|
|
||||||
|
Sí. Los builds no están firmados. Haz clic en **Más información → Ejecutar de todas formas**.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>Mi IDE no llega al proxy.</b></summary>
|
||||||
|
|
||||||
|
El proxy viene apagado: actívalo en la página Proxy. El puerto por defecto es `8045` (`8046` en builds de desarrollo) y se puede cambiar allí. Copia la API key de esa misma página y comprueba que haya al menos una cuenta en el pool.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>¿Necesito una API key?</b></summary>
|
||||||
|
|
||||||
|
Con `api_key` vacía el proxy funciona en modo abierto. Una vez activado escucha en `0.0.0.0`, así que define una clave y mantenla privada.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>¿Puedo usar modelos Claude?</b></summary>
|
||||||
|
|
||||||
|
Sí, mediante el mapeo de modelos sobre las cuentas de Google del pool, no con cuentas de Claude separadas.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>¿Dónde se guardan mis tokens?</b></summary>
|
||||||
|
|
||||||
|
En un `cloud_accounts.db` aparte, con `token_json` y `quota_json` cifrados con AES-256-GCM. La clave maestra vive en el almacén de credenciales del sistema vía `keytar`. Detalles en [Modelo de seguridad](#modelo-de-seguridad).
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>¿Puedo usarlo comercialmente?</b></summary>
|
||||||
|
|
||||||
|
Revisa antes la [Licencia](#-licencia): el código heredado de AntigravityManager es CC BY-NC-SA 4.0 (no comercial) y el código nuevo es MIT.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Limitaciones y próximos pasos
|
||||||
|
|
||||||
|
- El acceso upstream pasa por los endpoints `v1internal` de Cloud Code de Google y por scopes OAuth ([`src/services/GoogleAPIService.ts`](src/services/GoogleAPIService.ts)). Son APIs internas, sin documentar, que pueden cambiar sin aviso. El proyecto no es oficial y no está afiliado a Google ni a Anthropic.
|
||||||
|
- Las cuentas se añaden por Google OAuth; a los modelos Claude se llega mediante el mapeo de modelos, no con cuentas de Claude separadas.
|
||||||
|
- Las pruebas end-to-end no se ejecutan en CI (Electron necesita un entorno gráfico); ejecuta `pnpm run test:e2e` en local.
|
||||||
|
- El MSI de Windows solo se genera cuando el WiX Toolset está disponible en la máquina de build; si no, el artefacto de Windows es el ZIP.
|
||||||
|
- Los workflows de `.github/workflows/` están escritos para GitHub (llaman al CLI `gh` y al publicador de releases de GitHub), por eso este README no muestra badge de CI.
|
||||||
|
- Próximo paso declarado por el proyecto: migrar el código original restante a MIT (ver la [Licencia](#-licencia)).
|
||||||
|
|
||||||
|
## 🤝 Contribuir
|
||||||
|
|
||||||
|
Lee [`CONTRIBUTING.md`](CONTRIBUTING.md) y [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md). Las versiones las genera semantic-release a partir de Conventional Commits. Antes de abrir un PR, esto tiene que pasar:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pnpm run lint && pnpm run format:write && pnpm run type-check && pnpm test
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📄 Licencia
|
||||||
|
|
||||||
|
Licencia mixta: el código heredado de [AntigravityManager](https://github.com/Draculabo/AntigravityManager) (de Draculabo) es [CC BY-NC-SA 4.0](LICENSE) (no comercial, compartir igual); todo el código nuevo es [MIT](LICENSE-MIT). El proyecto está migrando a MIT a medida que se reescribe el código original restante, así que revisa ambos archivos antes de cualquier uso comercial.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|
<img src="docs/assets/logo.png" width="56" alt="Logo de Gemini Nexus">
|
||||||
|
|
||||||
|
<p><strong><a href="https://git.evandro.dev.br/evandro/gemini-nexus">Gemini Nexus en Gitea</a></strong> · <a href="https://git.evandro.dev.br/evandro/gemini-nexus/issues">Reportar un problema</a> · <a href="#-inicio-rápido">Inicio rápido</a></p>
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -1,349 +1,262 @@
|
|||||||
<p align="center">
|
<div align="center">
|
||||||
<img src="docs/assets/logo.png" alt="Antigravity Manager" width="128" height="128" />
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h1 align="center">Antigravity Manager</h1>
|
<img src="assets/readme/hero.png" width="100%" alt="Gemini Nexus: a desktop gateway that pools Google accounts behind one local OpenAI- and Anthropic-compatible API at http://localhost:8045/v1, switching accounts when quota runs low">
|
||||||
|
|
||||||
<p align="center">
|

|
||||||
<strong>🚀 Professional multi-account manager for Google Gemini & Claude AI</strong>
|

|
||||||
</p>
|

|
||||||
|
|
||||||
<p align="center">
|
<p><strong><a href="#-quickstart">Quickstart</a></strong> · <a href="#-documentation">Docs</a> · <a href="https://git.evandro.dev.br/evandro/gemini-nexus/issues">Issues</a></p>
|
||||||
English | <a href="README.zh-CN.md">简体中文</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
<sub>English · <a href="README.pt-BR.md">Português</a> · <a href="README.zh-CN.md">中文</a> · <a href="README.es.md">Español</a></sub>
|
||||||
<a href="https://github.com/Draculabo/AntigravityManager/actions/workflows/testing.yaml">
|
|
||||||
<img src="https://github.com/Draculabo/AntigravityManager/actions/workflows/testing.yaml/badge.svg" alt="Tests" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/Draculabo/AntigravityManager/actions/workflows/lint.yaml">
|
|
||||||
<img src="https://github.com/Draculabo/AntigravityManager/actions/workflows/lint.yaml/badge.svg" alt="Lint" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/Draculabo/AntigravityManager/releases">
|
|
||||||
<img src="https://img.shields.io/github/v/release/Draculabo/AntigravityManager?style=flat-square" alt="Release" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/Draculabo/AntigravityManager/releases">
|
|
||||||
<img src="https://img.shields.io/github/downloads/Draculabo/AntigravityManager/total?style=flat-square&color=blue" alt="Downloads" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/Draculabo/AntigravityManager/blob/main/LICENSE">
|
|
||||||
<img src="https://img.shields.io/github/license/Draculabo/AntigravityManager?style=flat-square" alt="License" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/Draculabo/AntigravityManager/stargazers">
|
|
||||||
<img src="https://img.shields.io/github/stars/Draculabo/AntigravityManager?style=flat-square" alt="Stars" />
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
</div>
|
||||||
<img src="https://img.shields.io/badge/Electron-191970?style=for-the-badge&logo=Electron&logoColor=white" alt="Electron" />
|
|
||||||
<img src="https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB" alt="React" />
|
|
||||||
<img src="https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript" />
|
|
||||||
<img src="https://img.shields.io/badge/Tailwind_CSS-38B2AC?style=for-the-badge&logo=tailwind-css&logoColor=white" alt="TailwindCSS" />
|
|
||||||
</p>
|
|
||||||
|
|
||||||
---
|
## 🖼️ Demo
|
||||||
|
|
||||||
## 📖 Table of Contents
|
<p align="center"><img src="docs/assets/main.png" width="100%" alt="Accounts page: a Google account in the pool with per-model quota bars, the Auto-Switch toggle and the global quota counter"></p>
|
||||||
|
|
||||||
- [Why Antigravity Manager?](#-why-antigravity-manager)
|
<details>
|
||||||
- [Features](#-features)
|
<summary>More screenshots: usage, proxy, routing, docs, connections, settings</summary>
|
||||||
- [Screenshots](#-screenshots)
|
|
||||||
- [Quick Start](#-quick-start)
|
|
||||||
- [Tech Stack](#️-tech-stack)
|
|
||||||
- [Development](#-development)
|
|
||||||
- [FAQ](#-faq)
|
|
||||||
- [Contributing](#-contributing)
|
|
||||||
- [License](#-license)
|
|
||||||
|
|
||||||
---
|
<p align="center"><img src="docs/assets/2usage.png" alt="Usage analytics" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/3proxy.png" alt="Proxy monitor" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/4routing.png" alt="Routing config" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/5docs.png" alt="Documentation" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/6connections.png" alt="Active connections" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/7config.png" alt="Settings" width="80%"></p>
|
||||||
|
|
||||||
## ✨ Why Antigravity Manager?
|
</details>
|
||||||
|
|
||||||
When using Antigravity IDE, have you ever encountered these problems?
|
## ✨ What it does
|
||||||
|
|
||||||
- 😫 Single account quota runs out quickly, requiring frequent manual switching
|
Working with AI-powered IDEs on a single Google account means quota that runs out, manual account switching and no view of what the proxy sends upstream. Gemini Nexus keeps every account in one pool and serves them through one local endpoint.
|
||||||
- 🔄 Managing multiple Google/Claude accounts is cumbersome
|
|
||||||
- 📊 Don't know how much quota is left on the current account
|
|
||||||
- ⏰ Worried about missing quota reset times
|
|
||||||
- 🔌 Need a reliable local API proxy for development tools
|
|
||||||
|
|
||||||
**Antigravity Manager** is here to solve these problems! It's a professional Electron desktop app that helps you:
|
|
||||||
|
|
||||||
- ✅ **Unlimited Account Pool** - Add any number of Google Gemini / Claude accounts
|
|
||||||
- ✅ **Smart Auto-Switching** - Automatically switch to the next available account when quota is low or rate-limited
|
|
||||||
- ✅ **Real-time Monitoring** - Visualize quota usage for all accounts
|
|
||||||
- ✅ **Local API Proxy** - Built-in OpenAI/Anthropic compatible proxy server
|
|
||||||
- ✅ **Secure Encryption** - AES-256-GCM encryption for sensitive data
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🎯 Features
|
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="50%">
|
<td width="50%" valign="top"><b>One local endpoint</b><br><code>POST /v1/chat/completions</code> (OpenAI), <code>POST /v1/messages</code> (Anthropic), <code>GET /v1/models</code> and <code>GET /v1/models/capabilities</code>, so Cursor, Windsurf, OpenCode, Claude Code and similar clients can connect. Model names are mapped through <code>custom_mapping</code> and <code>anthropic_mapping</code>.</td>
|
||||||
<h3>☁️ Cloud Account Pool</h3>
|
<td width="50%" valign="top"><b>Account pool</b><br>Google accounts added through OAuth, each with its status (Active, Rate Limited, Expired), last-used time and an optional per-account proxy URL.</td>
|
||||||
<ul>
|
</tr>
|
||||||
<li>Add unlimited Google Gemini / Claude accounts via OAuth</li>
|
<tr>
|
||||||
<li>Display avatar, email, status, and last used time</li>
|
<td width="50%" valign="top"><b>Auto-switch</b><br><code>CloudMonitorService</code> polls quota every 5 minutes and <code>AutoSwitchService</code> moves to another account when quota drops below 5 % or the account is rate-limited.</td>
|
||||||
<li>Real-time status monitoring (Active, Rate Limited, Expired)</li>
|
<td width="50%" valign="top"><b>Scheduling with a circuit breaker</b><br><code>cache-first</code>, <code>balance</code> (default) or <code>performance-first</code>, with a per-account circuit breaker (default backoff 60 s → 5 min → 30 min → 2 h).</td>
|
||||||
</ul>
|
</tr>
|
||||||
</td>
|
<tr>
|
||||||
<td width="50%">
|
<td width="50%" valign="top"><b>Usage and cost</b><br>Token usage per account and model, prompt and completion charts, and cost estimates from editable per-model pricing.</td>
|
||||||
<h3>📊 Real-time Quota Monitoring</h3>
|
<td width="50%" valign="top"><b>Traffic inspector</b><br>Latency, status and model for each request, replay of logged requests, generated cURL and Python snippets, plus an IDE Quick Setup.</td>
|
||||||
<ul>
|
</tr>
|
||||||
<li>Multi-model support: gemini-pro, claude-3-5-sonnet, etc.</li>
|
|
||||||
<li>Visual progress bars with color indicators</li>
|
|
||||||
<li>Auto & manual refresh capabilities</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="50%">
|
|
||||||
<h3>🔄 Intelligent Auto-Switching</h3>
|
|
||||||
<ul>
|
|
||||||
<li>Unlimited pool mode with smart backup selection</li>
|
|
||||||
<li>Auto-switch when quota < 5% or rate-limited</li>
|
|
||||||
<li>Background monitoring every 5 minutes</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
<td width="50%">
|
|
||||||
<h3>🔐 Security First</h3>
|
|
||||||
<ul>
|
|
||||||
<li>AES-256-GCM encryption for sensitive data</li>
|
|
||||||
<li>OS native credential manager integration</li>
|
|
||||||
<li>Auto migration of legacy plaintext data</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="50%">
|
|
||||||
<h3>💾 Account Backup</h3>
|
|
||||||
<ul>
|
|
||||||
<li>Capture snapshots of account state</li>
|
|
||||||
<li>Fast switching between saved accounts</li>
|
|
||||||
<li>View, organize, and delete snapshots</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
<td width="50%">
|
|
||||||
<h3>⚙️ Process Control</h3>
|
|
||||||
<ul>
|
|
||||||
<li>Auto-detect if Antigravity is running</li>
|
|
||||||
<li>Launch via URI protocol or executable</li>
|
|
||||||
<li>Graceful close or force kill</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="50%">
|
|
||||||
<h3>🔌 Local API Proxy</h3>
|
|
||||||
<ul>
|
|
||||||
<li>OpenAI & Anthropic API compatible</li>
|
|
||||||
<li>Configurable port and request timeout</li>
|
|
||||||
<li>Model mapping (e.g. Claude → Gemini)</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
<td width="50%">
|
|
||||||
<h3>🛠️ Developer Tools</h3>
|
|
||||||
<ul>
|
|
||||||
<li>Built-in cURL & Python code generation</li>
|
|
||||||
<li>Visual service status monitoring</li>
|
|
||||||
<li>One-click API Key regeneration</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
### Additional Features
|
Stored credentials are encrypted with AES-256-GCM under an OS-keychain master key (see [Security model](#-security-model)).
|
||||||
|
|
||||||
- **🖥️ System Tray** - Background mode with tray icon and right-click menu
|
## How it works
|
||||||
- **🔗 IDE Sync** - Automatically scan and import accounts from IDE's `state.vscdb`
|
|
||||||
- **📦 Batch Operations** - Batch refresh and delete multiple accounts
|
|
||||||
- **🌏 Internationalization** - Multi-language support (English / 中文)
|
|
||||||
- **🎨 Modern UI** - Built with React, TailwindCSS, and Shadcn UI
|
|
||||||
|
|
||||||
---
|
1. **Add accounts.** Sign in with Google OAuth on the Accounts page. Tokens are encrypted before they reach SQLite.
|
||||||
|
2. **Point your IDE at the proxy.** Enable the proxy on the Proxy page (it is off by default) and use `http://localhost:8045/v1` with the API key shown there, in OpenAI or Anthropic format.
|
||||||
|
3. **Nexus routes each request.** The token manager picks an account by scheduling mode and circuit-breaker state, calls Google's upstream APIs with that account's OAuth token, and auto-switch moves on when quota drops below 5 % or an account is rate-limited.
|
||||||
|
|
||||||
## 📸 Screenshots
|
The full flow, with the components involved, is in [Architecture](#-architecture).
|
||||||
|
|
||||||
<p align="center">
|
## 🚀 Quickstart
|
||||||
<img src="docs/assets/screenshot-main.png" alt="Main Interface" width="80%" />
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
There are no prebuilt downloads on the [Gitea Releases](https://git.evandro.dev.br/evandro/gemini-nexus/releases) page yet (the release workflows in `.github/workflows/` target GitHub), so build from source.
|
||||||
<img src="docs/assets/screenshot-proxy.png" alt="Proxy Interface" width="48%" />
|
|
||||||
<img src="docs/assets/screenshot-setting.png" alt="Settings Interface" width="48%" />
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
| Tool | Minimum version |
|
||||||
---
|
|---|---|
|
||||||
|
| Node.js | 20+ (recommended in `AGENTS.md`; `.nvmrc` pins 22.17.1) |
|
||||||
## � Quick Start
|
| pnpm | 10.11.0 (`packageManager`; lockfile is `pnpm-lock.yaml`) |
|
||||||
|
| Native toolchain | needed by `better-sqlite3` and `keytar`: Visual Studio 2022 Build Tools (C++) on Windows, Xcode Command Line Tools on macOS, `build-essential` + `python3` + `libsecret-1-dev` on Ubuntu (`base-devel` + `python` + `libsecret` on Arch) |
|
||||||
### Download
|
|
||||||
|
|
||||||
Download the latest release for your platform from the [Releases](https://github.com/Draculabo/AntigravityManager/releases) page.
|
|
||||||
|
|
||||||
| Platform | Download |
|
|
||||||
|----------|----------|
|
|
||||||
| Windows (x64/ARM64) | [.exe installer](https://github.com/Draculabo/AntigravityManager/releases/latest) |
|
|
||||||
| macOS | [.dmg installer](https://github.com/Draculabo/AntigravityManager/releases/latest) |
|
|
||||||
| Linux | [.deb / .rpm](https://github.com/Draculabo/AntigravityManager/releases/latest) |
|
|
||||||
|
|
||||||
### Build from Source
|
|
||||||
|
|
||||||
#### Prerequisites
|
|
||||||
|
|
||||||
- Node.js v18 or higher
|
|
||||||
- npm or yarn
|
|
||||||
|
|
||||||
#### Steps
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Clone the repository
|
git clone https://git.evandro.dev.br/evandro/gemini-nexus.git
|
||||||
git clone https://github.com/Draculabo/AntigravityManager.git
|
cd gemini-nexus
|
||||||
cd AntigravityManager
|
pnpm install # postinstall runs scripts/setup-dev.js --check-only to verify the toolchain
|
||||||
|
pnpm start # dev mode (Electron + Vite HMR)
|
||||||
# Install dependencies
|
pnpm run make # installers/packages for the current platform
|
||||||
npm install
|
pnpm run make:win # Windows: extracts WiX from wix314-binaries.zip, then runs make
|
||||||
|
|
||||||
# Start development
|
|
||||||
npm start
|
|
||||||
|
|
||||||
# Build for production
|
|
||||||
npm run make
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
Then add at least one account, enable the proxy (it is disabled by default) and point your IDE at it:
|
||||||
|
|
||||||
## �🛠️ Tech Stack
|
```text
|
||||||
|
API Base URL: http://localhost:8045/v1 (default, configurable on the Proxy page; development builds use 8046)
|
||||||
| Category | Technologies |
|
API Key: (copy it from the Proxy page in the app)
|
||||||
|----------|-------------|
|
Model: gemini-3-flash (or any mapped model)
|
||||||
| **Core** | [Electron](https://www.electronjs.org/), [React](https://react.dev/), [TypeScript](https://www.typescriptlang.org/) |
|
|
||||||
| **Build Tool** | [Vite](https://vitejs.dev/) |
|
|
||||||
| **Styling** | [TailwindCSS](https://tailwindcss.com/), [Shadcn UI](https://ui.shadcn.com/) |
|
|
||||||
| **State** | [TanStack Query](https://tanstack.com/query/latest), [TanStack Router](https://tanstack.com/router/latest) |
|
|
||||||
| **Database** | [Better-SQLite3](https://github.com/WiseLibs/better-sqlite3) |
|
|
||||||
| **Testing** | [Vitest](https://vitest.dev/), [Playwright](https://playwright.dev/) |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## � Development
|
|
||||||
|
|
||||||
### Available Scripts
|
|
||||||
|
|
||||||
| Command | Description |
|
|
||||||
|---------|-------------|
|
|
||||||
| `npm start` | Start the app in development mode |
|
|
||||||
| `npm run lint` | Run ESLint to check for code issues |
|
|
||||||
| `npm run format:write` | Format code with Prettier |
|
|
||||||
| `npm run test:unit` | Run unit tests with Vitest |
|
|
||||||
| `npm run test:e2e` | Run E2E tests with Playwright |
|
|
||||||
| `npm run test:all` | Run all tests |
|
|
||||||
| `npm run type-check` | Run TypeScript type checking |
|
|
||||||
| `npm run make` | Build production packages |
|
|
||||||
|
|
||||||
### Project Structure
|
|
||||||
|
|
||||||
```
|
|
||||||
AntigravityManager/
|
|
||||||
├── src/
|
|
||||||
│ ├── main.ts # Electron main process
|
|
||||||
│ ├── preload.ts # Preload script
|
|
||||||
│ ├── renderer/ # React renderer process
|
|
||||||
│ ├── ipc/ # IPC communication handlers
|
|
||||||
│ └── server/ # Built-in server
|
|
||||||
├── docs/ # Documentation and assets
|
|
||||||
└── .github/ # GitHub configuration
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
> [!WARNING]
|
||||||
|
> Builds are not code-signed. If Windows shows "Windows protected your PC", click **More info → Run anyway**.
|
||||||
|
|
||||||
## ❓ FAQ
|
There is no `.env.example` and no variable is required. Optional variables read by the code or described in the docs:
|
||||||
|
|
||||||
|
| Variable | Required | Description |
|
||||||
|
|---|---|---|
|
||||||
|
| `HTTP_PROXY` / `HTTPS_PROXY` / `NO_PROXY` | No | Route the app's outbound requests through a local proxy (see [TLS inspection](#-security-model)). |
|
||||||
|
| `NODE_EXTRA_CA_CERTS` | No | Extra CA certificate for Node-side TLS when inspecting traffic. |
|
||||||
|
| `SENTRY_DSN` | No | Sentry DSN used when error reporting is enabled. |
|
||||||
|
|
||||||
|
## Stack
|
||||||
|
|
||||||
|
| Layer | Technology |
|
||||||
|
|---|---|
|
||||||
|
| Desktop shell | Electron 41, Electron Forge, Vite |
|
||||||
|
| Interface | React 19, TypeScript, Tailwind CSS 4, Radix UI, Nivo charts, i18next |
|
||||||
|
| App data flow | TanStack Router and Query, oRPC over Electron IPC |
|
||||||
|
| Proxy | NestJS 11 on Fastify |
|
||||||
|
| Storage | SQLite (better-sqlite3 + Drizzle ORM), OS keychain via `keytar` |
|
||||||
|
| Logs and errors | Winston (rotating files), Sentry (optional) |
|
||||||
|
| Tests | Vitest, Playwright |
|
||||||
|
|
||||||
|
## 🧱 Architecture
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
C["Client: Cursor, Windsurf, OpenCode, Claude Code"] -->|"/v1/chat/completions, /v1/messages"| P["NestJS proxy, port 8045"]
|
||||||
|
P --> S["Account scheduler and circuit breaker"]
|
||||||
|
S -->|"Google OAuth account"| G["Google upstream APIs"]
|
||||||
|
M["CloudMonitor and AutoSwitch, quota every 5 min"] -->|"quota polling"| G
|
||||||
|
S -->|"reads accounts"| DB[("SQLite: better-sqlite3 and Drizzle")]
|
||||||
|
M --> DB
|
||||||
|
K["AES-256-GCM, master key in OS keychain"] -->|"encrypts tokens"| DB
|
||||||
|
```
|
||||||
|
|
||||||
|
1. A client sends OpenAI- or Anthropic-format requests to the NestJS proxy (Fastify, bound to `0.0.0.0`).
|
||||||
|
2. The proxy guard checks the API key when one is configured; with an empty key the proxy runs in open mode.
|
||||||
|
3. The token manager picks an account according to the scheduling mode and each account's circuit-breaker state, then calls Google's upstream APIs with that account's OAuth token.
|
||||||
|
4. `CloudMonitorService` polls quota every 5 minutes and `AutoSwitchService` switches the active account when quota is below 5 % or the account is rate-limited.
|
||||||
|
5. The React 19 renderer (TanStack Router and Query) talks to the main process over oRPC on IPC; accounts, usage and settings live in SQLite (better-sqlite3 + Drizzle). Design notes: [`docs/cloud_features.md`](docs/cloud_features.md).
|
||||||
|
|
||||||
|
## 🔒 Security model
|
||||||
|
|
||||||
|
Gemini Nexus holds OAuth tokens for several accounts and forwards traffic upstream, so credential handling is the core of the design. Everything below is implemented in this repository; limits are stated where they exist.
|
||||||
|
|
||||||
|
- **Credential storage and isolation.** `token_json` and `quota_json` are encrypted with AES-256-GCM (unique IV per operation, authenticated) before they reach SQLite. The master key lives in the OS credential store through `keytar` (Windows Credential Manager, macOS Keychain, Linux Secret Service/libsecret), never in a plain file. Legacy plaintext rows are migrated at startup. Accounts are kept in their own database (`cloud_accounts.db`), independent from the IDE's local database.
|
||||||
|
- **Log masking.** Keys such as `token`, `refresh_token`, `api_key`, `authorization`, `cookie` and `client_secret` are replaced by `[REDACTED]` before logging ([`src/utils/sensitiveDataMasking.ts`](src/utils/sensitiveDataMasking.ts)); the traffic logger also redacts the `authorization`, `x-api-key` and `cookie` headers.
|
||||||
|
- **Request logging, not an audit trail.** Winston writes API, traffic and app logs to rotating files (API log: 30 days, 50 MB per file). These are operational logs, not a tamper-evident audit trail; the `*-audit.json` files are rotation bookkeeping from `winston-daily-rotate-file`.
|
||||||
|
- **Proxy access.** The proxy is off by default. Once enabled it listens on `0.0.0.0`, and requests are authenticated only when `api_key` is non-empty (empty means open mode). Set a key and keep it private.
|
||||||
|
- **TLS inspection (debugging only).** [`docs/proxyman-install.md`](docs/proxyman-install.md) and [`docs/proxyman-debugging.md`](docs/proxyman-debugging.md) explain how to read the app's HTTPS traffic with Proxyman: trust its root CA, set the proxy variables and `NODE_EXTRA_CA_CERTS`, then start the app. `NODE_TLS_REJECT_UNAUTHORIZED=0` (and the script's `-AllowInsecureTls` flag) is a temporary override; never leave it on. Do not commit proxy addresses, certificate paths, cookies or OAuth codes, and redact logs before sharing them. `scripts/start-antigravity-with-proxyman.ps1` targets the installed official Antigravity client, not this app.
|
||||||
|
- **Error reporting.** Sentry reports (they need `SENTRY_DSN`) are gated by the `error_reporting_enabled` setting, which `DEFAULT_APP_CONFIG` ships as `true`; turn it off in Settings to opt out. The Windows user-name segment is masked in reported exception messages.
|
||||||
|
|
||||||
|
Supported versions and how to report a vulnerability: [`SECURITY.md`](SECURITY.md).
|
||||||
|
|
||||||
|
## 📚 Documentation
|
||||||
|
|
||||||
|
- [`docs/cloud_features.md`](docs/cloud_features.md): account pool, quota monitoring and auto-switch design.
|
||||||
|
- [`docs/proxyman-install.md`](docs/proxyman-install.md) and [`docs/proxyman-debugging.md`](docs/proxyman-debugging.md): TLS inspection setup (Windows).
|
||||||
|
- [`docs/OpencodeAPI.md`](docs/OpencodeAPI.md): OpenCode custom-endpoint integration (in Portuguese).
|
||||||
|
- [`cli/README.md`](cli/README.md): the Python command-line tool.
|
||||||
|
- [`CONTRIBUTING.md`](CONTRIBUTING.md), [`SECURITY.md`](SECURITY.md), [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md), [`CHANGELOG.md`](CHANGELOG.md), [`LICENSE`](LICENSE), [`LICENSE-MIT`](LICENSE-MIT).
|
||||||
|
- Translations: [Português](README.pt-BR.md), [中文](README.zh-CN.md), [Español](README.es.md).
|
||||||
|
|
||||||
|
### 🗂️ Structure
|
||||||
|
|
||||||
|
```text
|
||||||
|
src/
|
||||||
|
├── components/ # UI (proxy/, usage/, ui/ primitives)
|
||||||
|
├── ipc/ # oRPC routers (account, cloud, config, gateway, usage...)
|
||||||
|
├── server/ # NestJS proxy gateway (modules: proxy, usage)
|
||||||
|
├── services/ # AutoSwitchService, CloudMonitorService, GoogleAPIService
|
||||||
|
├── routes/ # index, usage, proxy, settings
|
||||||
|
├── utils/ # paths, logger, sensitiveDataMasking
|
||||||
|
└── tests/ # unit tests (Vitest) and E2E (Playwright)
|
||||||
|
cli/ # separate Python CLI for account switching and quota checks
|
||||||
|
docs/ # design notes and Proxyman guides
|
||||||
|
scripts/ # setup-dev, build-windows, generate-assets
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🧪 Scripts
|
||||||
|
|
||||||
|
| Command | What it does |
|
||||||
|
|---|---|
|
||||||
|
| `pnpm start` | Run the app in dev mode (`electron-forge start`, with `DEBUG=electron-forge:*`). |
|
||||||
|
| `pnpm run dev` | Same as `start`. |
|
||||||
|
| `pnpm run package` | Package the app with Electron Forge, without building installers. |
|
||||||
|
| `pnpm run make` | Build installers/packages for the current platform. |
|
||||||
|
| `pnpm run make:win` | Windows build helper: extracts WiX from `wix314-binaries.zip`, adds it to `PATH`, runs `electron-forge make`. |
|
||||||
|
| `pnpm run publish` | Publish through Electron Forge. |
|
||||||
|
| `pnpm run setup` | Run `scripts/setup-dev.js`: detect the native toolchain and install or guide the setup. |
|
||||||
|
| `pnpm run postinstall` | `scripts/setup-dev.js --check-only`; runs automatically after `pnpm install`. |
|
||||||
|
| `pnpm run lint` | ESLint over the repo. |
|
||||||
|
| `pnpm run format` | Prettier check. |
|
||||||
|
| `pnpm run format:write` | Prettier write. |
|
||||||
|
| `pnpm test` | Vitest unit tests (`vitest run`). |
|
||||||
|
| `pnpm run test:watch` | Vitest in watch mode. |
|
||||||
|
| `pnpm run test:unit` | Vitest (default mode). |
|
||||||
|
| `pnpm run test:e2e` | Playwright E2E tests. |
|
||||||
|
| `pnpm run test:all` | Unit tests, then Playwright. |
|
||||||
|
| `pnpm run type-check` | `tsc --noEmit`. |
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><b>Q: The app won't start?</b></summary>
|
<summary><b>Windows shows "Windows protected your PC". Is that expected?</b></summary>
|
||||||
|
|
||||||
Please check:
|
Yes. Builds are not code-signed. Click **More info → Run anyway**.
|
||||||
1. Make sure all dependencies are installed: `npm install`
|
|
||||||
2. Check if Node.js version is >= 18
|
|
||||||
3. Try deleting `node_modules` and reinstalling
|
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><b>Q: Account login failed?</b></summary>
|
<summary><b>My IDE cannot reach the proxy.</b></summary>
|
||||||
|
|
||||||
1. Ensure network connection is working
|
The proxy is disabled by default: enable it on the Proxy page. The default port is `8045` (`8046` in development builds) and can be changed there. Copy the API key from the same page and make sure at least one account is in the pool.
|
||||||
2. Try clearing app data and logging in again
|
|
||||||
3. Check if the account is restricted by Google/Claude
|
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><b>Q: macOS shows Keychain/Credential error and OAuth cannot be saved?</b></summary>
|
<summary><b>Do I need an API key?</b></summary>
|
||||||
|
|
||||||
This is a common macOS security behavior, usually when the app is unsigned or run directly from Downloads.
|
With an empty `api_key` the proxy runs in open mode. Once enabled it listens on `0.0.0.0`, so set a key and keep it private.
|
||||||
This is a **temporary workaround** for personal use:
|
|
||||||
|
|
||||||
1. Move the app to `/Applications`
|
|
||||||
2. Run the following commands in Terminal (repeat after every update)
|
|
||||||
|
|
||||||
```plaintext
|
|
||||||
sudo xattr -dr com.apple.quarantine "/Applications/Antigravity Manager 2.app"
|
|
||||||
codesign --force --deep --sign - "/Applications/Antigravity Manager 2.app"
|
|
||||||
```
|
|
||||||
|
|
||||||
Reopen the app and allow Keychain access if prompted.
|
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><b>Q: How to report issues or suggestions?</b></summary>
|
<summary><b>Can I use Claude models?</b></summary>
|
||||||
|
|
||||||
Please submit issues or suggestions via [GitHub Issues](https://github.com/Draculabo/AntigravityManager/issues).
|
Yes, through model mapping on the Google accounts in the pool, not through separate Claude accounts.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
---
|
<details>
|
||||||
|
<summary><b>Where are my tokens stored?</b></summary>
|
||||||
|
|
||||||
## 🌟 Star History
|
In a separate `cloud_accounts.db`, with `token_json` and `quota_json` encrypted by AES-256-GCM. The master key lives in the OS credential store through `keytar`. Details in [Security model](#-security-model).
|
||||||
|
|
||||||
<a href="https://github.com/Draculabo/AntigravityManager/stargazers">
|
</details>
|
||||||
<picture>
|
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Draculabo/AntigravityManager&type=Date&theme=dark" />
|
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Draculabo/AntigravityManager&type=Date" />
|
|
||||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Draculabo/AntigravityManager&type=Date" />
|
|
||||||
</picture>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
---
|
<details>
|
||||||
|
<summary><b>Can I use it commercially?</b></summary>
|
||||||
|
|
||||||
|
Check the [License](#-license) first: code inherited from AntigravityManager is CC BY-NC-SA 4.0 (non-commercial), new code is MIT.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## 🛣️ Limitations and next steps
|
||||||
|
|
||||||
|
- Upstream access goes through Google's `v1internal` Cloud Code endpoints and OAuth scopes ([`src/services/GoogleAPIService.ts`](src/services/GoogleAPIService.ts)). These are internal, undocumented APIs and may change without notice. The project is unofficial and not affiliated with Google or Anthropic.
|
||||||
|
- Accounts are added through Google OAuth; Claude models are reached through model mapping, not through separate Claude accounts.
|
||||||
|
- End-to-end tests are not run in CI (Electron needs a graphical environment); run `pnpm run test:e2e` locally.
|
||||||
|
- The Windows MSI is only produced when the WiX Toolset is available on the build machine; otherwise the Windows artifact is the ZIP.
|
||||||
|
- The workflows in `.github/workflows/` are written for GitHub (they call the `gh` CLI and the GitHub release publisher), so this README shows no CI badge.
|
||||||
|
- Next step stated by the project: migrate the remaining original code to MIT (see [License](#-license)).
|
||||||
|
|
||||||
## 🤝 Contributing
|
## 🤝 Contributing
|
||||||
|
|
||||||
Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details.
|
Read [`CONTRIBUTING.md`](CONTRIBUTING.md) and [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md). Releases are versioned by semantic-release from Conventional Commits. Before opening a PR, these must pass:
|
||||||
|
|
||||||
We follow the [Contributor Covenant](CODE_OF_CONDUCT.md) Code of Conduct.
|
```bash
|
||||||
|
pnpm run lint && pnpm run format:write && pnpm run type-check && pnpm test
|
||||||
---
|
```
|
||||||
|
|
||||||
## 📄 License
|
## 📄 License
|
||||||
|
|
||||||
[CC BY-NC-SA 4.0](LICENSE)
|
Mixed licensing: code inherited from [AntigravityManager](https://github.com/Draculabo/AntigravityManager) (by Draculabo) is [CC BY-NC-SA 4.0](LICENSE) (non-commercial, share-alike); all new code is [MIT](LICENSE-MIT). The project is migrating to MIT as the remaining original code is rewritten, so check both files before any commercial use.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ⚠️ Disclaimer
|
<div align="center">
|
||||||
|
|
||||||
> [!WARNING]
|
<img src="docs/assets/logo.png" width="56" alt="Gemini Nexus logo">
|
||||||
> **For Educational Purposes Only**
|
|
||||||
>
|
|
||||||
> This project is intended solely for educational and research purposes. It is provided "as-is" without any warranty. **Commercial use is strictly prohibited.**
|
|
||||||
>
|
|
||||||
> By using this software, you agree that you will not use it for any commercial purposes, and you are solely responsible for ensuring your use complies with all applicable laws and regulations. The authors and contributors are not responsible for any misuse or damages arising from the use of this software.
|
|
||||||
|
|
||||||
---
|
<p><strong><a href="https://git.evandro.dev.br/evandro/gemini-nexus">Gemini Nexus on Gitea</a></strong> · <a href="https://git.evandro.dev.br/evandro/gemini-nexus/issues">Report an issue</a> · <a href="#-quickstart">Quickstart</a></p>
|
||||||
|
|
||||||
<p align="center">
|
</div>
|
||||||
If this project helps you, please give it a ⭐ Star!
|
|
||||||
</p>
|
|
||||||
@@ -0,0 +1,262 @@
|
|||||||
|
<div align="center">
|
||||||
|
|
||||||
|
<img src="assets/readme/hero.pt-BR.png" width="100%" alt="Gemini Nexus: gateway desktop que reúne contas Google atrás de uma API local compatível com OpenAI e Anthropic em http://localhost:8045/v1, trocando de conta quando a cota acaba">
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
<p><strong><a href="#-início-rápido">Início rápido</a></strong> · <a href="#-documentação-e-desenvolvimento">Docs</a> · <a href="https://git.evandro.dev.br/evandro/gemini-nexus/issues">Issues</a></p>
|
||||||
|
|
||||||
|
<sub><a href="README.md">English</a> · Português · <a href="README.zh-CN.md">中文</a> · <a href="README.es.md">Español</a></sub>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
## 📸 Screenshots
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/main.png" width="100%" alt="Página Accounts: uma conta Google no pool com barras de cota por modelo, o botão Auto-Switch e o contador de cota global"></p>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Mais screenshots: uso, proxy, roteamento, docs, conexões, configurações</summary>
|
||||||
|
|
||||||
|
<p align="center"><img src="docs/assets/2usage.png" alt="Analytics de uso" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/3proxy.png" alt="Monitor do proxy" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/4routing.png" alt="Configuração de roteamento" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/5docs.png" alt="Documentação" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/6connections.png" alt="Conexões ativas" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/7config.png" alt="Configurações" width="80%"></p>
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## 🎯 Funcionalidades
|
||||||
|
|
||||||
|
Usar IDEs com IA numa única conta Google significa cota que acaba, troca manual de conta e nenhuma visão do que o proxy manda para cima. O Gemini Nexus mantém todas as contas num pool e as serve por um único endpoint local.
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td width="50%" valign="top"><b>Um endpoint local</b><br><code>POST /v1/chat/completions</code> (OpenAI), <code>POST /v1/messages</code> (Anthropic), <code>GET /v1/models</code> e <code>GET /v1/models/capabilities</code>, para que Cursor, Windsurf, OpenCode, Claude Code e clientes parecidos se conectem. Os nomes de modelo são mapeados por <code>custom_mapping</code> e <code>anthropic_mapping</code>.</td>
|
||||||
|
<td width="50%" valign="top"><b>Pool de contas</b><br>Contas Google adicionadas via OAuth, cada uma com status (Active, Rate Limited, Expired), horário do último uso e uma URL de proxy opcional por conta.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="50%" valign="top"><b>Troca automática</b><br>O <code>CloudMonitorService</code> consulta a cota a cada 5 minutos e o <code>AutoSwitchService</code> passa para outra conta quando a cota cai abaixo de 5 % ou a conta sofre rate limit.</td>
|
||||||
|
<td width="50%" valign="top"><b>Agendamento com circuit breaker</b><br><code>cache-first</code>, <code>balance</code> (padrão) ou <code>performance-first</code>, com circuit breaker por conta (backoff padrão 60 s → 5 min → 30 min → 2 h).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td width="50%" valign="top"><b>Uso e custo</b><br>Consumo de tokens por conta e por modelo, gráficos de prompt e completion e estimativa de custo com preço por modelo editável.</td>
|
||||||
|
<td width="50%" valign="top"><b>Inspetor de tráfego</b><br>Latência, status e modelo de cada requisição, replay de requisições registradas, snippets cURL e Python gerados e um Quick Setup para IDEs.</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
As credenciais salvas são criptografadas com AES-256-GCM sob uma chave mestra guardada no chaveiro do sistema (veja [Modelo de segurança](#modelo-de-segurança)).
|
||||||
|
|
||||||
|
## Como funciona
|
||||||
|
|
||||||
|
1. **Adicione contas.** Entre com Google OAuth na página Accounts. Os tokens são criptografados antes de chegar ao SQLite.
|
||||||
|
2. **Aponte a IDE para o proxy.** Ative o proxy na página Proxy (ele vem desligado) e use `http://localhost:8045/v1` com a API key mostrada ali, no formato OpenAI ou Anthropic.
|
||||||
|
3. **O Nexus roteia cada requisição.** O token manager escolhe uma conta pelo modo de agendamento e pelo estado do circuit breaker, chama as APIs upstream do Google com o token OAuth dessa conta, e a troca automática entra em ação quando a cota cai abaixo de 5 % ou uma conta sofre rate limit.
|
||||||
|
|
||||||
|
O fluxo completo, com os componentes envolvidos, está em [Arquitetura](#arquitetura).
|
||||||
|
|
||||||
|
## ⚡ Início rápido
|
||||||
|
|
||||||
|
Ainda não há downloads prontos na página de [Releases do Gitea](https://git.evandro.dev.br/evandro/gemini-nexus/releases) (os workflows de release em `.github/workflows/` são para o GitHub), então compile pelo código-fonte.
|
||||||
|
|
||||||
|
| Ferramenta | Versão mínima |
|
||||||
|
|---|---|
|
||||||
|
| Node.js | 20+ (recomendado no `AGENTS.md`; o `.nvmrc` fixa 22.17.1) |
|
||||||
|
| pnpm | 10.11.0 (`packageManager`; o lockfile é `pnpm-lock.yaml`) |
|
||||||
|
| Toolchain nativa | exigida por `better-sqlite3` e `keytar`: Visual Studio 2022 Build Tools (C++) no Windows, Xcode Command Line Tools no macOS, `build-essential` + `python3` + `libsecret-1-dev` no Ubuntu (`base-devel` + `python` + `libsecret` no Arch) |
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://git.evandro.dev.br/evandro/gemini-nexus.git
|
||||||
|
cd gemini-nexus
|
||||||
|
pnpm install # o postinstall roda scripts/setup-dev.js --check-only para conferir a toolchain
|
||||||
|
pnpm start # modo dev (Electron + Vite HMR)
|
||||||
|
pnpm run make # instaladores/pacotes para a plataforma atual
|
||||||
|
pnpm run make:win # Windows: extrai o WiX de wix314-binaries.zip e roda o make
|
||||||
|
```
|
||||||
|
|
||||||
|
Depois adicione pelo menos uma conta, ative o proxy (ele vem desligado) e aponte sua IDE para ele:
|
||||||
|
|
||||||
|
```text
|
||||||
|
API Base URL: http://localhost:8045/v1 (padrão, configurável na página Proxy; builds de desenvolvimento usam 8046)
|
||||||
|
API Key: (copie da página Proxy no app)
|
||||||
|
Model: gemini-3-flash (ou qualquer modelo mapeado)
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> Os builds não são assinados. Se o Windows mostrar "O Windows protegeu o seu computador", clique em **Mais informações → Executar mesmo assim**.
|
||||||
|
|
||||||
|
Não existe `.env.example` e nenhuma variável é obrigatória. Variáveis opcionais lidas pelo código ou descritas nos docs:
|
||||||
|
|
||||||
|
| Variável | Obrigatória | Descrição |
|
||||||
|
|---|---|---|
|
||||||
|
| `HTTP_PROXY` / `HTTPS_PROXY` / `NO_PROXY` | Não | Encaminha as requisições de saída do app por um proxy local (veja inspeção TLS em [Modelo de segurança](#modelo-de-segurança)). |
|
||||||
|
| `NODE_EXTRA_CA_CERTS` | Não | Certificado de CA extra para o TLS do lado Node ao inspecionar tráfego. |
|
||||||
|
| `SENTRY_DSN` | Não | DSN do Sentry usado quando o envio de erros está ativo. |
|
||||||
|
|
||||||
|
## 🛠️ Stack
|
||||||
|
|
||||||
|
| Camada | Tecnologia |
|
||||||
|
|---|---|
|
||||||
|
| Shell desktop | Electron 41, Electron Forge, Vite |
|
||||||
|
| Interface | React 19, TypeScript, Tailwind CSS 4, Radix UI, gráficos Nivo, i18next |
|
||||||
|
| Fluxo de dados do app | TanStack Router e Query, oRPC sobre IPC do Electron |
|
||||||
|
| Proxy | NestJS 11 sobre Fastify |
|
||||||
|
| Armazenamento | SQLite (better-sqlite3 + Drizzle ORM), chaveiro do sistema via `keytar` |
|
||||||
|
| Logs e erros | Winston (arquivos rotativos), Sentry (opcional) |
|
||||||
|
| Testes | Vitest, Playwright |
|
||||||
|
|
||||||
|
## Arquitetura
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
C["Cliente: Cursor, Windsurf, OpenCode, Claude Code"] -->|"/v1/chat/completions, /v1/messages"| P["Proxy NestJS, porta 8045"]
|
||||||
|
P --> S["Agendador de contas e circuit breaker"]
|
||||||
|
S -->|"conta Google OAuth"| G["APIs upstream do Google"]
|
||||||
|
M["CloudMonitor e AutoSwitch, cota a cada 5 min"] -->|"consulta de cota"| G
|
||||||
|
S -->|"lê contas"| DB[("SQLite: better-sqlite3 e Drizzle")]
|
||||||
|
M --> DB
|
||||||
|
K["AES-256-GCM, chave mestra no chaveiro do sistema"] -->|"criptografa tokens"| DB
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Um cliente envia requisições no formato OpenAI ou Anthropic para o proxy NestJS (Fastify, escutando em `0.0.0.0`).
|
||||||
|
2. O guard do proxy confere a API key quando há uma configurada; com a chave vazia o proxy roda em modo aberto.
|
||||||
|
3. O token manager escolhe uma conta segundo o modo de agendamento e o estado do circuit breaker de cada conta, e chama as APIs upstream do Google com o token OAuth dessa conta.
|
||||||
|
4. O `CloudMonitorService` consulta a cota a cada 5 minutos e o `AutoSwitchService` troca a conta ativa quando a cota está abaixo de 5 % ou a conta sofre rate limit.
|
||||||
|
5. O renderer React 19 (TanStack Router e Query) conversa com o processo principal via oRPC sobre IPC; contas, uso e configurações ficam no SQLite (better-sqlite3 + Drizzle). Notas de design: [`docs/cloud_features.md`](docs/cloud_features.md).
|
||||||
|
|
||||||
|
## Modelo de segurança
|
||||||
|
|
||||||
|
O Gemini Nexus guarda tokens OAuth de várias contas e repassa tráfego para cima, então o tratamento de credenciais é o centro do design. Tudo abaixo está implementado neste repositório; os limites aparecem onde existem.
|
||||||
|
|
||||||
|
- **Armazenamento e isolamento de credenciais.** `token_json` e `quota_json` são criptografados com AES-256-GCM (IV único por operação, autenticado) antes de chegar ao SQLite. A chave mestra fica no cofre de credenciais do sistema via `keytar` (Gerenciador de Credenciais do Windows, Keychain do macOS, Secret Service/libsecret no Linux), nunca num arquivo comum. Linhas legadas em texto puro são migradas na inicialização. As contas ficam num banco próprio (`cloud_accounts.db`), separado do banco local da IDE.
|
||||||
|
- **Mascaramento de logs.** Chaves como `token`, `refresh_token`, `api_key`, `authorization`, `cookie` e `client_secret` são trocadas por `[REDACTED]` antes de ir para o log ([`src/utils/sensitiveDataMasking.ts`](src/utils/sensitiveDataMasking.ts)); o logger de tráfego também oculta os headers `authorization`, `x-api-key` e `cookie`.
|
||||||
|
- **Log de requisições, não trilha de auditoria.** O Winston grava logs de API, tráfego e app em arquivos rotativos (log de API: 30 dias, 50 MB por arquivo). São logs operacionais, não uma trilha de auditoria à prova de adulteração; os arquivos `*-audit.json` são o controle de rotação do `winston-daily-rotate-file`.
|
||||||
|
- **Acesso ao proxy.** O proxy vem desligado. Quando ativado, escuta em `0.0.0.0`, e as requisições só são autenticadas quando `api_key` não está vazia (vazia significa modo aberto). Defina uma chave e mantenha-a privada.
|
||||||
|
- **Inspeção TLS (só para debug).** [`docs/proxyman-install.md`](docs/proxyman-install.md) e [`docs/proxyman-debugging.md`](docs/proxyman-debugging.md) explicam como ler o tráfego HTTPS do app com o Proxyman: confiar na CA raiz dele, definir as variáveis de proxy e `NODE_EXTRA_CA_CERTS` e então iniciar o app. `NODE_TLS_REJECT_UNAUTHORIZED=0` (e a flag `-AllowInsecureTls` do script) é um ajuste temporário; nunca deixe ligado. Não faça commit de endereços de proxy, caminhos de certificado, cookies ou códigos OAuth, e oculte dados dos logs antes de compartilhá-los. `scripts/start-antigravity-with-proxyman.ps1` mira o cliente oficial do Antigravity instalado, não este app.
|
||||||
|
- **Envio de erros.** Os relatórios do Sentry (precisam de `SENTRY_DSN`) dependem da configuração `error_reporting_enabled`, que o `DEFAULT_APP_CONFIG` traz como `true`; desative em Settings para não enviar. O trecho com o nome de usuário do Windows é mascarado nas mensagens de exceção enviadas.
|
||||||
|
|
||||||
|
Versões suportadas e como reportar uma vulnerabilidade: [`SECURITY.md`](SECURITY.md).
|
||||||
|
|
||||||
|
## 💻 Documentação e desenvolvimento
|
||||||
|
|
||||||
|
- [`docs/cloud_features.md`](docs/cloud_features.md): design do pool de contas, do monitoramento de cota e da troca automática.
|
||||||
|
- [`docs/proxyman-install.md`](docs/proxyman-install.md) e [`docs/proxyman-debugging.md`](docs/proxyman-debugging.md): configuração da inspeção TLS (Windows).
|
||||||
|
- [`docs/OpencodeAPI.md`](docs/OpencodeAPI.md): integração com endpoint customizado do OpenCode (em português).
|
||||||
|
- [`cli/README.md`](cli/README.md): a ferramenta de linha de comando em Python.
|
||||||
|
- [`CONTRIBUTING.md`](CONTRIBUTING.md), [`SECURITY.md`](SECURITY.md), [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md), [`CHANGELOG.md`](CHANGELOG.md), [`LICENSE`](LICENSE), [`LICENSE-MIT`](LICENSE-MIT).
|
||||||
|
- Traduções: [English](README.md), [中文](README.zh-CN.md), [Español](README.es.md).
|
||||||
|
|
||||||
|
### Estrutura
|
||||||
|
|
||||||
|
```text
|
||||||
|
src/
|
||||||
|
├── components/ # UI (proxy/, usage/, primitivos ui/)
|
||||||
|
├── ipc/ # routers oRPC (account, cloud, config, gateway, usage...)
|
||||||
|
├── server/ # gateway proxy NestJS (módulos: proxy, usage)
|
||||||
|
├── services/ # AutoSwitchService, CloudMonitorService, GoogleAPIService
|
||||||
|
├── routes/ # index, usage, proxy, settings
|
||||||
|
├── utils/ # paths, logger, sensitiveDataMasking
|
||||||
|
└── tests/ # testes unitários (Vitest) e E2E (Playwright)
|
||||||
|
cli/ # CLI Python separada para trocar de conta e consultar cota
|
||||||
|
docs/ # notas de design e guias do Proxyman
|
||||||
|
scripts/ # setup-dev, build-windows, generate-assets
|
||||||
|
```
|
||||||
|
|
||||||
|
### Scripts
|
||||||
|
|
||||||
|
| Comando | O que faz |
|
||||||
|
|---|---|
|
||||||
|
| `pnpm start` | Roda o app em modo dev (`electron-forge start`, com `DEBUG=electron-forge:*`). |
|
||||||
|
| `pnpm run dev` | O mesmo que `start`. |
|
||||||
|
| `pnpm run package` | Empacota o app com o Electron Forge, sem gerar instaladores. |
|
||||||
|
| `pnpm run make` | Gera instaladores/pacotes para a plataforma atual. |
|
||||||
|
| `pnpm run make:win` | Helper de build no Windows: extrai o WiX de `wix314-binaries.zip`, coloca no `PATH` e roda `electron-forge make`. |
|
||||||
|
| `pnpm run publish` | Publica pelo Electron Forge. |
|
||||||
|
| `pnpm run setup` | Roda `scripts/setup-dev.js`: detecta a toolchain nativa e instala ou orienta a configuração. |
|
||||||
|
| `pnpm run postinstall` | `scripts/setup-dev.js --check-only`; roda sozinho depois do `pnpm install`. |
|
||||||
|
| `pnpm run lint` | ESLint no repositório. |
|
||||||
|
| `pnpm run format` | Checagem do Prettier. |
|
||||||
|
| `pnpm run format:write` | Prettier com escrita. |
|
||||||
|
| `pnpm test` | Testes unitários Vitest (`vitest run`). |
|
||||||
|
| `pnpm run test:watch` | Vitest em modo watch. |
|
||||||
|
| `pnpm run test:unit` | Vitest (modo padrão). |
|
||||||
|
| `pnpm run test:e2e` | Testes E2E com Playwright. |
|
||||||
|
| `pnpm run test:all` | Testes unitários e depois Playwright. |
|
||||||
|
| `pnpm run type-check` | `tsc --noEmit`. |
|
||||||
|
|
||||||
|
## ❓ FAQ
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>O Windows mostra "O Windows protegeu o seu computador". É normal?</b></summary>
|
||||||
|
|
||||||
|
Sim. Os builds não são assinados. Clique em **Mais informações → Executar mesmo assim**.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>Minha IDE não alcança o proxy.</b></summary>
|
||||||
|
|
||||||
|
O proxy vem desligado: ative-o na página Proxy. A porta padrão é `8045` (`8046` em builds de desenvolvimento) e pode ser trocada ali. Copie a API key da mesma página e confira se há pelo menos uma conta no pool.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>Preciso de uma API key?</b></summary>
|
||||||
|
|
||||||
|
Com `api_key` vazia o proxy roda em modo aberto. Quando ativado ele escuta em `0.0.0.0`, então defina uma chave e mantenha-a privada.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>Dá para usar modelos Claude?</b></summary>
|
||||||
|
|
||||||
|
Sim, por mapeamento de modelos nas contas Google do pool, não por contas Claude separadas.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>Onde ficam meus tokens?</b></summary>
|
||||||
|
|
||||||
|
Num `cloud_accounts.db` separado, com `token_json` e `quota_json` criptografados em AES-256-GCM. A chave mestra fica no cofre de credenciais do sistema via `keytar`. Detalhes em [Modelo de segurança](#modelo-de-segurança).
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>Posso usar comercialmente?</b></summary>
|
||||||
|
|
||||||
|
Veja a [Licença](#-licença) antes: o código herdado do AntigravityManager é CC BY-NC-SA 4.0 (não comercial) e o código novo é MIT.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## Limitações e próximos passos
|
||||||
|
|
||||||
|
- O acesso upstream passa pelos endpoints `v1internal` do Cloud Code do Google e por escopos OAuth ([`src/services/GoogleAPIService.ts`](src/services/GoogleAPIService.ts)). São APIs internas, sem documentação, que podem mudar sem aviso. O projeto é não oficial e não tem vínculo com o Google nem com a Anthropic.
|
||||||
|
- As contas entram via Google OAuth; os modelos Claude são acessados por mapeamento de modelos, não por contas Claude separadas.
|
||||||
|
- Os testes end-to-end não rodam no CI (o Electron precisa de ambiente gráfico); rode `pnpm run test:e2e` localmente.
|
||||||
|
- O MSI do Windows só é gerado quando o WiX Toolset está disponível na máquina de build; caso contrário o artefato do Windows é o ZIP.
|
||||||
|
- Os workflows em `.github/workflows/` foram escritos para o GitHub (chamam o CLI `gh` e o publisher de releases do GitHub), por isso este README não mostra badge de CI.
|
||||||
|
- Próximo passo declarado pelo projeto: migrar o código original restante para MIT (veja a [Licença](#-licença)).
|
||||||
|
|
||||||
|
## 🤝 Contribuindo
|
||||||
|
|
||||||
|
Leia o [`CONTRIBUTING.md`](CONTRIBUTING.md) e o [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md). As versões são geradas pelo semantic-release a partir de Conventional Commits. Antes de abrir um PR, isto precisa passar:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pnpm run lint && pnpm run format:write && pnpm run type-check && pnpm test
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📄 Licença
|
||||||
|
|
||||||
|
Licença mista: o código herdado do [AntigravityManager](https://github.com/Draculabo/AntigravityManager) (de Draculabo) é [CC BY-NC-SA 4.0](LICENSE) (não comercial, compartilhamento pela mesma licença); todo o código novo é [MIT](LICENSE-MIT). O projeto está migrando para MIT à medida que o código original restante é reescrito, então confira os dois arquivos antes de qualquer uso comercial.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|
<img src="docs/assets/logo.png" width="56" alt="Logo do Gemini Nexus">
|
||||||
|
|
||||||
|
<p><strong><a href="https://git.evandro.dev.br/evandro/gemini-nexus">Gemini Nexus no Gitea</a></strong> · <a href="https://git.evandro.dev.br/evandro/gemini-nexus/issues">Reportar um problema</a> · <a href="#-início-rápido">Início rápido</a></p>
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -1,349 +1,262 @@
|
|||||||
<p align="center">
|
<div align="center">
|
||||||
<img src="docs/assets/logo.png" alt="Antigravity Manager" width="128" height="128" />
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h1 align="center">Antigravity Manager</h1>
|
<img src="assets/readme/hero.zh-CN.png" width="100%" alt="Gemini Nexus:桌面网关,把多个 Google 账号汇成号池,在 http://localhost:8045/v1 提供兼容 OpenAI 与 Anthropic 的本地 API,配额不足时自动切换账号">
|
||||||
|
|
||||||
<p align="center">
|

|
||||||
<strong>🚀 专业的 Google Gemini & Claude AI 多账号管理器</strong>
|

|
||||||
</p>
|

|
||||||
|
|
||||||
<p align="center">
|
<p><strong><a href="#-快速开始">快速开始</a></strong> · <a href="#-文档与开发">文档</a> · <a href="https://git.evandro.dev.br/evandro/gemini-nexus/issues">Issues</a></p>
|
||||||
<a href="README.md">English</a> | 简体中文
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
<sub><a href="README.md">English</a> · <a href="README.pt-BR.md">Português</a> · 中文 · <a href="README.es.md">Español</a></sub>
|
||||||
<a href="https://github.com/Draculabo/AntigravityManager/actions/workflows/testing.yaml">
|
|
||||||
<img src="https://github.com/Draculabo/AntigravityManager/actions/workflows/testing.yaml/badge.svg" alt="Tests" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/Draculabo/AntigravityManager/actions/workflows/lint.yaml">
|
|
||||||
<img src="https://github.com/Draculabo/AntigravityManager/actions/workflows/lint.yaml/badge.svg" alt="Lint" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/Draculabo/AntigravityManager/releases">
|
|
||||||
<img src="https://img.shields.io/github/v/release/Draculabo/AntigravityManager?style=flat-square" alt="Release" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/Draculabo/AntigravityManager/releases">
|
|
||||||
<img src="https://img.shields.io/github/downloads/Draculabo/AntigravityManager/total?style=flat-square&color=blue" alt="Downloads" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/Draculabo/AntigravityManager/blob/main/LICENSE">
|
|
||||||
<img src="https://img.shields.io/github/license/Draculabo/AntigravityManager?style=flat-square" alt="License" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/Draculabo/AntigravityManager/stargazers">
|
|
||||||
<img src="https://img.shields.io/github/stars/Draculabo/AntigravityManager?style=flat-square" alt="Stars" />
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
</div>
|
||||||
<img src="https://img.shields.io/badge/Electron-191970?style=for-the-badge&logo=Electron&logoColor=white" alt="Electron" />
|
|
||||||
<img src="https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB" alt="React" />
|
|
||||||
<img src="https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript" />
|
|
||||||
<img src="https://img.shields.io/badge/Tailwind_CSS-38B2AC?style=for-the-badge&logo=tailwind-css&logoColor=white" alt="TailwindCSS" />
|
|
||||||
</p>
|
|
||||||
|
|
||||||
---
|
## 📸 截图
|
||||||
|
|
||||||
## 📖 目录
|
<p align="center"><img src="docs/assets/main.png" width="100%" alt="Accounts 页面:号池中的一个 Google 账号,带按模型显示的配额条、Auto-Switch 开关和全局配额计数"></p>
|
||||||
|
|
||||||
- [为什么选择 Antigravity Manager?](#-为什么选择-antigravity-manager)
|
<details>
|
||||||
- [功能特性](#-功能特性)
|
<summary>更多截图:用量、代理、路由、文档、连接、设置</summary>
|
||||||
- [截图预览](#-截图预览)
|
|
||||||
- [快速开始](#-快速开始)
|
|
||||||
- [技术栈](#️-技术栈)
|
|
||||||
- [开发指南](#-开发指南)
|
|
||||||
- [常见问题](#-常见问题)
|
|
||||||
- [贡献指南](#-贡献指南)
|
|
||||||
- [许可证](#-许可证)
|
|
||||||
|
|
||||||
---
|
<p align="center"><img src="docs/assets/2usage.png" alt="用量分析" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/3proxy.png" alt="代理监控" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/4routing.png" alt="路由配置" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/5docs.png" alt="文档" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/6connections.png" alt="活动连接" width="80%"></p>
|
||||||
|
<p align="center"><img src="docs/assets/7config.png" alt="设置" width="80%"></p>
|
||||||
|
|
||||||
## ✨ 为什么选择 Antigravity Manager?
|
</details>
|
||||||
|
|
||||||
在使用 Antigravity IDE 时,你是否遇到过这些问题?
|
|
||||||
|
|
||||||
- 😫 单个账号额度很快用完,需要频繁手动切换
|
|
||||||
- 🔄 管理多个 Google/Claude 账号非常麻烦
|
|
||||||
- 📊 不知道当前账号还剩多少额度
|
|
||||||
- ⏰ 担心错过额度重置时间
|
|
||||||
- 🔌 需要可靠的本地 API 代理用于开发工具
|
|
||||||
|
|
||||||
**Antigravity Manager** 就是为解决这些问题而生的!它是一个专业的 Electron 桌面应用,帮助你:
|
|
||||||
|
|
||||||
- ✅ **无限账号池** - 添加任意数量的 Google Gemini / Claude 账号
|
|
||||||
- ✅ **智能自动切换** - 额度不足或被限速时自动切换到下一个可用账号
|
|
||||||
- ✅ **实时监控** - 可视化显示所有账号的额度使用情况
|
|
||||||
- ✅ **本地 API 代理** - 内置兼容 OpenAI/Anthropic 协议的代理服务器
|
|
||||||
- ✅ **安全加密** - AES-256-GCM 加密存储敏感信息
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🎯 功能特性
|
## 🎯 功能特性
|
||||||
|
|
||||||
|
只用一个 Google 账号配合 AI IDE,意味着配额很快耗尽、要手动切换账号,也看不到代理到底向上游发送了什么。Gemini Nexus 把所有账号放进一个号池,通过一个本地端点统一提供服务。
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="50%">
|
<td width="50%" valign="top"><b>一个本地端点</b><br><code>POST /v1/chat/completions</code>(OpenAI)、<code>POST /v1/messages</code>(Anthropic)、<code>GET /v1/models</code> 和 <code>GET /v1/models/capabilities</code>,Cursor、Windsurf、OpenCode、Claude Code 等客户端都能接入。模型名通过 <code>custom_mapping</code> 和 <code>anthropic_mapping</code> 映射。</td>
|
||||||
<h3>☁️ 云账号池管理</h3>
|
<td width="50%" valign="top"><b>账号池</b><br>通过 OAuth 添加 Google 账号,每个账号显示状态(Active、Rate Limited、Expired)、最近使用时间,并可单独设置代理 URL。</td>
|
||||||
<ul>
|
</tr>
|
||||||
<li>通过 OAuth 添加无限 Google Gemini / Claude 账号</li>
|
<tr>
|
||||||
<li>显示头像、邮箱、状态和最后使用时间</li>
|
<td width="50%" valign="top"><b>自动切换</b><br><code>CloudMonitorService</code> 每 5 分钟查询一次配额,当配额低于 5 % 或账号被限流时,<code>AutoSwitchService</code> 切换到其他账号。</td>
|
||||||
<li>实时状态监控(活跃、限速、过期)</li>
|
<td width="50%" valign="top"><b>带熔断器的调度</b><br><code>cache-first</code>、<code>balance</code>(默认)或 <code>performance-first</code>,每个账号都有熔断器(默认退避 60 s → 5 min → 30 min → 2 h)。</td>
|
||||||
</ul>
|
</tr>
|
||||||
</td>
|
<tr>
|
||||||
<td width="50%">
|
<td width="50%" valign="top"><b>用量与成本</b><br>按账号和模型统计 token 用量,提供 prompt 与 completion 图表,并根据可编辑的模型单价估算成本。</td>
|
||||||
<h3>📊 实时额度监控</h3>
|
<td width="50%" valign="top"><b>流量检查器</b><br>每个请求的延迟、状态和模型,可重放已记录的请求,生成 cURL 和 Python 代码片段,并提供 IDE 快速配置(Quick Setup)。</td>
|
||||||
<ul>
|
</tr>
|
||||||
<li>多模型支持:gemini-pro、claude-3-5-sonnet 等</li>
|
|
||||||
<li>可视化进度条配色指示器</li>
|
|
||||||
<li>自动刷新与手动刷新</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="50%">
|
|
||||||
<h3>🔄 智能自动切换</h3>
|
|
||||||
<ul>
|
|
||||||
<li>无限池模式,智能选择备用账号</li>
|
|
||||||
<li>额度低于 5% 或被限速时自动切换</li>
|
|
||||||
<li>后台每 5 分钟自动监控</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
<td width="50%">
|
|
||||||
<h3>🔐 安全优先</h3>
|
|
||||||
<ul>
|
|
||||||
<li>AES-256-GCM 加密敏感数据</li>
|
|
||||||
<li>集成操作系统原生凭证管理器</li>
|
|
||||||
<li>自动迁移旧版明文数据</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="50%">
|
|
||||||
<h3>💾 账号备份</h3>
|
|
||||||
<ul>
|
|
||||||
<li>捕获账号状态快照</li>
|
|
||||||
<li>在已保存的账号间快速切换</li>
|
|
||||||
<li>查看、整理和删除快照</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
<td width="50%">
|
|
||||||
<h3>⚙️ 进程控制</h3>
|
|
||||||
<ul>
|
|
||||||
<li>自动检测 Antigravity 是否运行</li>
|
|
||||||
<li>通过 URI 协议或可执行文件启动</li>
|
|
||||||
<li>优雅关闭或强制终止</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="50%">
|
|
||||||
<h3>🔌 本地 API 代理</h3>
|
|
||||||
<ul>
|
|
||||||
<li>兼容 OpenAI & Anthropic API 协议</li>
|
|
||||||
<li>可配置端口和请求超时</li>
|
|
||||||
<li>模型映射(如:Claude → Gemini)</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
<td width="50%">
|
|
||||||
<h3>🛠️ 开发者工具</h3>
|
|
||||||
<ul>
|
|
||||||
<li>内置 cURL & Python 代码生成</li>
|
|
||||||
<li>可视化服务状态监控</li>
|
|
||||||
<li>一键重新生成 API Key</li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
### 更多功能
|
已保存的凭据使用 AES-256-GCM 加密,主密钥存放在系统钥匙串中(见[安全模型](#安全模型))。
|
||||||
|
|
||||||
- **🖥️ 系统托盘** - 后台运行,托盘图标和右键菜单
|
## 工作原理
|
||||||
- **🔗 IDE 同步** - 自动扫描导入 IDE 的 `state.vscdb` 账号
|
|
||||||
- **📦 批量操作** - 批量刷新和删除多个账号
|
|
||||||
- **🌏 国际化** - 多语言支持(English / 中文)
|
|
||||||
- **🎨 现代 UI** - 基于 React、TailwindCSS 和 Shadcn UI 构建
|
|
||||||
|
|
||||||
---
|
1. **添加账号。** 在 Accounts 页面通过 Google OAuth 登录。token 在写入 SQLite 之前就已加密。
|
||||||
|
2. **让 IDE 指向代理。** 在 Proxy 页面启用代理(默认关闭),使用 `http://localhost:8045/v1` 和页面上显示的 API key,OpenAI 或 Anthropic 格式均可。
|
||||||
|
3. **Nexus 路由每个请求。** token manager 根据调度模式和熔断器状态选择账号,用该账号的 OAuth token 调用 Google 上游 API;当配额低于 5 % 或账号被限流时,自动切换生效。
|
||||||
|
|
||||||
## 📸 截图预览
|
包含各组件的完整流程见[架构](#架构)。
|
||||||
|
|
||||||
<p align="center">
|
## ⚡ 快速开始
|
||||||
<img src="docs/assets/screenshot-main.png" alt="主界面" width="80%" />
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
目前 [Gitea Releases](https://git.evandro.dev.br/evandro/gemini-nexus/releases) 页面还没有预编译下载(`.github/workflows/` 中的发布工作流面向 GitHub),因此请从源码构建。
|
||||||
<img src="docs/assets/screenshot-proxy.png" alt="代理界面" width="48%" />
|
|
||||||
<img src="docs/assets/screenshot-setting.png" alt="设置界面" width="48%" />
|
|
||||||
</p>
|
|
||||||
|
|
||||||
---
|
| 工具 | 最低版本 |
|
||||||
|
|---|---|
|
||||||
## 🚀 快速开始
|
| Node.js | 20+(`AGENTS.md` 中推荐;`.nvmrc` 固定为 22.17.1) |
|
||||||
|
| pnpm | 10.11.0(`packageManager`;锁文件为 `pnpm-lock.yaml`) |
|
||||||
### 下载安装
|
| 原生工具链 | `better-sqlite3` 和 `keytar` 需要:Windows 上的 Visual Studio 2022 Build Tools(C++)、macOS 上的 Xcode Command Line Tools、Ubuntu 上的 `build-essential` + `python3` + `libsecret-1-dev`(Arch 上为 `base-devel` + `python` + `libsecret`) |
|
||||||
|
|
||||||
从 [Releases](https://github.com/Draculabo/AntigravityManager/releases) 页面下载适合你平台的最新版本。
|
|
||||||
|
|
||||||
| 平台 | 下载链接 |
|
|
||||||
| ------------------- | ------------------------------------------------------------------------------ |
|
|
||||||
| Windows (x64/ARM64) | [.exe 安装包](https://github.com/Draculabo/AntigravityManager/releases/latest) |
|
|
||||||
| macOS | [.dmg 安装包](https://github.com/Draculabo/AntigravityManager/releases/latest) |
|
|
||||||
| Linux | [.deb / .rpm](https://github.com/Draculabo/AntigravityManager/releases/latest) |
|
|
||||||
|
|
||||||
### 从源码构建
|
|
||||||
|
|
||||||
#### 前置要求
|
|
||||||
|
|
||||||
- Node.js v18 或更高版本
|
|
||||||
- npm 或 yarn
|
|
||||||
|
|
||||||
#### 步骤
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 克隆仓库
|
git clone https://git.evandro.dev.br/evandro/gemini-nexus.git
|
||||||
git clone https://github.com/Draculabo/AntigravityManager.git
|
cd gemini-nexus
|
||||||
cd AntigravityManager
|
pnpm install # postinstall 会运行 scripts/setup-dev.js --check-only 检查工具链
|
||||||
|
pnpm start # 开发模式(Electron + Vite HMR)
|
||||||
# 安装依赖
|
pnpm run make # 为当前平台生成安装包/软件包
|
||||||
npm install
|
pnpm run make:win # Windows:从 wix314-binaries.zip 解压 WiX,然后运行 make
|
||||||
|
|
||||||
# 启动开发模式
|
|
||||||
npm start
|
|
||||||
|
|
||||||
# 构建生产版本
|
|
||||||
npm run make
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
然后至少添加一个账号,启用代理(默认关闭),并把 IDE 指向它:
|
||||||
|
|
||||||
|
```text
|
||||||
|
API Base URL: http://localhost:8045/v1 (默认值,可在 Proxy 页面修改;开发构建使用 8046)
|
||||||
|
API Key: (从应用的 Proxy 页面复制)
|
||||||
|
Model: gemini-3-flash (或任意已映射的模型)
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> 构建产物没有代码签名。如果 Windows 提示“Windows 已保护你的电脑”,请点击 **更多信息 → 仍要运行**。
|
||||||
|
|
||||||
|
项目没有 `.env.example`,也没有必填变量。代码读取或文档中提到的可选变量:
|
||||||
|
|
||||||
|
| 变量 | 必填 | 说明 |
|
||||||
|
|---|---|---|
|
||||||
|
| `HTTP_PROXY` / `HTTPS_PROXY` / `NO_PROXY` | 否 | 让应用的出站请求经过本地代理(TLS 检查见[安全模型](#安全模型))。 |
|
||||||
|
| `NODE_EXTRA_CA_CERTS` | 否 | 检查流量时,Node 侧 TLS 使用的额外 CA 证书。 |
|
||||||
|
| `SENTRY_DSN` | 否 | 启用错误上报时使用的 Sentry DSN。 |
|
||||||
|
|
||||||
## 🛠️ 技术栈
|
## 🛠️ 技术栈
|
||||||
|
|
||||||
| 类别 | 技术 |
|
| 层 | 技术 |
|
||||||
| ------------ | ------------------------------------------------------------------------------------------------------------------- |
|
|---|---|
|
||||||
| **核心** | [Electron](https://www.electronjs.org/)、[React](https://react.dev/)、[TypeScript](https://www.typescriptlang.org/) |
|
| 桌面外壳 | Electron 41、Electron Forge、Vite |
|
||||||
| **构建工具** | [Vite](https://vitejs.dev/) |
|
| 界面 | React 19、TypeScript、Tailwind CSS 4、Radix UI、Nivo 图表、i18next |
|
||||||
| **样式** | [TailwindCSS](https://tailwindcss.com/)、[Shadcn UI](https://ui.shadcn.com/) |
|
| 应用数据流 | TanStack Router 与 Query,基于 Electron IPC 的 oRPC |
|
||||||
| **状态管理** | [TanStack Query](https://tanstack.com/query/latest)、[TanStack Router](https://tanstack.com/router/latest) |
|
| 代理 | NestJS 11 + Fastify |
|
||||||
| **数据库** | [Better-SQLite3](https://github.com/WiseLibs/better-sqlite3) |
|
| 存储 | SQLite(better-sqlite3 + Drizzle ORM),通过 `keytar` 使用系统钥匙串 |
|
||||||
| **测试** | [Vitest](https://vitest.dev/)、[Playwright](https://playwright.dev/) |
|
| 日志与错误 | Winston(滚动日志文件)、Sentry(可选) |
|
||||||
|
| 测试 | Vitest、Playwright |
|
||||||
|
|
||||||
---
|
## 架构
|
||||||
|
|
||||||
## 💻 开发指南
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
### 可用脚本
|
C["客户端:Cursor、Windsurf、OpenCode、Claude Code"] -->|"/v1/chat/completions, /v1/messages"| P["NestJS 代理,端口 8045"]
|
||||||
|
P --> S["账号调度器与熔断器"]
|
||||||
| 命令 | 描述 |
|
S -->|"Google OAuth 账号"| G["Google 上游 API"]
|
||||||
| ---------------------- | ------------------------ |
|
M["CloudMonitor 与 AutoSwitch,每 5 分钟查询配额"] -->|"配额轮询"| G
|
||||||
| `npm start` | 启动开发模式 |
|
S -->|"读取账号"| DB[("SQLite:better-sqlite3 与 Drizzle")]
|
||||||
| `npm run lint` | 运行 ESLint 检查 |
|
M --> DB
|
||||||
| `npm run format:write` | 使用 Prettier 格式化代码 |
|
K["AES-256-GCM,主密钥在系统钥匙串"] -->|"加密 token"| DB
|
||||||
| `npm run test:unit` | 运行单元测试 |
|
|
||||||
| `npm run test:e2e` | 运行 E2E 测试 |
|
|
||||||
| `npm run test:all` | 运行所有测试 |
|
|
||||||
| `npm run type-check` | TypeScript 类型检查 |
|
|
||||||
| `npm run make` | 构建生产包 |
|
|
||||||
|
|
||||||
### 项目结构
|
|
||||||
|
|
||||||
```
|
|
||||||
AntigravityManager/
|
|
||||||
├── src/
|
|
||||||
│ ├── main.ts # Electron 主进程
|
|
||||||
│ ├── preload.ts # 预加载脚本
|
|
||||||
│ ├── renderer/ # React 渲染进程
|
|
||||||
│ ├── ipc/ # IPC 通信处理
|
|
||||||
│ └── server/ # 内置服务器
|
|
||||||
├── docs/ # 文档和资源
|
|
||||||
└── .github/ # GitHub 配置
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
1. 客户端向 NestJS 代理(Fastify,绑定 `0.0.0.0`)发送 OpenAI 或 Anthropic 格式的请求。
|
||||||
|
2. 配置了 API key 时,代理守卫会校验它;key 为空时代理以开放模式运行。
|
||||||
|
3. token manager 根据调度模式和各账号的熔断器状态选择账号,再用该账号的 OAuth token 调用 Google 上游 API。
|
||||||
|
4. `CloudMonitorService` 每 5 分钟查询一次配额,当配额低于 5 % 或账号被限流时,`AutoSwitchService` 切换当前账号。
|
||||||
|
5. React 19 渲染进程(TanStack Router 与 Query)通过 IPC 上的 oRPC 与主进程通信;账号、用量和设置保存在 SQLite(better-sqlite3 + Drizzle)中。设计说明:[`docs/cloud_features.md`](docs/cloud_features.md)。
|
||||||
|
|
||||||
|
## 安全模型
|
||||||
|
|
||||||
|
Gemini Nexus 保存多个账号的 OAuth token 并向上游转发流量,因此凭据处理是设计的核心。以下内容均已在本仓库中实现;存在限制的地方都已注明。
|
||||||
|
|
||||||
|
- **凭据存储与隔离。** `token_json` 和 `quota_json` 在写入 SQLite 之前使用 AES-256-GCM 加密(每次操作使用唯一 IV,带认证)。主密钥通过 `keytar` 存放在系统凭据存储中(Windows 凭据管理器、macOS 钥匙串、Linux Secret Service/libsecret),绝不写入普通文件。旧的明文记录会在启动时迁移。账号保存在独立的数据库(`cloud_accounts.db`)中,与 IDE 的本地数据库分开。
|
||||||
|
- **日志脱敏。** `token`、`refresh_token`、`api_key`、`authorization`、`cookie`、`client_secret` 等键在写入日志前会被替换为 `[REDACTED]`([`src/utils/sensitiveDataMasking.ts`](src/utils/sensitiveDataMasking.ts));流量日志还会隐去 `authorization`、`x-api-key` 和 `cookie` 请求头。
|
||||||
|
- **请求日志,而非审计追踪。** Winston 把 API、流量和应用日志写入滚动文件(API 日志:保留 30 天,每个文件 50 MB)。这些是运维日志,不是防篡改的审计追踪;`*-audit.json` 文件是 `winston-daily-rotate-file` 的轮转记录。
|
||||||
|
- **代理访问。** 代理默认关闭。启用后监听 `0.0.0.0`,只有在 `api_key` 非空时才会校验请求(为空即开放模式)。请设置 key 并妥善保管。
|
||||||
|
- **TLS 检查(仅用于调试)。** [`docs/proxyman-install.md`](docs/proxyman-install.md) 和 [`docs/proxyman-debugging.md`](docs/proxyman-debugging.md) 说明如何用 Proxyman 查看应用的 HTTPS 流量:信任其根 CA,设置代理变量和 `NODE_EXTRA_CA_CERTS`,然后启动应用。`NODE_TLS_REJECT_UNAUTHORIZED=0`(以及脚本的 `-AllowInsecureTls` 参数)只是临时覆盖,切勿一直开启。不要提交代理地址、证书路径、cookie 或 OAuth code,分享日志前请先脱敏。`scripts/start-antigravity-with-proxyman.ps1` 针对的是已安装的官方 Antigravity 客户端,而不是本应用。
|
||||||
|
- **错误上报。** Sentry 上报(需要 `SENTRY_DSN`)受 `error_reporting_enabled` 设置控制,`DEFAULT_APP_CONFIG` 中默认为 `true`;可在 Settings 中关闭。上报的异常消息中会屏蔽 Windows 用户名部分。
|
||||||
|
|
||||||
|
支持的版本以及如何报告漏洞:[`SECURITY.md`](SECURITY.md)。
|
||||||
|
|
||||||
|
## 💻 文档与开发
|
||||||
|
|
||||||
|
- [`docs/cloud_features.md`](docs/cloud_features.md):账号池、配额监控与自动切换的设计。
|
||||||
|
- [`docs/proxyman-install.md`](docs/proxyman-install.md) 和 [`docs/proxyman-debugging.md`](docs/proxyman-debugging.md):TLS 检查配置(Windows)。
|
||||||
|
- [`docs/OpencodeAPI.md`](docs/OpencodeAPI.md):OpenCode 自定义端点集成(葡萄牙语)。
|
||||||
|
- [`cli/README.md`](cli/README.md):Python 命令行工具。
|
||||||
|
- [`CONTRIBUTING.md`](CONTRIBUTING.md)、[`SECURITY.md`](SECURITY.md)、[`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md)、[`CHANGELOG.md`](CHANGELOG.md)、[`LICENSE`](LICENSE)、[`LICENSE-MIT`](LICENSE-MIT)。
|
||||||
|
- 其他语言:[English](README.md)、[Português](README.pt-BR.md)、[Español](README.es.md)。
|
||||||
|
|
||||||
|
### 目录结构
|
||||||
|
|
||||||
|
```text
|
||||||
|
src/
|
||||||
|
├── components/ # UI(proxy/、usage/、ui/ 基础组件)
|
||||||
|
├── ipc/ # oRPC 路由(account、cloud、config、gateway、usage...)
|
||||||
|
├── server/ # NestJS 代理网关(模块:proxy、usage)
|
||||||
|
├── services/ # AutoSwitchService、CloudMonitorService、GoogleAPIService
|
||||||
|
├── routes/ # index、usage、proxy、settings
|
||||||
|
├── utils/ # paths、logger、sensitiveDataMasking
|
||||||
|
└── tests/ # 单元测试(Vitest)与 E2E(Playwright)
|
||||||
|
cli/ # 独立的 Python CLI,用于切换账号和查询配额
|
||||||
|
docs/ # 设计说明与 Proxyman 指南
|
||||||
|
scripts/ # setup-dev、build-windows、generate-assets
|
||||||
|
```
|
||||||
|
|
||||||
|
### 脚本
|
||||||
|
|
||||||
|
| 命令 | 作用 |
|
||||||
|
|---|---|
|
||||||
|
| `pnpm start` | 以开发模式运行应用(`electron-forge start`,带 `DEBUG=electron-forge:*`)。 |
|
||||||
|
| `pnpm run dev` | 与 `start` 相同。 |
|
||||||
|
| `pnpm run package` | 用 Electron Forge 打包应用,不生成安装包。 |
|
||||||
|
| `pnpm run make` | 为当前平台生成安装包/软件包。 |
|
||||||
|
| `pnpm run make:win` | Windows 构建辅助:从 `wix314-binaries.zip` 解压 WiX,加入 `PATH`,运行 `electron-forge make`。 |
|
||||||
|
| `pnpm run publish` | 通过 Electron Forge 发布。 |
|
||||||
|
| `pnpm run setup` | 运行 `scripts/setup-dev.js`:检测原生工具链并安装或引导配置。 |
|
||||||
|
| `pnpm run postinstall` | `scripts/setup-dev.js --check-only`;在 `pnpm install` 后自动运行。 |
|
||||||
|
| `pnpm run lint` | 对仓库运行 ESLint。 |
|
||||||
|
| `pnpm run format` | Prettier 检查。 |
|
||||||
|
| `pnpm run format:write` | Prettier 写入格式化。 |
|
||||||
|
| `pnpm test` | Vitest 单元测试(`vitest run`)。 |
|
||||||
|
| `pnpm run test:watch` | Vitest 监听模式。 |
|
||||||
|
| `pnpm run test:unit` | Vitest(默认模式)。 |
|
||||||
|
| `pnpm run test:e2e` | Playwright E2E 测试。 |
|
||||||
|
| `pnpm run test:all` | 先跑单元测试,再跑 Playwright。 |
|
||||||
|
| `pnpm run type-check` | `tsc --noEmit`。 |
|
||||||
|
|
||||||
## ❓ 常见问题
|
## ❓ 常见问题
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><b>Q: 程序无法启动怎么办?</b></summary>
|
<summary><b>Windows 提示“Windows 已保护你的电脑”,正常吗?</b></summary>
|
||||||
|
|
||||||
请检查:
|
正常。构建产物没有代码签名。请点击 **更多信息 → 仍要运行**。
|
||||||
|
|
||||||
1. 确保已安装所有依赖:`npm install`
|
|
||||||
2. 检查 Node.js 版本是否 >= 18
|
|
||||||
3. 尝试删除 `node_modules` 后重新安装
|
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><b>Q: 账号登录失败?</b></summary>
|
<summary><b>IDE 连不上代理。</b></summary>
|
||||||
|
|
||||||
1. 确保网络连接正常
|
代理默认关闭:请在 Proxy 页面启用。默认端口为 `8045`(开发构建为 `8046`),可在该页面修改。从同一页面复制 API key,并确认号池中至少有一个账号。
|
||||||
2. 尝试清除应用数据后重新登录
|
|
||||||
3. 检查账号是否被 Google/Claude 限制
|
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><b>Q: macOS 上提示 Keychain/凭据管理不可用,OAuth 无法保存?</b></summary>
|
<summary><b>需要 API key 吗?</b></summary>
|
||||||
|
|
||||||
这是 macOS 安全机制导致的常见问题,通常出现在未签名的应用或从 Downloads 直接运行的场景。
|
`api_key` 为空时代理以开放模式运行。启用后它监听 `0.0.0.0`,所以请设置 key 并妥善保管。
|
||||||
这是**临时方案**,仅适合个人设备:
|
|
||||||
|
|
||||||
1. 将应用移动到 `/Applications`
|
</details>
|
||||||
2. 打开终端执行以下命令(每次更新后都需要重新执行)
|
|
||||||
|
|
||||||
```plaintext
|
<details>
|
||||||
sudo xattr -dr com.apple.quarantine "/Applications/Antigravity Manager 2.app"
|
<summary><b>能使用 Claude 模型吗?</b></summary>
|
||||||
codesign --force --deep --sign - "/Applications/Antigravity Manager 2.app"
|
|
||||||
|
可以,通过号池中 Google 账号上的模型映射实现,而不是使用单独的 Claude 账号。
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>我的 token 存在哪里?</b></summary>
|
||||||
|
|
||||||
|
存放在独立的 `cloud_accounts.db` 中,`token_json` 和 `quota_json` 使用 AES-256-GCM 加密。主密钥通过 `keytar` 存放在系统凭据存储中。详见[安全模型](#安全模型)。
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>可以商用吗?</b></summary>
|
||||||
|
|
||||||
|
请先查看[许可证](#-许可证):继承自 AntigravityManager 的代码采用 CC BY-NC-SA 4.0(非商业),新代码采用 MIT。
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## 局限与后续计划
|
||||||
|
|
||||||
|
- 上游访问经由 Google 的 `v1internal` Cloud Code 端点和 OAuth scope([`src/services/GoogleAPIService.ts`](src/services/GoogleAPIService.ts))。这些是内部、未公开文档的 API,可能随时变更。本项目为非官方项目,与 Google 或 Anthropic 无关联。
|
||||||
|
- 账号通过 Google OAuth 添加;Claude 模型通过模型映射访问,而不是通过单独的 Claude 账号。
|
||||||
|
- 端到端测试不在 CI 中运行(Electron 需要图形环境);请在本地运行 `pnpm run test:e2e`。
|
||||||
|
- 只有构建机器上有 WiX Toolset 时才会生成 Windows MSI,否则 Windows 产物为 ZIP。
|
||||||
|
- `.github/workflows/` 中的工作流是为 GitHub 编写的(调用 `gh` CLI 和 GitHub 发布器),因此本 README 不显示 CI 徽章。
|
||||||
|
- 项目声明的下一步:把剩余的原始代码迁移到 MIT(见[许可证](#-许可证))。
|
||||||
|
|
||||||
|
## 🤝 参与贡献
|
||||||
|
|
||||||
|
请阅读 [`CONTRIBUTING.md`](CONTRIBUTING.md) 和 [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md)。版本由 semantic-release 根据 Conventional Commits 生成。提交 PR 之前,以下命令必须通过:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pnpm run lint && pnpm run format:write && pnpm run type-check && pnpm test
|
||||||
```
|
```
|
||||||
|
|
||||||
重新打开应用后,Keychain 应会提示授权(可选“始终允许”)。
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>Q: 如何反馈问题或建议?</b></summary>
|
|
||||||
|
|
||||||
请通过 [GitHub Issues](https://github.com/Draculabo/AntigravityManager/issues) 提交问题或建议。
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🌟 Star History
|
|
||||||
|
|
||||||
<a href="https://github.com/Draculabo/AntigravityManager/stargazers">
|
|
||||||
<picture>
|
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Draculabo/AntigravityManager&type=Date&theme=dark" />
|
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Draculabo/AntigravityManager&type=Date" />
|
|
||||||
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Draculabo/AntigravityManager&type=Date" />
|
|
||||||
</picture>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 🤝 贡献指南
|
|
||||||
|
|
||||||
欢迎贡献代码!请阅读 [CONTRIBUTING.md](CONTRIBUTING.md) 了解详情。
|
|
||||||
|
|
||||||
我们遵循 [Contributor Covenant](CODE_OF_CONDUCT.md) 行为准则。
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 📄 许可证
|
## 📄 许可证
|
||||||
|
|
||||||
[CC BY-NC-SA 4.0](LICENSE)
|
混合许可:继承自 [AntigravityManager](https://github.com/Draculabo/AntigravityManager)(作者 Draculabo)的代码采用 [CC BY-NC-SA 4.0](LICENSE)(非商业、相同方式共享);所有新代码采用 [MIT](LICENSE-MIT)。随着剩余原始代码被重写,项目正在迁移到 MIT,因此任何商业使用前请同时查看两个文件。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## ⚠️ 免责声明
|
<div align="center">
|
||||||
|
|
||||||
> [!WARNING]
|
<img src="docs/assets/logo.png" width="56" alt="Gemini Nexus 标志">
|
||||||
> **仅供学习研究使用**
|
|
||||||
>
|
|
||||||
> 本项目仅供教育和研究目的,按"原样"提供,不提供任何保证。**严禁商业使用。**
|
|
||||||
>
|
|
||||||
> 使用本软件即表示您同意不会将其用于任何商业目的,并自行负责确保您的使用符合所有适用法律法规。作者和贡献者对因使用本软件而产生的任何滥用或损害不承担责任。
|
|
||||||
|
|
||||||
---
|
<p><strong><a href="https://git.evandro.dev.br/evandro/gemini-nexus">Gitea 上的 Gemini Nexus</a></strong> · <a href="https://git.evandro.dev.br/evandro/gemini-nexus/issues">报告问题</a> · <a href="#-快速开始">快速开始</a></p>
|
||||||
|
|
||||||
<p align="center">
|
</div>
|
||||||
如果这个项目对你有帮助,请给一个 ⭐ Star 支持!
|
|
||||||
</p>
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## 🔒 Security Features
|
## 🔒 Security Features
|
||||||
|
|
||||||
Antigravity Manager takes security seriously. Here are the security measures we've implemented:
|
Gemini Nexus takes security seriously. Here are the security measures we've implemented:
|
||||||
|
|
||||||
### Encryption
|
### Encryption
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ We only provide security updates for the latest version. Please ensure you're ru
|
|||||||
|
|
||||||
## 🚨 Reporting a Vulnerability
|
## 🚨 Reporting a Vulnerability
|
||||||
|
|
||||||
We take all security vulnerabilities seriously. Thank you for helping to improve the security of Antigravity Manager.
|
We take all security vulnerabilities seriously. Thank you for helping to improve the security of Gemini Nexus.
|
||||||
|
|
||||||
### How to Report
|
### How to Report
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ Please include the following information in your report:
|
|||||||
|
|
||||||
To ensure the security of your data:
|
To ensure the security of your data:
|
||||||
|
|
||||||
1. **Keep Updated**: Always use the latest version of Antigravity Manager
|
1. **Keep Updated**: Always use the latest version of Gemini Nexus
|
||||||
2. **System Security**: Keep your operating system updated
|
2. **System Security**: Keep your operating system updated
|
||||||
3. **Secure Environment**: Use the application on trusted devices only
|
3. **Secure Environment**: Use the application on trusted devices only
|
||||||
4. **Backup**: Regularly backup your account data using the built-in backup feature
|
4. **Backup**: Regularly backup your account data using the built-in backup feature
|
||||||
@@ -90,4 +90,4 @@ When we receive a security bug report, we will:
|
|||||||
3. Prepare fixes for all supported versions
|
3. Prepare fixes for all supported versions
|
||||||
4. Release new versions as soon as possible
|
4. Release new versions as soon as possible
|
||||||
|
|
||||||
Thank you for helping keep Antigravity Manager and its users safe!
|
Thank you for helping keep Gemini Nexus and its users safe!
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
Hero raster layer (hero-subject.png), generated with generate_image (openai-codex/gpt-image-2), docs/assets/logo.png as shape reference.
|
||||||
|
Background removed with a magenta (#ff00ff) chroma key, then cropped and resized to 760 px.
|
||||||
|
Composition: hero.svg places the layer at x=700 y=40 (340x340); node centres 741,86 / 1000,86 / 870,334.
|
||||||
|
Final PNGs: rsvg-convert -w 2400 hero[.lang].svg -o hero[.lang].png
|
||||||
|
|
||||||
|
Subject: A single isolated 3D hardware object: a machined matte-black metal hub ring, seen slightly from above at a three-quarter angle. Three straight thin metal arms extend outward from the ring (upper-left, upper-right, and straight down), each ending in a small hollow ring node, like a network junction. Inside the main ring sits a softly glowing emerald-green (#10b981) core disc made of frosted glass. Thin emerald light lines run along each arm into the end nodes. Precise industrial product design, clean bevels, subtle brushed-metal texture, no text, no letters, no logo, no watermark.
|
||||||
|
Scene: Perfectly flat solid magenta #ff00ff background with no gradient, no texture, no floor, no reflection and no shadow. One isolated subject with generous padding on all sides.
|
||||||
|
Composition: Centered, the whole object fully inside the frame with at least 12% empty margin on every side, square framing.
|
||||||
|
Lighting: Cool studio key light from the upper left, dark low-key product lighting, emerald glow confined to the core and arm light lines; no magenta tones anywhere on the object.
|
||||||
|
Style: Photorealistic product render, dark minimal tech hardware, sharp edges suitable for chroma-key cutout.
|
||||||
|
Change: Use the logo only as the shape reference for the ring-with-three-node-arms silhouette; do not reproduce the G/N letters inside the ring, replace them with the glowing emerald core disc.
|
||||||
|
After Width: | Height: | Size: 349 KiB |
|
After Width: | Height: | Size: 454 KiB |
@@ -0,0 +1,66 @@
|
|||||||
|
<svg xml:lang="es" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
width="1200" height="420" viewBox="0 0 1200 420"
|
||||||
|
role="img" aria-labelledby="title desc">
|
||||||
|
<title id="title">Gemini Nexus</title>
|
||||||
|
<desc id="desc">Hero layout source: the Gemini Nexus hub (IDE, account pool and Google APIs on its three nodes) next to the project name, value line and the local endpoint. Render to hero.png; the raster hub is hero-subject.png.</desc>
|
||||||
|
|
||||||
|
<defs>
|
||||||
|
<radialGradient id="core-glow" cx="0.5" cy="0.5" r="0.5">
|
||||||
|
<stop offset="0" stop-color="#10b981" stop-opacity="0.32"/>
|
||||||
|
<stop offset="0.55" stop-color="#10b981" stop-opacity="0.08"/>
|
||||||
|
<stop offset="1" stop-color="#10b981" stop-opacity="0"/>
|
||||||
|
</radialGradient>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<rect width="1200" height="420" rx="24" fill="#0a0a0b"/>
|
||||||
|
<rect x="0.5" y="0.5" width="1199" height="419" rx="23.5" fill="none" stroke="#1f2023"/>
|
||||||
|
|
||||||
|
<g id="title-block" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', 'PingFang SC', 'Noto Sans CJK SC', sans-serif">
|
||||||
|
<text id="eyebrow" x="64" y="92" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="18" letter-spacing="3" fill="#10b981">GATEWAY DE IA LOCAL · ESCRITORIO</text>
|
||||||
|
<text id="name" x="60" y="174" font-size="80" font-weight="700" letter-spacing="-2" fill="#fafafa">Gemini Nexus</text>
|
||||||
|
<text id="value-1" x="64" y="226" font-size="27" fill="#b9bdc5">Agrupa tus cuentas de Google tras una</text>
|
||||||
|
<text id="value-2" x="64" y="262" font-size="27" fill="#b9bdc5">API compatible con OpenAI y Anthropic.</text>
|
||||||
|
|
||||||
|
<g id="endpoint" transform="translate(64 296)">
|
||||||
|
<rect width="344" height="48" rx="10" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<circle cx="24" cy="24" r="6" fill="#10b981"/>
|
||||||
|
<text x="42" y="31" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="20" fill="#e7e8ea">http://localhost:8045/v1</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<text id="meta" x="64" y="384" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="18" fill="#6c717a">Electron · NestJS proxy · AES-256-GCM</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="hub">
|
||||||
|
<circle cx="870" cy="172" r="210" fill="url(#core-glow)"/>
|
||||||
|
<!-- Raster layer: replace hero-subject.png to change the hub art; node centres are 741,86 / 1000,86 / 870,334 -->
|
||||||
|
<image id="subject" x="700" y="40" width="340" height="340" xlink:href="hero-subject.png" href="hero-subject.png" preserveAspectRatio="xMidYMid meet"/>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="node-labels" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="18">
|
||||||
|
<g id="label-ide">
|
||||||
|
<path d="M706 86 H676" stroke="#3a3d42" stroke-width="2"/>
|
||||||
|
<rect x="566" y="68" width="110" height="36" rx="18" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<text x="621" y="92" text-anchor="middle" fill="#d4d6da">tu IDE</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="label-pool">
|
||||||
|
<rect x="976" y="134" width="184" height="36" rx="18" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<text x="1068" y="158" text-anchor="middle" fill="#d4d6da">pool de cuentas</text>
|
||||||
|
<g id="quota-bars" transform="translate(1004 186)">
|
||||||
|
<rect width="140" height="8" rx="4" fill="#1d1f22"/>
|
||||||
|
<rect width="140" height="8" rx="4" fill="#10b981"/>
|
||||||
|
<rect y="22" width="140" height="8" rx="4" fill="#1d1f22"/>
|
||||||
|
<rect y="22" width="88" height="8" rx="4" fill="#10b981"/>
|
||||||
|
<rect y="44" width="140" height="8" rx="4" fill="#1d1f22"/>
|
||||||
|
<rect y="44" width="8" height="8" rx="4" fill="#f43f5e"/>
|
||||||
|
</g>
|
||||||
|
<text x="1004" y="264" fill="#6c717a">auto-switch</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="label-upstream">
|
||||||
|
<path d="M906 334 H932" stroke="#3a3d42" stroke-width="2"/>
|
||||||
|
<rect x="932" y="316" width="176" height="36" rx="18" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<text x="1020" y="340" text-anchor="middle" fill="#d4d6da">APIs de Google</text>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 452 KiB |
|
After Width: | Height: | Size: 457 KiB |
@@ -0,0 +1,66 @@
|
|||||||
|
<svg xml:lang="pt-BR" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
width="1200" height="420" viewBox="0 0 1200 420"
|
||||||
|
role="img" aria-labelledby="title desc">
|
||||||
|
<title id="title">Gemini Nexus</title>
|
||||||
|
<desc id="desc">Hero layout source: the Gemini Nexus hub (IDE, account pool and Google APIs on its three nodes) next to the project name, value line and the local endpoint. Render to hero.png; the raster hub is hero-subject.png.</desc>
|
||||||
|
|
||||||
|
<defs>
|
||||||
|
<radialGradient id="core-glow" cx="0.5" cy="0.5" r="0.5">
|
||||||
|
<stop offset="0" stop-color="#10b981" stop-opacity="0.32"/>
|
||||||
|
<stop offset="0.55" stop-color="#10b981" stop-opacity="0.08"/>
|
||||||
|
<stop offset="1" stop-color="#10b981" stop-opacity="0"/>
|
||||||
|
</radialGradient>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<rect width="1200" height="420" rx="24" fill="#0a0a0b"/>
|
||||||
|
<rect x="0.5" y="0.5" width="1199" height="419" rx="23.5" fill="none" stroke="#1f2023"/>
|
||||||
|
|
||||||
|
<g id="title-block" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', 'PingFang SC', 'Noto Sans CJK SC', sans-serif">
|
||||||
|
<text id="eyebrow" x="64" y="92" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="18" letter-spacing="3" fill="#10b981">GATEWAY LOCAL DE IA · APP DESKTOP</text>
|
||||||
|
<text id="name" x="60" y="174" font-size="80" font-weight="700" letter-spacing="-2" fill="#fafafa">Gemini Nexus</text>
|
||||||
|
<text id="value-1" x="64" y="226" font-size="27" fill="#b9bdc5">Reúna suas contas Google atrás de uma</text>
|
||||||
|
<text id="value-2" x="64" y="262" font-size="27" fill="#b9bdc5">API compatível com OpenAI e Anthropic.</text>
|
||||||
|
|
||||||
|
<g id="endpoint" transform="translate(64 296)">
|
||||||
|
<rect width="344" height="48" rx="10" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<circle cx="24" cy="24" r="6" fill="#10b981"/>
|
||||||
|
<text x="42" y="31" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="20" fill="#e7e8ea">http://localhost:8045/v1</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<text id="meta" x="64" y="384" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="18" fill="#6c717a">Electron · NestJS proxy · AES-256-GCM</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="hub">
|
||||||
|
<circle cx="870" cy="172" r="210" fill="url(#core-glow)"/>
|
||||||
|
<!-- Raster layer: replace hero-subject.png to change the hub art; node centres are 741,86 / 1000,86 / 870,334 -->
|
||||||
|
<image id="subject" x="700" y="40" width="340" height="340" xlink:href="hero-subject.png" href="hero-subject.png" preserveAspectRatio="xMidYMid meet"/>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="node-labels" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="18">
|
||||||
|
<g id="label-ide">
|
||||||
|
<path d="M706 86 H676" stroke="#3a3d42" stroke-width="2"/>
|
||||||
|
<rect x="566" y="68" width="110" height="36" rx="18" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<text x="621" y="92" text-anchor="middle" fill="#d4d6da">sua IDE</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="label-pool">
|
||||||
|
<rect x="976" y="134" width="184" height="36" rx="18" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<text x="1068" y="158" text-anchor="middle" fill="#d4d6da">pool de contas</text>
|
||||||
|
<g id="quota-bars" transform="translate(1004 186)">
|
||||||
|
<rect width="140" height="8" rx="4" fill="#1d1f22"/>
|
||||||
|
<rect width="140" height="8" rx="4" fill="#10b981"/>
|
||||||
|
<rect y="22" width="140" height="8" rx="4" fill="#1d1f22"/>
|
||||||
|
<rect y="22" width="88" height="8" rx="4" fill="#10b981"/>
|
||||||
|
<rect y="44" width="140" height="8" rx="4" fill="#1d1f22"/>
|
||||||
|
<rect y="44" width="8" height="8" rx="4" fill="#f43f5e"/>
|
||||||
|
</g>
|
||||||
|
<text x="1004" y="264" fill="#6c717a">auto-switch</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="label-upstream">
|
||||||
|
<path d="M906 334 H932" stroke="#3a3d42" stroke-width="2"/>
|
||||||
|
<rect x="932" y="316" width="176" height="36" rx="18" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<text x="1020" y="340" text-anchor="middle" fill="#d4d6da">APIs do Google</text>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.9 KiB |
@@ -0,0 +1,66 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
width="1200" height="420" viewBox="0 0 1200 420"
|
||||||
|
role="img" aria-labelledby="title desc">
|
||||||
|
<title id="title">Gemini Nexus</title>
|
||||||
|
<desc id="desc">Hero layout source: the Gemini Nexus hub (IDE, account pool and Google APIs on its three nodes) next to the project name, value line and the local endpoint. Render to hero.png; the raster hub is hero-subject.png.</desc>
|
||||||
|
|
||||||
|
<defs>
|
||||||
|
<radialGradient id="core-glow" cx="0.5" cy="0.5" r="0.5">
|
||||||
|
<stop offset="0" stop-color="#10b981" stop-opacity="0.32"/>
|
||||||
|
<stop offset="0.55" stop-color="#10b981" stop-opacity="0.08"/>
|
||||||
|
<stop offset="1" stop-color="#10b981" stop-opacity="0"/>
|
||||||
|
</radialGradient>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<rect width="1200" height="420" rx="24" fill="#0a0a0b"/>
|
||||||
|
<rect x="0.5" y="0.5" width="1199" height="419" rx="23.5" fill="none" stroke="#1f2023"/>
|
||||||
|
|
||||||
|
<g id="title-block" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', 'PingFang SC', 'Noto Sans CJK SC', sans-serif">
|
||||||
|
<text id="eyebrow" x="64" y="92" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="18" letter-spacing="3" fill="#10b981">LOCAL AI GATEWAY · DESKTOP APP</text>
|
||||||
|
<text id="name" x="60" y="174" font-size="80" font-weight="700" letter-spacing="-2" fill="#fafafa">Gemini Nexus</text>
|
||||||
|
<text id="value-1" x="64" y="226" font-size="27" fill="#b9bdc5">Pool your Google accounts behind one</text>
|
||||||
|
<text id="value-2" x="64" y="262" font-size="27" fill="#b9bdc5">OpenAI- and Anthropic-compatible API.</text>
|
||||||
|
|
||||||
|
<g id="endpoint" transform="translate(64 296)">
|
||||||
|
<rect width="344" height="48" rx="10" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<circle cx="24" cy="24" r="6" fill="#10b981"/>
|
||||||
|
<text x="42" y="31" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="20" fill="#e7e8ea">http://localhost:8045/v1</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<text id="meta" x="64" y="384" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="18" fill="#6c717a">Electron · NestJS proxy · AES-256-GCM</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="hub">
|
||||||
|
<circle cx="870" cy="172" r="210" fill="url(#core-glow)"/>
|
||||||
|
<!-- Raster layer: replace hero-subject.png to change the hub art; node centres are 741,86 / 1000,86 / 870,334 -->
|
||||||
|
<image id="subject" x="700" y="40" width="340" height="340" xlink:href="hero-subject.png" href="hero-subject.png" preserveAspectRatio="xMidYMid meet"/>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="node-labels" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="18">
|
||||||
|
<g id="label-ide">
|
||||||
|
<path d="M706 86 H676" stroke="#3a3d42" stroke-width="2"/>
|
||||||
|
<rect x="566" y="68" width="110" height="36" rx="18" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<text x="621" y="92" text-anchor="middle" fill="#d4d6da">your IDE</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="label-pool">
|
||||||
|
<rect x="976" y="134" width="184" height="36" rx="18" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<text x="1068" y="158" text-anchor="middle" fill="#d4d6da">account pool</text>
|
||||||
|
<g id="quota-bars" transform="translate(1004 186)">
|
||||||
|
<rect width="140" height="8" rx="4" fill="#1d1f22"/>
|
||||||
|
<rect width="140" height="8" rx="4" fill="#10b981"/>
|
||||||
|
<rect y="22" width="140" height="8" rx="4" fill="#1d1f22"/>
|
||||||
|
<rect y="22" width="88" height="8" rx="4" fill="#10b981"/>
|
||||||
|
<rect y="44" width="140" height="8" rx="4" fill="#1d1f22"/>
|
||||||
|
<rect y="44" width="8" height="8" rx="4" fill="#f43f5e"/>
|
||||||
|
</g>
|
||||||
|
<text x="1004" y="264" fill="#6c717a">auto-switch</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="label-upstream">
|
||||||
|
<path d="M906 334 H932" stroke="#3a3d42" stroke-width="2"/>
|
||||||
|
<rect x="932" y="316" width="176" height="36" rx="18" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<text x="1020" y="340" text-anchor="middle" fill="#d4d6da">Google APIs</text>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 449 KiB |
@@ -0,0 +1,66 @@
|
|||||||
|
<svg xml:lang="zh-CN" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
width="1200" height="420" viewBox="0 0 1200 420"
|
||||||
|
role="img" aria-labelledby="title desc">
|
||||||
|
<title id="title">Gemini Nexus</title>
|
||||||
|
<desc id="desc">Hero layout source: the Gemini Nexus hub (IDE, account pool and Google APIs on its three nodes) next to the project name, value line and the local endpoint. Render to hero.png; the raster hub is hero-subject.png.</desc>
|
||||||
|
|
||||||
|
<defs>
|
||||||
|
<radialGradient id="core-glow" cx="0.5" cy="0.5" r="0.5">
|
||||||
|
<stop offset="0" stop-color="#10b981" stop-opacity="0.32"/>
|
||||||
|
<stop offset="0.55" stop-color="#10b981" stop-opacity="0.08"/>
|
||||||
|
<stop offset="1" stop-color="#10b981" stop-opacity="0"/>
|
||||||
|
</radialGradient>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<rect width="1200" height="420" rx="24" fill="#0a0a0b"/>
|
||||||
|
<rect x="0.5" y="0.5" width="1199" height="419" rx="23.5" fill="none" stroke="#1f2023"/>
|
||||||
|
|
||||||
|
<g id="title-block" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', 'PingFang SC', 'Noto Sans CJK SC', sans-serif">
|
||||||
|
<text id="eyebrow" x="64" y="92" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="18" letter-spacing="3" fill="#10b981">本地 AI 网关 · 桌面应用</text>
|
||||||
|
<text id="name" x="60" y="174" font-size="80" font-weight="700" letter-spacing="-2" fill="#fafafa">Gemini Nexus</text>
|
||||||
|
<text id="value-1" x="64" y="226" font-size="27" fill="#b9bdc5">多个 Google 账号汇成一个账号池,</text>
|
||||||
|
<text id="value-2" x="64" y="262" font-size="27" fill="#b9bdc5">对外提供兼容 OpenAI 与 Anthropic 的 API。</text>
|
||||||
|
|
||||||
|
<g id="endpoint" transform="translate(64 296)">
|
||||||
|
<rect width="344" height="48" rx="10" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<circle cx="24" cy="24" r="6" fill="#10b981"/>
|
||||||
|
<text x="42" y="31" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="20" fill="#e7e8ea">http://localhost:8045/v1</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<text id="meta" x="64" y="384" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="18" fill="#6c717a">Electron · NestJS proxy · AES-256-GCM</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="hub">
|
||||||
|
<circle cx="870" cy="172" r="210" fill="url(#core-glow)"/>
|
||||||
|
<!-- Raster layer: replace hero-subject.png to change the hub art; node centres are 741,86 / 1000,86 / 870,334 -->
|
||||||
|
<image id="subject" x="700" y="40" width="340" height="340" xlink:href="hero-subject.png" href="hero-subject.png" preserveAspectRatio="xMidYMid meet"/>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="node-labels" font-family="ui-monospace, SFMono-Regular, Menlo, 'Noto Sans Mono', monospace" font-size="18">
|
||||||
|
<g id="label-ide">
|
||||||
|
<path d="M706 86 H676" stroke="#3a3d42" stroke-width="2"/>
|
||||||
|
<rect x="566" y="68" width="110" height="36" rx="18" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<text x="621" y="92" text-anchor="middle" fill="#d4d6da">你的 IDE</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="label-pool">
|
||||||
|
<rect x="976" y="134" width="184" height="36" rx="18" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<text x="1068" y="158" text-anchor="middle" fill="#d4d6da">账号池</text>
|
||||||
|
<g id="quota-bars" transform="translate(1004 186)">
|
||||||
|
<rect width="140" height="8" rx="4" fill="#1d1f22"/>
|
||||||
|
<rect width="140" height="8" rx="4" fill="#10b981"/>
|
||||||
|
<rect y="22" width="140" height="8" rx="4" fill="#1d1f22"/>
|
||||||
|
<rect y="22" width="88" height="8" rx="4" fill="#10b981"/>
|
||||||
|
<rect y="44" width="140" height="8" rx="4" fill="#1d1f22"/>
|
||||||
|
<rect y="44" width="8" height="8" rx="4" fill="#f43f5e"/>
|
||||||
|
</g>
|
||||||
|
<text x="1004" y="264" fill="#6c717a">自动切换</text>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="label-upstream">
|
||||||
|
<path d="M906 334 H932" stroke="#3a3d42" stroke-width="2"/>
|
||||||
|
<rect x="932" y="316" width="176" height="36" rx="18" fill="#121315" stroke="#2a2c30"/>
|
||||||
|
<text x="1020" y="340" text-anchor="middle" fill="#d4d6da">Google API</text>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.9 KiB |
@@ -1,102 +0,0 @@
|
|||||||
# CLI Feature - Pull Request Summary
|
|
||||||
|
|
||||||
## What This PR Adds
|
|
||||||
|
|
||||||
A complete **Command-Line Interface (CLI)** for Antigravity Manager with 18+ commands for power users.
|
|
||||||
|
|
||||||
## Key Features
|
|
||||||
|
|
||||||
- 📊 **Live Quota Monitoring** - Real-time tracking for Gemini & Claude models
|
|
||||||
- 🔄 **Account Switching** - Seamless switching without manual token management
|
|
||||||
- ✅ **Token Validation** - Auto-refresh expired tokens
|
|
||||||
- 🎯 **Smart Auto-Switch** - Automatically pick best account by quota
|
|
||||||
- 🏷️ **Aliases** - Shortcut names for accounts (`work`, `personal`)
|
|
||||||
- 💾 **Backup/Restore** - Export/import account configurations
|
|
||||||
- 🎮 **Interactive Mode** - Keyboard-navigated menus for beginners
|
|
||||||
- 🩺 **Diagnostics** - System health checks
|
|
||||||
|
|
||||||
## Technical Highlights
|
|
||||||
|
|
||||||
- **Zero Hardcoded Paths**: Intelligently discovers database and executable locations
|
|
||||||
- **Cross-Platform Ready**: Uses environment variables and checks for Windows/Mac/Linux
|
|
||||||
- **Secure**: Leverages existing DPAPI + AES-256-GCM encryption (same as GUI)
|
|
||||||
- **Extensible**: Clean separation between core logic (`core.py`) and commands (`main.py`)
|
|
||||||
|
|
||||||
## File Structure
|
|
||||||
|
|
||||||
```
|
|
||||||
cli/
|
|
||||||
├── README.md # Full documentation
|
|
||||||
├── requirements.txt # Python dependencies
|
|
||||||
├── core.py # Database, encryption, API logic
|
|
||||||
├── main.py # CLI commands and interactive UI
|
|
||||||
└── proto_utils.py # Protobuf encoding helpers
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage Examples
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
# Interactive mode
|
|
||||||
agm
|
|
||||||
|
|
||||||
# Quick status
|
|
||||||
agm status
|
|
||||||
|
|
||||||
# Switch accounts
|
|
||||||
agm switch work
|
|
||||||
|
|
||||||
# Auto-switch to best account
|
|
||||||
agm auto-switch --model claude --min-quota 50
|
|
||||||
|
|
||||||
# Live monitoring
|
|
||||||
agm watch
|
|
||||||
```
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
- ✅ Tested on Windows 10/11
|
|
||||||
- ✅ No hardcoded paths (uses standard Windows env vars)
|
|
||||||
- ✅ Works with both installed and development builds
|
|
||||||
- ✅ Database encryption/decryption verified
|
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
|
|
||||||
All Python dependencies are self-contained in `cli/requirements.txt`:
|
|
||||||
- `typer` - CLI framework
|
|
||||||
- `rich` - Beautiful terminal output
|
|
||||||
- `questionary` - Interactive menus
|
|
||||||
- `pywin32` - Windows DPAPI support
|
|
||||||
- `cryptography` - AES-256-GCM encryption
|
|
||||||
- `httpx` - Async HTTP client
|
|
||||||
- `psutil` - Process management
|
|
||||||
- `protobuf` - Google API protocol buffers
|
|
||||||
|
|
||||||
## Platform Support
|
|
||||||
|
|
||||||
- **Windows**: Full support (tested)
|
|
||||||
- **macOS/Linux**: Partial support (no DPAPI, but core features work)
|
|
||||||
|
|
||||||
## Breaking Changes
|
|
||||||
|
|
||||||
None. This is a pure addition—no changes to existing GUI code.
|
|
||||||
|
|
||||||
## Future Enhancements
|
|
||||||
|
|
||||||
- OAuth flow for adding new accounts via CLI
|
|
||||||
- TUI (Terminal UI) with live dashboard
|
|
||||||
- Scheduled auto-refresh via Windows Task Scheduler
|
|
||||||
- Config file for user preferences
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
|
|
||||||
- [x] Code follows existing style
|
|
||||||
- [x] All commands have help text
|
|
||||||
- [x] No hardcoded paths/credentials
|
|
||||||
- [x] README with examples
|
|
||||||
- [x] Dependencies in requirements.txt
|
|
||||||
- [x] .gitignore updated for Python
|
|
||||||
- [x] Works with fresh installs
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Ready to merge!** 🚀
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Antigravity Manager CLI
|
# Gemini Nexus CLI
|
||||||
|
|
||||||
A powerful command-line interface for managing multiple Google Cloud AI accounts in Antigravity IDE. Supports account switching, quota monitoring, token validation, and more.
|
A powerful command-line interface for managing multiple Google Cloud AI accounts in Gemini Nexus IDE. Supports account switching, quota monitoring, token validation, and more.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -147,9 +147,9 @@ agm doctor
|
|||||||
|
|
||||||
## How It Works
|
## How It Works
|
||||||
|
|
||||||
The CLI interacts directly with the Antigravity Manager's encrypted database:
|
The CLI interacts directly with the Gemini Nexus's encrypted database:
|
||||||
|
|
||||||
1. **Database Location**: Auto-discovers the database in `%APPDATA%\AntigravityManager` or IDE installation directory
|
1. **Database Location**: Auto-discovers the database in `%APPDATA%\GeminiNexus` or IDE installation directory
|
||||||
2. **Encryption**: Uses Windows DPAPI + AES-256-GCM to decrypt account tokens (same as the IDE)
|
2. **Encryption**: Uses Windows DPAPI + AES-256-GCM to decrypt account tokens (same as the IDE)
|
||||||
3. **Quota API**: Fetches live quota data from Google Cloud AI REST API
|
3. **Quota API**: Fetches live quota data from Google Cloud AI REST API
|
||||||
4. **Process Control**: Can start/stop the IDE executable automatically
|
4. **Process Control**: Can start/stop the IDE executable automatically
|
||||||
@@ -157,7 +157,7 @@ The CLI interacts directly with the Antigravity Manager's encrypted database:
|
|||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
**"Database not found" error:**
|
**"Database not found" error:**
|
||||||
- Ensure Antigravity Manager has been run at least once
|
- Ensure Gemini Nexus has been run at least once
|
||||||
- Check if accounts exist in the GUI first
|
- Check if accounts exist in the GUI first
|
||||||
|
|
||||||
**"Failed to decrypt" error:**
|
**"Failed to decrypt" error:**
|
||||||
@@ -175,7 +175,7 @@ The CLI interacts directly with the Antigravity Manager's encrypted database:
|
|||||||
|
|
||||||
- Windows 10/11
|
- Windows 10/11
|
||||||
- Python 3.8+
|
- Python 3.8+
|
||||||
- Antigravity Manager (for database access)
|
- Gemini Nexus (for database access)
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,276 @@
|
|||||||
|
**✅ Documento Completo: Integração com Custom Endpoint do OpenCode (Provedores Custom / OpenAI-Compatible)**
|
||||||
|
|
||||||
|
OpenCode (https://opencode.ai) é um agente de IA para terminal que usa o **Vercel AI SDK** para se comunicar com provedores de LLM. Ele suporta nativamente provedores customizados via o pacote `@ai-sdk/openai-compatible`, que segue o padrão **OpenAI Chat Completions API** (`/v1/chat/completions`).
|
||||||
|
|
||||||
|
Isso significa que **sua API precisa implementar exatamente o formato OpenAI-compatible** para que o OpenCode consiga conversar com ela diretamente.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 1. Como Configurar um Provedor Custom no OpenCode
|
||||||
|
|
||||||
|
Crie ou edite o arquivo de configuração (recomendado: `~/.config/opencode/opencode.json` ou `opencode.json` na raiz do projeto):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"$schema": "https://opencode.ai/config.json",
|
||||||
|
"provider": {
|
||||||
|
"minha-ia-custom": {
|
||||||
|
"npm": "@ai-sdk/openai-compatible",
|
||||||
|
"name": "Minha IA Custom (OpenCode)",
|
||||||
|
"options": {
|
||||||
|
"baseURL": "https://sua-api.com/v1",
|
||||||
|
"apiKey": "sk-sua-chave-aqui-ou-{env:MINHA_API_KEY}",
|
||||||
|
"headers": {
|
||||||
|
"X-Custom-Header": "valor-opcional"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"models": {
|
||||||
|
"meu-modelo-principal": {
|
||||||
|
"name": "Meu Modelo Principal",
|
||||||
|
"limit": {
|
||||||
|
"context": 128000,
|
||||||
|
"output": 8192
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"meu-modelo-rapido": {
|
||||||
|
"name": "Modelo Rápido",
|
||||||
|
"limit": {
|
||||||
|
"context": 32000,
|
||||||
|
"output": 4096
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"model": "minha-ia-custom/meu-modelo-principal"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Campos importantes:**
|
||||||
|
|
||||||
|
- `npm`: Sempre use `"@ai-sdk/openai-compatible"` para APIs que expõem `/v1/chat/completions`.
|
||||||
|
- `baseURL`: URL base da sua API (deve terminar com `/v1`).
|
||||||
|
- `apiKey`: Pode ser valor direto ou `{env:NOME_VARIAVEL}`.
|
||||||
|
- `models`: Defina os modelos que sua API expõe. O `limit` ajuda o OpenCode a gerenciar contexto.
|
||||||
|
- `model`: Define o modelo padrão no formato `provider_id/model_id`.
|
||||||
|
|
||||||
|
Depois de salvar, reinicie o OpenCode ou use `/models` para selecionar.
|
||||||
|
|
||||||
|
**Comando rápido para adicionar chave:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
opencode /connect
|
||||||
|
# Escolha "Other" → digite o provider_id (ex: minha-ia-custom) → cole a API key
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2. Como o OpenCode Envia Requisições
|
||||||
|
|
||||||
|
O OpenCode (via AI SDK) faz chamadas **POST** para:
|
||||||
|
|
||||||
|
```
|
||||||
|
POST {baseURL}/chat/completions
|
||||||
|
```
|
||||||
|
|
||||||
|
**Headers enviados:**
|
||||||
|
|
||||||
|
- `Authorization: Bearer <sua-api-key>`
|
||||||
|
- `Content-Type: application/json`
|
||||||
|
- Headers customizados que você definir em `options.headers`
|
||||||
|
|
||||||
|
**Payload típico (exemplo real):**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"model": "meu-modelo-principal",
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"role": "system",
|
||||||
|
"content": "Você é um assistente de código experiente..."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": "Crie uma função em Python que..."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stream": true,
|
||||||
|
"temperature": 0.7,
|
||||||
|
"max_tokens": 8192,
|
||||||
|
"tools": [
|
||||||
|
/* array de tools se o agente estiver usando ferramentas */
|
||||||
|
],
|
||||||
|
"tool_choice": "auto"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Parâmetros comuns que o OpenCode envia:**
|
||||||
|
|
||||||
|
- `messages` (array completo do histórico)
|
||||||
|
- `stream: true` (quase sempre, para UX em tempo real)
|
||||||
|
- `temperature`, `max_tokens`, `top_p`
|
||||||
|
- `tools` + `tool_choice` (quando usa agentes com ferramentas/MCP)
|
||||||
|
- `response_format` (às vezes)
|
||||||
|
- `providerOptions` (opções específicas do provedor – raras no openai-compatible)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3. Como o OpenCode Recebe e Processa Respostas
|
||||||
|
|
||||||
|
#### A. Streaming (recomendado – usado na maioria das interações)
|
||||||
|
|
||||||
|
Sua API deve responder com `Content-Type: text/event-stream` e eventos SSE:
|
||||||
|
|
||||||
|
```
|
||||||
|
data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1712345678,"model":"meu-modelo-principal","choices":[{"index":0,"delta":{"content":"Olá"},"finish_reason":null}]}
|
||||||
|
|
||||||
|
data: {"id":"chatcmpl-123","choices":[{"index":0,"delta":{"content":"! Como"},"finish_reason":null}]}
|
||||||
|
|
||||||
|
data: [DONE]
|
||||||
|
```
|
||||||
|
|
||||||
|
O OpenCode processa cada chunk em tempo real.
|
||||||
|
|
||||||
|
#### B. Resposta não-streaming (completa)
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"id": "chatcmpl-123",
|
||||||
|
"object": "chat.completion",
|
||||||
|
"created": 1712345678,
|
||||||
|
"model": "meu-modelo-principal",
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"index": 0,
|
||||||
|
"message": {
|
||||||
|
"role": "assistant",
|
||||||
|
"content": "Resposta completa aqui..."
|
||||||
|
},
|
||||||
|
"finish_reason": "stop"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"usage": {
|
||||||
|
"prompt_tokens": 150,
|
||||||
|
"completion_tokens": 320,
|
||||||
|
"total_tokens": 470
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Suporte a Tool Calling (essencial para agentes)
|
||||||
|
|
||||||
|
Se sua API suportar `tools`, o OpenCode pode:
|
||||||
|
|
||||||
|
1. Enviar `tools` na requisição.
|
||||||
|
2. Receber `tool_calls` na resposta.
|
||||||
|
3. Executar a ferramenta (via MCP ou built-in).
|
||||||
|
4. Enviar o resultado de volta como mensagem `tool`.
|
||||||
|
|
||||||
|
**Exemplo de resposta com tool call:**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"choices": [
|
||||||
|
{
|
||||||
|
"message": {
|
||||||
|
"role": "assistant",
|
||||||
|
"tool_calls": [
|
||||||
|
{
|
||||||
|
"id": "call_123",
|
||||||
|
"type": "function",
|
||||||
|
"function": {
|
||||||
|
"name": "read_file",
|
||||||
|
"arguments": "{\"path\": \"src/app.ts\"}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4. Como é Exibido no Chat do OpenCode (TUI)
|
||||||
|
|
||||||
|
- **Streaming**: Texto aparece caractere por caractere com efeito de digitação.
|
||||||
|
- **Markdown**: Suporte completo a código (syntax highlight), listas, tabelas, etc.
|
||||||
|
- **Tool Calls**: Mostra “Executando ferramenta: read_file...” + resultado.
|
||||||
|
- **Multi-turn**: Mantém histórico completo na conversa.
|
||||||
|
- **Erros**: Mostra mensagens de erro claras no terminal.
|
||||||
|
- **Contexto**: Respeita os limites de `context` e `output` que você definiu no config.
|
||||||
|
|
||||||
|
O OpenCode usa o TUI (Terminal User Interface) baseado em React/Ink para renderizar tudo de forma bonita.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 5. Requisitos Mínimos da Sua API para Funcionar Perfeitamente
|
||||||
|
|
||||||
|
| Recurso | Obrigatório? | Recomendado? | Observação |
|
||||||
|
| ---------------------- | ------------ | ------------ | ---------------------------------- |
|
||||||
|
| `/v1/chat/completions` | Sim | - | Endpoint principal |
|
||||||
|
| Streaming (SSE) | Sim | - | Essencial para UX |
|
||||||
|
| Tool Calling | Não | Sim | Para agentes completos |
|
||||||
|
| System messages | Sim | - | - |
|
||||||
|
| Multi-turn history | Sim | - | - |
|
||||||
|
| Usage stats | Não | Sim | Mostra tokens gastos |
|
||||||
|
| Error handling | Sim | - | Retorne JSON de erro padrão OpenAI |
|
||||||
|
|
||||||
|
**Endpoint exato esperado:**
|
||||||
|
`POST https://sua-api.com/v1/chat/completions`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 6. Exemplo Completo de Configuração + Teste
|
||||||
|
|
||||||
|
1. Configure o `opencode.json` como acima.
|
||||||
|
2. Rode:
|
||||||
|
```bash
|
||||||
|
opencode
|
||||||
|
```
|
||||||
|
3. Digite algo ou use `/models` para selecionar seu provedor.
|
||||||
|
4. Teste com:
|
||||||
|
```bash
|
||||||
|
curl -X POST https://sua-api.com/v1/chat/completions \
|
||||||
|
-H "Authorization: Bearer sk-..." \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{"model":"meu-modelo-principal","messages":[{"role":"user","content":"Olá"}],"stream":true}'
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 7. Troubleshooting Comum
|
||||||
|
|
||||||
|
- **“Route not found” ou requests indo para lugar errado** → Verifique se `baseURL` termina com `/v1` e não com `/v1/chat/completions`.
|
||||||
|
- **Custom provider não aparece** → Certifique-se que o ID do provider no `/connect` bate com a chave no `opencode.json`.
|
||||||
|
- **Sem streaming / resposta lenta** → Implemente SSE corretamente.
|
||||||
|
- **Tool calls não funcionam** → Sua API precisa retornar `tool_calls` no formato OpenAI exato.
|
||||||
|
- **Erro de autenticação** → Use `apiKey` ou `headers` corretamente.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Referências Oficiais
|
||||||
|
|
||||||
|
- **Docs Principais**: https://opencode.ai/docs/providers/
|
||||||
|
- **Models**: https://opencode.ai/docs/models/
|
||||||
|
- **Config**: https://opencode.ai/docs/config/
|
||||||
|
- **Schema de Config**: https://opencode.ai/config.json
|
||||||
|
- **GitHub**: https://github.com/anomalyco/opencode
|
||||||
|
- **AI SDK OpenAI-Compatible**: https://ai-sdk.dev/providers/openai-compatible-providers
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Resumo Final para Você (que está construindo a API):**
|
||||||
|
|
||||||
|
Sua API **precisa ser 100% compatível** com o endpoint OpenAI `/v1/chat/completions` (streaming + tool calling recomendado).
|
||||||
|
O OpenCode vai:
|
||||||
|
|
||||||
|
1. Configurar via `opencode.json` (baseURL + apiKey)
|
||||||
|
2. Enviar requisições padrão OpenAI
|
||||||
|
3. Receber streaming ou resposta completa
|
||||||
|
4. Renderizar tudo lindamente no TUI com suporte a ferramentas
|
||||||
|
|
||||||
|
Se você implementar exatamente o padrão OpenAI Chat Completions, vai funcionar perfeitamente com o OpenCode.
|
||||||
|
|
||||||
|
Quer que eu monte um **exemplo de servidor mínimo** (em Node.js/Fastify ou Python/FastAPI) que já funcione com o OpenCode? Posso criar um template completo para você.
|
||||||
|
After Width: | Height: | Size: 229 KiB |
|
After Width: | Height: | Size: 215 KiB |
|
After Width: | Height: | Size: 242 KiB |
|
After Width: | Height: | Size: 240 KiB |
|
After Width: | Height: | Size: 352 KiB |
|
After Width: | Height: | Size: 250 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 736 KiB |
|
After Width: | Height: | Size: 220 KiB |
|
Before Width: | Height: | Size: 153 KiB |
|
Before Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 131 KiB |
@@ -0,0 +1,158 @@
|
|||||||
|
# Brand Briefing — Gemini Nexus
|
||||||
|
|
||||||
|
## 1. Nome e Descrição
|
||||||
|
|
||||||
|
| Campo | Valor |
|
||||||
|
| ------------------- | -------------------------------------------------------------------- |
|
||||||
|
| **Nome** | Gemini Nexus |
|
||||||
|
| **Product Name** | Gemini Nexus |
|
||||||
|
| **Package Name** | gemini-nexus |
|
||||||
|
| **Versão** | 0.11.1 |
|
||||||
|
| **Descrição EN** | Professional multi-account manager for Google Gemini & Claude AI |
|
||||||
|
| **Descrição PT-BR** | Gerenciador multi-contas profissional para Google Gemini & Claude AI |
|
||||||
|
| **Autor** | evandrodevbr / Draculabo |
|
||||||
|
| **Licença** | CC-BY-NC-SA-4.0 (apenas fins educacionais) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Propósito do Aplicativo
|
||||||
|
|
||||||
|
Gemini Nexus é um **aplicativo desktop profissional** (Electron) que funciona como um **hub central (nexus)** para desenvolvedores que usam IDEs com IA.
|
||||||
|
|
||||||
|
### Funcionalidades Principais
|
||||||
|
|
||||||
|
- **Pool ilimitado de contas**: Adicionar múltiplas contas Google Gemini / Claude via OAuth
|
||||||
|
- **Auto-switching inteligente**: Troca automática de conta quando a cota acaba ou há rate limit
|
||||||
|
- **Monitoramento em tempo real**: Barras de progresso coloridas para visualizar uso de quota
|
||||||
|
- **Proxy API local**: Servidor proxy integrado compatível OpenAI/Anthropic (porta 8045)
|
||||||
|
- **Segurança**: Criptografia AES-256-GCM para dados sensíveis
|
||||||
|
|
||||||
|
### Público-Alvo
|
||||||
|
|
||||||
|
- Desenvolvedores que usam IDEs com integração AI (Cursor, Windsurf, VS Code, Claude Code, etc.)
|
||||||
|
- Power users que precisam alternar entre múltiplas contas de IA
|
||||||
|
- Usuários que precisam de um proxy API local confiável
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Tom de Voz / Personalidade
|
||||||
|
|
||||||
|
- **Profissional e técnica**: Termos como "Nexus", "Proxy", "Gateway", "Quota", "Circuit Breaker"
|
||||||
|
- **Confiável e estável**: Monitoramento, health checks, logging robusto
|
||||||
|
- **Developer-first**: Suporte a múltiplas IDEs, geração de cURL/Python
|
||||||
|
- **Moderna e minimalista**: Interface limpa, componentes modulares
|
||||||
|
- **Global**: Suporte a i18n (EN, PT-BR, ZH, RU, VI)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Estilo Visual Atual
|
||||||
|
|
||||||
|
### Tema
|
||||||
|
|
||||||
|
- Dual theme (claro/escuro) com detecção automática do sistema
|
||||||
|
- Extremamente minimalista e quase monocromático
|
||||||
|
|
||||||
|
### Paleta de Cores (Tailwind OKLCH)
|
||||||
|
|
||||||
|
| Modo | Background | Foreground | Primary | Destructive | Destaque |
|
||||||
|
| ---------- | ------------------------------ | --------------------- | ------- | --------------- | -------- |
|
||||||
|
| **Claro** | oklch(0.99 0 0) — quase branco | oklch(0 0 0) — preto | Preto | Vermelho | Azul |
|
||||||
|
| **Escuro** | oklch(0 0 0) — preto puro | oklch(1 0 0) — branco | Branco | Vermelho escuro | — |
|
||||||
|
|
||||||
|
### Cores Funcionais
|
||||||
|
|
||||||
|
- **Emerald/Green (`#10b981`)** — status ativo, quota alta, running
|
||||||
|
- **Amber/Yellow** — quota média, alertas
|
||||||
|
- **Rose/Red** — quota baixa, erro, stopped
|
||||||
|
- **Blue** — AI credits, informações premium
|
||||||
|
|
||||||
|
### Tipografia
|
||||||
|
|
||||||
|
- **Geist** (sans-serif) — fonte principal moderna e geométrica (da Vercel)
|
||||||
|
- **Geist Mono** (monospace) — dados técnicos, números de quota
|
||||||
|
- **Tomorrow** (display/futurista) — possíveis títulos estilizados
|
||||||
|
|
||||||
|
### Características de UI
|
||||||
|
|
||||||
|
- Bordas arredondadas (`0.5rem` / 8px)
|
||||||
|
- Sombras sutis
|
||||||
|
- Cards com hover states suaves
|
||||||
|
- Interface limpa com espaçamento generoso
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Assets Visuais Existentes
|
||||||
|
|
||||||
|
| Arquivo | Descrição |
|
||||||
|
| ---------------------------------------------------------------- | ---------------------------------------------------- |
|
||||||
|
| `docs/assets/logo.png` | Logo antiga (Antigravity) — 128x128, usada no README |
|
||||||
|
| `docs/assets/screenshot-main.png` | Screenshot da interface principal |
|
||||||
|
| `docs/assets/screenshot-proxy.png` | Screenshot da aba proxy |
|
||||||
|
| `docs/assets/screenshot-setting.png` | Screenshot de settings |
|
||||||
|
| `src/assets/icon.png` | Ícone do app (também é o logo antigo) |
|
||||||
|
| `src/assets/tray.png` | Ícone da system tray |
|
||||||
|
| `images/icon.ico` / `images/icon.icns` | Ícones de build para Windows/Mac |
|
||||||
|
| `images/favicon-*.png` | Favicons em múltiplos tamanhos |
|
||||||
|
| `images/32x32.png`, `64x64.png`, `128x128.png`, `[email protected]` | Ícones para AppImage Linux |
|
||||||
|
| `src/assets/fonts/geist/` | Fonte Geist (principal) |
|
||||||
|
| `src/assets/fonts/geist-mono/` | Fonte Geist Mono (código/dados) |
|
||||||
|
| `src/assets/fonts/tomorrow/` | Fonte Tomorrow (display, 4 pesos) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Conceitos Visuais Sugeridos para a Logo
|
||||||
|
|
||||||
|
### A. Nodo / Conexão (Nexus)
|
||||||
|
|
||||||
|
- Ponto central conectado a múltiplos pontos (contas gerenciadas)
|
||||||
|
- Círculo central com 2-3 linhas finas irradiando
|
||||||
|
- Dois círculos interligados (Gemini + Claude)
|
||||||
|
|
||||||
|
### B. Infinito / Loop (Gemini + Proxy)
|
||||||
|
|
||||||
|
- Símbolo de infinito (∞) modificado como circuito/loop de dados
|
||||||
|
- Referência à dualidade "Gemini" (gêmeos)
|
||||||
|
- Curva contínua elegante com seta indicando fluxo
|
||||||
|
|
||||||
|
### C. Cubo / Hexágono (Nexus / Hub)
|
||||||
|
|
||||||
|
- Hexágono ou cubo isométrico minimalista
|
||||||
|
- Linhas finas, perspectiva suave
|
||||||
|
- Face "aberta" ou conectada
|
||||||
|
|
||||||
|
### D. Monograma "GN"
|
||||||
|
|
||||||
|
- Letras "G" e "N" abstraídas como nodo de rede
|
||||||
|
- Estilo geométrico, similar a Tomorrow ou Geist
|
||||||
|
|
||||||
|
### E. Proxy / Pipe (Fluxo de Dados)
|
||||||
|
|
||||||
|
- Duas barras paralelas com seta passando entre elas
|
||||||
|
- "Pipe" minimalista — conduz tráfego entre APIs
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Diretrizes para a Nova Logo
|
||||||
|
|
||||||
|
| Elemento | Especificação |
|
||||||
|
| ---------------------------- | ------------------------------------------------------------------------- |
|
||||||
|
| **Estilo** | Minimalista, geométrica, precisa, técnica |
|
||||||
|
| **Cores principais** | Preto (`#000000`) e branco (`#ffffff`) |
|
||||||
|
| **Cor de acento (opcional)** | Emerald (`#10b981`) para "ativo/online" |
|
||||||
|
| **Versões necessárias** | Dark mode e light mode |
|
||||||
|
| **Tamanhos** | De 16x16 (tray) até 512x512 (macOS) |
|
||||||
|
| **Monocromática** | Deve funcionar em preto e branco puro |
|
||||||
|
| **Tipografia do wordmark** | Geométrica sans-serif, peso medium/semibold, tracking levemente expandido |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. Conclusão
|
||||||
|
|
||||||
|
O app pede uma logo que evoque **conexão/nexo** (Nexus) com **múltiplos pontos** (contas) de forma geométrica e limpa, usando primariamente preto/branco com um toque sutil de verde (emerald) para representar o estado "ativo/online" central ao propósito do app.
|
||||||
|
|
||||||
|
A logo deve transmitir:
|
||||||
|
|
||||||
|
- **Tecnologia** e **precisão**
|
||||||
|
- **Conectividade** e **hub central**
|
||||||
|
- **Profissionalismo** e **confiança**
|
||||||
|
- **Modernidade** e **minimalismo**
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Cloud Account Management and Intelligent Switching
|
# Cloud Account Management and Intelligent Switching
|
||||||
|
|
||||||
This document explains the cloud AI account management and switching capabilities in Antigravity Manager. The feature allows users to manage multiple Google accounts, monitor API quotas, and seamlessly switch the active IDE account with one click.
|
This document explains the cloud AI account management and switching capabilities in Gemini Nexus. The feature allows users to manage multiple Google accounts, monitor API quotas, and seamlessly switch the active IDE account with one click.
|
||||||
|
|
||||||
## 1. Core Features
|
## 1. Core Features
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,244 @@
|
|||||||
|
# Proxyman Debugging Guide for Antigravity and Gemini Nexus
|
||||||
|
|
||||||
|
This guide explains how to use Proxyman for two debugging targets:
|
||||||
|
|
||||||
|
1. The installed official `Antigravity` desktop client
|
||||||
|
2. The `Gemini Nexus` development build from this repository
|
||||||
|
|
||||||
|
Before you start, complete [Proxyman Installation and Basic Setup on Windows](./proxyman-install.md).
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
Use this guide when you want to:
|
||||||
|
|
||||||
|
- inspect login, quota, project context, or model-list requests from `Antigravity`
|
||||||
|
- inspect OAuth, quota refresh, or proxy traffic from `Gemini Nexus`
|
||||||
|
- compare requests from the official client with requests produced by this project
|
||||||
|
|
||||||
|
## Understand the Two Traffic Paths
|
||||||
|
|
||||||
|
### Official `Antigravity` Client
|
||||||
|
|
||||||
|
`Antigravity` is an Electron application. Its traffic may come from:
|
||||||
|
|
||||||
|
- Chromium or renderer-side requests
|
||||||
|
- Electron or Node-side requests
|
||||||
|
|
||||||
|
### `Gemini Nexus` in This Repository
|
||||||
|
|
||||||
|
This project is also an Electron app, but it additionally includes Node, Undici, and internal proxy flows. You may need to inspect:
|
||||||
|
|
||||||
|
- Electron main-process outbound requests
|
||||||
|
- renderer-side requests
|
||||||
|
- upstream requests emitted by `src/server/`
|
||||||
|
|
||||||
|
## Debug the Installed Official Antigravity Client
|
||||||
|
|
||||||
|
### Recommended Path: Use the Repository Script
|
||||||
|
|
||||||
|
Use the provided script:
|
||||||
|
|
||||||
|
- [scripts/start-antigravity-with-proxyman.ps1](../scripts/start-antigravity-with-proxyman.ps1)
|
||||||
|
|
||||||
|
This should be the default path for the installed official client because it already does the following:
|
||||||
|
|
||||||
|
- sets `HTTP_PROXY`, `HTTPS_PROXY`, and `ALL_PROXY`
|
||||||
|
- sets `NODE_EXTRA_CA_CERTS`
|
||||||
|
- passes `--proxy-server` and `--proxy-bypass-list`
|
||||||
|
- stops existing `Antigravity` processes so the new environment takes effect
|
||||||
|
|
||||||
|
Typical usage:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
powershell -ExecutionPolicy Bypass -File .\scripts\start-antigravity-with-proxyman.ps1
|
||||||
|
```
|
||||||
|
|
||||||
|
If Proxyman is using a different port:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
powershell -ExecutionPolicy Bypass -File .\scripts\start-antigravity-with-proxyman.ps1 -Port 9091
|
||||||
|
```
|
||||||
|
|
||||||
|
If you are temporarily debugging TLS failures:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
powershell -ExecutionPolicy Bypass -File .\scripts\start-antigravity-with-proxyman.ps1 -AllowInsecureTls
|
||||||
|
```
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
- This script targets the installed official `Antigravity` client.
|
||||||
|
- It does not launch this repository's `Gemini Nexus` development build.
|
||||||
|
- Override `-AppPath`, `-CaPath`, `-ProxyHost`, or `-NoProxy` if your local environment differs.
|
||||||
|
|
||||||
|
### Suggested Flow
|
||||||
|
|
||||||
|
1. Open Proxyman.
|
||||||
|
2. Confirm that installation and certificate setup are already complete.
|
||||||
|
3. Confirm the local proxy port, for example `9090`.
|
||||||
|
4. Launch `Antigravity` with the script.
|
||||||
|
5. Trigger a request that is easy to identify, such as:
|
||||||
|
- Google sign-in
|
||||||
|
- model list loading
|
||||||
|
- quota refresh
|
||||||
|
- a generated request or prompt action
|
||||||
|
|
||||||
|
### Why Manual Parameters Are Still Documented
|
||||||
|
|
||||||
|
The script is the recommended default, but the raw parameters are still useful because:
|
||||||
|
|
||||||
|
- contributors may want to understand exactly what the script configures
|
||||||
|
- some people launch from VS Code, another shell, or a custom wrapper
|
||||||
|
- some debugging sessions need a partial override rather than the full script
|
||||||
|
|
||||||
|
### If Windows System Proxy Is Not Enough
|
||||||
|
|
||||||
|
In some environments you may still need to point the system proxy to Proxyman manually. At minimum, verify:
|
||||||
|
|
||||||
|
- HTTP proxy: `127.0.0.1:9090`
|
||||||
|
- HTTPS proxy: `127.0.0.1:9090`
|
||||||
|
- the bypass list is not excluding the domains you want to inspect
|
||||||
|
|
||||||
|
### If You Need Direct Chromium Proxy Arguments
|
||||||
|
|
||||||
|
If system proxy behavior is unreliable, you can launch the installed client with explicit Chromium proxy arguments:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
& "C:\Users\<YourUser>\AppData\Local\Programs\Antigravity\Antigravity.exe" `
|
||||||
|
--proxy-server="http://127.0.0.1:9090" `
|
||||||
|
--proxy-bypass-list="<local>;localhost;127.0.0.1;::1"
|
||||||
|
```
|
||||||
|
|
||||||
|
Use this as a fallback, not the default path.
|
||||||
|
|
||||||
|
## Debug Gemini Nexus From This Repository
|
||||||
|
|
||||||
|
This project has more layers than the official client. The script above is not the general launcher for this repository's development app.
|
||||||
|
|
||||||
|
### Capture Main-Process, Node, and Internal Proxy Traffic
|
||||||
|
|
||||||
|
Set proxy-related environment variables before starting the app:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$env:HTTP_PROXY = "http://127.0.0.1:9090"
|
||||||
|
$env:HTTPS_PROXY = "http://127.0.0.1:9090"
|
||||||
|
$env:ALL_PROXY = "http://127.0.0.1:9090"
|
||||||
|
$env:NO_PROXY = "localhost,127.0.0.1,::1"
|
||||||
|
$env:NODE_EXTRA_CA_CERTS = "$env:APPDATA\\Proxyman\\certificate\\certs\\ca.pem"
|
||||||
|
|
||||||
|
# Enable only for temporary TLS debugging
|
||||||
|
$env:NODE_TLS_REJECT_UNAUTHORIZED = "0"
|
||||||
|
|
||||||
|
npm start
|
||||||
|
```
|
||||||
|
|
||||||
|
This primarily affects:
|
||||||
|
|
||||||
|
- Node HTTP and HTTPS requests
|
||||||
|
- `undici`, `fetch`, and some dependency-driven upstream requests
|
||||||
|
- internal proxy requests forwarded to upstream services
|
||||||
|
|
||||||
|
### Also Capture Electron and Chromium Traffic
|
||||||
|
|
||||||
|
If you want both Node-side and renderer-side traffic, add Chromium proxy arguments:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$env:HTTP_PROXY = "http://127.0.0.1:9090"
|
||||||
|
$env:HTTPS_PROXY = "http://127.0.0.1:9090"
|
||||||
|
$env:ALL_PROXY = "http://127.0.0.1:9090"
|
||||||
|
$env:NO_PROXY = "localhost,127.0.0.1,::1"
|
||||||
|
$env:NODE_EXTRA_CA_CERTS = "$env:APPDATA\\Proxyman\\certificate\\certs\\ca.pem"
|
||||||
|
$env:NODE_TLS_REJECT_UNAUTHORIZED = "0"
|
||||||
|
|
||||||
|
npm start -- --proxy-server="http://127.0.0.1:9090" --proxy-bypass-list="<local>;localhost;127.0.0.1;::1"
|
||||||
|
```
|
||||||
|
|
||||||
|
If your local `npm start` flow does not forward arguments to Electron Forge, use one of these fallback approaches:
|
||||||
|
|
||||||
|
- capture only Node and main-process traffic
|
||||||
|
- wrap the Electron launch in your own PowerShell or VS Code task
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### I Can See Requests but HTTPS Bodies Are Empty
|
||||||
|
|
||||||
|
Check:
|
||||||
|
|
||||||
|
- the Proxyman root certificate is really trusted
|
||||||
|
- `NODE_EXTRA_CA_CERTS` is set when Node-side traffic needs it
|
||||||
|
- `NODE_TLS_REJECT_UNAUTHORIZED=0` is only being used as a temporary debugging override
|
||||||
|
- the target app is not using SSL pinning
|
||||||
|
|
||||||
|
Background setup guide:
|
||||||
|
|
||||||
|
- [Proxyman Installation and Basic Setup on Windows](./proxyman-install.md)
|
||||||
|
|
||||||
|
### I Can See Browser Traffic but Not Node or Main-Process Traffic
|
||||||
|
|
||||||
|
Common causes:
|
||||||
|
|
||||||
|
- Node is not using system proxy settings
|
||||||
|
- the HTTP client does not read `HTTP_PROXY`
|
||||||
|
- only the system proxy was configured, but runtime environment variables were not
|
||||||
|
|
||||||
|
### I Cannot See `localhost` Traffic
|
||||||
|
|
||||||
|
Common cause:
|
||||||
|
|
||||||
|
- loopback traffic is bypassing the proxy
|
||||||
|
|
||||||
|
Keep this bypass list in mind when launching Electron:
|
||||||
|
|
||||||
|
```plaintext
|
||||||
|
--proxy-bypass-list="<local>;localhost;127.0.0.1;::1"
|
||||||
|
```
|
||||||
|
|
||||||
|
Adjust it only if your current debugging target requires a different loopback behavior.
|
||||||
|
|
||||||
|
### TLS Still Fails After the Certificate Was Installed
|
||||||
|
|
||||||
|
Common causes:
|
||||||
|
|
||||||
|
- the process started before the certificate was installed and needs a full restart
|
||||||
|
- `ca.cer` was imported but `ca.pem` was not passed to Node when required
|
||||||
|
- a corporate proxy, VPN, or security product is changing network behavior
|
||||||
|
- the target app uses SSL pinning
|
||||||
|
|
||||||
|
## Security Notes
|
||||||
|
|
||||||
|
Keep local debugging settings out of the repository and out of public issue threads.
|
||||||
|
|
||||||
|
- Do not commit your local proxy address, certificate paths, cookies, or OAuth codes.
|
||||||
|
- Do not leave `NODE_TLS_REJECT_UNAUTHORIZED=0` enabled beyond temporary local debugging.
|
||||||
|
- Do not post raw tokens, sessions, or authorization headers in public issues.
|
||||||
|
- Redact logs before sharing them.
|
||||||
|
|
||||||
|
## Minimal Workflows
|
||||||
|
|
||||||
|
### Official Antigravity Client
|
||||||
|
|
||||||
|
1. Complete [Proxyman Installation and Basic Setup on Windows](./proxyman-install.md).
|
||||||
|
2. Open Proxyman.
|
||||||
|
3. Run:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
powershell -ExecutionPolicy Bypass -File .\scripts\start-antigravity-with-proxyman.ps1
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Trigger login, quota, or model-list traffic.
|
||||||
|
|
||||||
|
### Gemini Nexus in This Repository
|
||||||
|
|
||||||
|
1. Complete [Proxyman Installation and Basic Setup on Windows](./proxyman-install.md).
|
||||||
|
2. Open PowerShell.
|
||||||
|
3. Set `HTTP_PROXY`, `HTTPS_PROXY`, and `NODE_EXTRA_CA_CERTS`.
|
||||||
|
4. Run `npm start`.
|
||||||
|
5. Filter Proxyman traffic by domains such as:
|
||||||
|
- `googleapis.com`
|
||||||
|
- `googleusercontent.com`
|
||||||
|
- the upstream domain you are debugging
|
||||||
|
|
||||||
|
## Related Files
|
||||||
|
|
||||||
|
- Setup guide: [Proxyman Installation and Basic Setup on Windows](./proxyman-install.md)
|
||||||
|
- Official-client launcher: [scripts/start-antigravity-with-proxyman.ps1](../scripts/start-antigravity-with-proxyman.ps1)
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
# Proxyman Installation and Basic Setup on Windows
|
||||||
|
|
||||||
|
This guide covers the Proxyman prerequisites for contributors:
|
||||||
|
|
||||||
|
1. Install Proxyman for Windows
|
||||||
|
2. Trust the Proxyman certificate so HTTPS traffic can be decrypted
|
||||||
|
3. Verify that Proxyman is working before you start debugging Antigravity traffic
|
||||||
|
|
||||||
|
If your goal is to debug the installed Antigravity client or this repository's development build, continue with [Proxyman Debugging Guide](./proxyman-debugging.md).
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This document is intentionally limited to the setup layer. It does not cover Antigravity-specific debugging flows.
|
||||||
|
|
||||||
|
Use it when you need to answer:
|
||||||
|
|
||||||
|
- How do I install Proxyman on Windows?
|
||||||
|
- How do I trust the certificate?
|
||||||
|
- Why can I only see CONNECT requests but not HTTPS bodies?
|
||||||
|
- How do I verify that Proxyman itself is working?
|
||||||
|
|
||||||
|
## Install Proxyman
|
||||||
|
|
||||||
|
Official resources:
|
||||||
|
|
||||||
|
- Download: [https://proxyman.com/download](https://proxyman.com/download)
|
||||||
|
- Windows product page: [https://proxyman.com/windows](https://proxyman.com/windows)
|
||||||
|
|
||||||
|
Recommended steps:
|
||||||
|
|
||||||
|
1. Install the Windows build from the official download page.
|
||||||
|
2. Launch Proxyman.
|
||||||
|
3. Confirm that Proxyman is listening on a local proxy port.
|
||||||
|
4. This guide uses `9090` as the example port. Replace it with your local port if it differs.
|
||||||
|
|
||||||
|
## Install and Trust the Certificate
|
||||||
|
|
||||||
|
Without the Proxyman root certificate, you will usually only see CONNECT tunnels or TLS handshakes instead of decrypted HTTPS requests.
|
||||||
|
|
||||||
|
Official references:
|
||||||
|
|
||||||
|
- Windows certificate installation: [https://docs.proxyman.com/proxyman-windows/install-certificate](https://docs.proxyman.com/proxyman-windows/install-certificate)
|
||||||
|
- SSL troubleshooting: [https://docs.proxyman.com/troubleshooting/get-ssl-error-from-https-request-and-response](https://docs.proxyman.com/troubleshooting/get-ssl-error-from-https-request-and-response)
|
||||||
|
|
||||||
|
### Recommended Path: Install Automatically
|
||||||
|
|
||||||
|
In Proxyman, run:
|
||||||
|
|
||||||
|
```plaintext
|
||||||
|
Certificate -> Install Certificate on this Windows...
|
||||||
|
```
|
||||||
|
|
||||||
|
Then:
|
||||||
|
|
||||||
|
1. Choose `Install & Trust`
|
||||||
|
2. Approve the administrator prompt
|
||||||
|
|
||||||
|
According to the official documentation, Proxyman uses Windows `certutil` to import the root certificate into the trusted store.
|
||||||
|
|
||||||
|
### Prepare a PEM File for Node and Electron
|
||||||
|
|
||||||
|
Some Node.js and Electron traffic needs more than system trust. You may also need to point the runtime at the PEM file:
|
||||||
|
|
||||||
|
```plaintext
|
||||||
|
%APPDATA%\Proxyman\certificate\certs\ca.pem
|
||||||
|
```
|
||||||
|
|
||||||
|
If you only see `ca.cer` and not `ca.pem`, confirm that Proxyman has generated the PEM variant before moving on.
|
||||||
|
|
||||||
|
## Verify That Proxyman Works
|
||||||
|
|
||||||
|
Do this before trying to debug any application-specific flow.
|
||||||
|
|
||||||
|
### Verify Browser Traffic
|
||||||
|
|
||||||
|
1. Open Proxyman.
|
||||||
|
2. Visit any HTTPS page in a browser, for example:
|
||||||
|
|
||||||
|
```plaintext
|
||||||
|
https://httpbin.org/get
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Confirm that the request and response appear in Proxyman.
|
||||||
|
|
||||||
|
### If You Cannot See Any Traffic
|
||||||
|
|
||||||
|
Check these first:
|
||||||
|
|
||||||
|
- Proxyman is actually listening on the expected port
|
||||||
|
- Windows proxy settings are pointing to Proxyman
|
||||||
|
- A VPN, endpoint security agent, or antivirus is not taking over proxy behavior
|
||||||
|
- The certificate is trusted
|
||||||
|
|
||||||
|
If localhost traffic is missing, see:
|
||||||
|
|
||||||
|
- [https://docs.proxyman.com/troubleshooting/couldnt-see-any-request-from-localhost-server](https://docs.proxyman.com/troubleshooting/couldnt-see-any-request-from-localhost-server)
|
||||||
|
|
||||||
|
The official page includes macOS-specific examples, but the localhost bypass concept is still relevant on Windows.
|
||||||
|
|
||||||
|
## Basic Troubleshooting
|
||||||
|
|
||||||
|
### HTTPS Bodies Are Missing
|
||||||
|
|
||||||
|
Common causes:
|
||||||
|
|
||||||
|
- The Proxyman root certificate is not actually trusted
|
||||||
|
- The target process was already running before the certificate was installed
|
||||||
|
- The application uses SSL pinning
|
||||||
|
|
||||||
|
### Certificate Is Installed but TLS Still Fails
|
||||||
|
|
||||||
|
Common causes:
|
||||||
|
|
||||||
|
- You imported `ca.cer` but did not provide `ca.pem` to the runtime when needed
|
||||||
|
- A corporate proxy, VPN, or security product is overriding the network path
|
||||||
|
- The target application uses SSL pinning
|
||||||
|
|
||||||
|
### Localhost Traffic Is Missing
|
||||||
|
|
||||||
|
Common cause:
|
||||||
|
|
||||||
|
- Local loopback traffic is bypassing the proxy
|
||||||
|
|
||||||
|
Official reference:
|
||||||
|
|
||||||
|
- [https://docs.proxyman.com/troubleshooting/couldnt-see-any-request-from-localhost-server](https://docs.proxyman.com/troubleshooting/couldnt-see-any-request-from-localhost-server)
|
||||||
|
|
||||||
|
## Next Step
|
||||||
|
|
||||||
|
Once Proxyman is installed, trusted, and verified, continue with:
|
||||||
|
|
||||||
|
- [Proxyman Debugging Guide](./proxyman-debugging.md)
|
||||||
|
|
||||||
|
## References
|
||||||
|
|
||||||
|
- Proxyman download page: [https://proxyman.com/download](https://proxyman.com/download)
|
||||||
|
- Proxyman Windows page: [https://proxyman.com/windows](https://proxyman.com/windows)
|
||||||
|
- Proxyman Windows certificate guide: [https://docs.proxyman.com/proxyman-windows/install-certificate](https://docs.proxyman.com/proxyman-windows/install-certificate)
|
||||||
|
- Proxyman localhost troubleshooting: [https://docs.proxyman.com/troubleshooting/couldnt-see-any-request-from-localhost-server](https://docs.proxyman.com/troubleshooting/couldnt-see-any-request-from-localhost-server)
|
||||||
|
- Proxyman SSL troubleshooting: [https://docs.proxyman.com/troubleshooting/get-ssl-error-from-https-request-and-response](https://docs.proxyman.com/troubleshooting/get-ssl-error-from-https-request-and-response)
|
||||||
@@ -31,7 +31,7 @@ export default defineConfig([
|
|||||||
'unused-imports': unusedImports,
|
'unused-imports': unusedImports,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'@typescript-eslint/no-explicit-any': 'off',
|
'@typescript-eslint/no-explicit-any': 'warn',
|
||||||
'@typescript-eslint/no-unused-vars': 'off',
|
'@typescript-eslint/no-unused-vars': 'off',
|
||||||
'@typescript-eslint/no-empty-object-type': 'off',
|
'@typescript-eslint/no-empty-object-type': 'off',
|
||||||
'@typescript-eslint/ban-ts-comment': 'off',
|
'@typescript-eslint/ban-ts-comment': 'off',
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { execSync } from 'child_process';
|
||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
import { FuseV1Options, FuseVersion } from '@electron/fuses';
|
import { FuseV1Options, FuseVersion } from '@electron/fuses';
|
||||||
import type {
|
import type {
|
||||||
@@ -9,7 +10,6 @@ import type {
|
|||||||
import { MakerDeb } from '@electron-forge/maker-deb';
|
import { MakerDeb } from '@electron-forge/maker-deb';
|
||||||
import { MakerDMG } from '@electron-forge/maker-dmg';
|
import { MakerDMG } from '@electron-forge/maker-dmg';
|
||||||
import { MakerRpm } from '@electron-forge/maker-rpm';
|
import { MakerRpm } from '@electron-forge/maker-rpm';
|
||||||
import { MakerSquirrel } from '@electron-forge/maker-squirrel';
|
|
||||||
import { MakerWix } from '@electron-forge/maker-wix';
|
import { MakerWix } from '@electron-forge/maker-wix';
|
||||||
import { MakerZIP } from '@electron-forge/maker-zip';
|
import { MakerZIP } from '@electron-forge/maker-zip';
|
||||||
import { AutoUnpackNativesPlugin } from '@electron-forge/plugin-auto-unpack-natives';
|
import { AutoUnpackNativesPlugin } from '@electron-forge/plugin-auto-unpack-natives';
|
||||||
@@ -17,15 +17,25 @@ import { FusesPlugin } from '@electron-forge/plugin-fuses';
|
|||||||
import { VitePlugin } from '@electron-forge/plugin-vite';
|
import { VitePlugin } from '@electron-forge/plugin-vite';
|
||||||
import type { ForgeConfig } from '@electron-forge/shared-types';
|
import type { ForgeConfig } from '@electron-forge/shared-types';
|
||||||
import MakerAppImage from '@pengx17/electron-forge-maker-appimage';
|
import MakerAppImage from '@pengx17/electron-forge-maker-appimage';
|
||||||
|
// @ts-ignore
|
||||||
import setLanguages from 'electron-packager-languages';
|
import setLanguages from 'electron-packager-languages';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { stringify as yamlStringify } from 'yaml';
|
import { stringify as yamlStringify } from 'yaml';
|
||||||
|
|
||||||
const nativeModules = ['better-sqlite3', 'keytar', 'bindings', 'file-uri-to-path'];
|
const nativeModules = ['better-sqlite3', 'keytar', 'bindings', 'file-uri-to-path'];
|
||||||
const ResolvedMakerAppImage = MakerAppImage;
|
const ResolvedMakerAppImage: any = (MakerAppImage as any).default || MakerAppImage;
|
||||||
const keepLanguages = new Set(['en', 'en-US', 'zh-CN', 'ru']);
|
const keepLanguages = new Set(['en', 'en-US', 'zh-CN', 'ru']);
|
||||||
const windowsExecutableName = 'antigravity-manager';
|
const windowsExecutableName = 'gemini-nexus';
|
||||||
|
|
||||||
|
function isWixAvailable(): boolean {
|
||||||
|
try {
|
||||||
|
execSync('candle -?', { stdio: 'ignore' });
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const isStartCommand = process.argv.some((arg) => arg.includes('start'));
|
const isStartCommand = process.argv.some((arg) => arg.includes('start'));
|
||||||
|
|
||||||
@@ -176,25 +186,8 @@ function getChecksumArchLabel(platform: string, arch: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const appImageMaker = new ResolvedMakerAppImage({
|
const appImageMaker = new ResolvedMakerAppImage({
|
||||||
config: {
|
options: {
|
||||||
icons: [
|
icon: 'images/128x128.png',
|
||||||
{
|
|
||||||
file: 'images/32x32.png',
|
|
||||||
size: 32,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
file: 'images/64x64.png',
|
|
||||||
size: 64,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
file: 'images/128x128.png',
|
|
||||||
size: 128,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
file: 'images/[email protected]',
|
|
||||||
size: 256,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
appImageMaker.name = '@pengx17/electron-forge-maker-appimage';
|
appImageMaker.name = '@pengx17/electron-forge-maker-appimage';
|
||||||
@@ -204,7 +197,7 @@ const config: ForgeConfig = {
|
|||||||
asar: {
|
asar: {
|
||||||
unpack: '**/{better-sqlite3,keytar}/**/*',
|
unpack: '**/{better-sqlite3,keytar}/**/*',
|
||||||
},
|
},
|
||||||
name: 'Antigravity Manager',
|
name: 'Gemini Nexus',
|
||||||
executableName: windowsExecutableName,
|
executableName: windowsExecutableName,
|
||||||
icon: 'images/icon', // Electron Forge automatically adds .icns/.ico
|
icon: 'images/icon', // Electron Forge automatically adds .icns/.ico
|
||||||
extraResource: ['src/assets'], // Copy assets folder to resources/assets
|
extraResource: ['src/assets'], // Copy assets folder to resources/assets
|
||||||
@@ -447,12 +440,7 @@ const config: ForgeConfig = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
makers: [
|
makers: [
|
||||||
new MakerSquirrel({
|
...(process.platform === 'win32' && process.arch === 'x64' && isWixAvailable()
|
||||||
setupIcon: 'images/icon.ico',
|
|
||||||
iconUrl:
|
|
||||||
'https://raw.githubusercontent.com/Draculabo/AntigravityManager/main/images/icon.ico',
|
|
||||||
}),
|
|
||||||
...(process.platform === 'win32' && process.arch === 'x64'
|
|
||||||
? [
|
? [
|
||||||
new MakerWix({
|
new MakerWix({
|
||||||
language: 1033,
|
language: 1033,
|
||||||
@@ -470,7 +458,7 @@ const config: ForgeConfig = {
|
|||||||
},
|
},
|
||||||
['darwin'],
|
['darwin'],
|
||||||
),
|
),
|
||||||
new MakerZIP({}, ['darwin']),
|
new MakerZIP({}, ['darwin', 'win32']),
|
||||||
appImageMaker,
|
appImageMaker,
|
||||||
new MakerRpm({}),
|
new MakerRpm({}),
|
||||||
new MakerDeb({}),
|
new MakerDeb({}),
|
||||||
@@ -484,8 +472,8 @@ const config: ForgeConfig = {
|
|||||||
name: '@electron-forge/publisher-github',
|
name: '@electron-forge/publisher-github',
|
||||||
config: {
|
config: {
|
||||||
repository: {
|
repository: {
|
||||||
owner: 'Draculabo',
|
owner: 'evandrodevbr',
|
||||||
name: 'AntigravityManager',
|
name: 'GeminiNexus',
|
||||||
},
|
},
|
||||||
draft: true,
|
draft: true,
|
||||||
prerelease: false,
|
prerelease: false,
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 889 B After Width: | Height: | Size: 1001 B |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 353 KiB After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 864 B After Width: | Height: | Size: 1001 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 353 KiB After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 736 KiB |
|
Before Width: | Height: | Size: 659 B After Width: | Height: | Size: 436 B |
@@ -2,7 +2,8 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<title>Antigravity Manager</title>
|
<title>Gemini Nexus</title>
|
||||||
|
<link rel="icon" type="image/png" href="/src/assets/icon.png" />
|
||||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self';" />
|
<meta http-equiv="Content-Security-Policy" content="script-src 'self';" />
|
||||||
<link rel="stylesheet" href="/src/styles/global.css" />
|
<link rel="stylesheet" href="/src/styles/global.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
- Affected code:
|
- Affected code:
|
||||||
- `src/ipc/database/cloudHandler.ts`
|
- `src/ipc/database/cloudHandler.ts`
|
||||||
- `src/ipc/database/handler.ts`
|
- `src/ipc/database/handler.ts`
|
||||||
- `src/utils/antigravityVersion.ts`
|
- `src/utils/geminiNexusVersion.ts`
|
||||||
- `src/utils/paths.ts` (this stage covers default runtime configuration path only)
|
- `src/utils/paths.ts` (this stage covers default runtime configuration path only)
|
||||||
- `src/types/db.ts`
|
- `src/types/db.ts`
|
||||||
|
|
||||||
|
|||||||
@@ -38,5 +38,5 @@ The system SHALL use a strategy pattern to split new/legacy/dual-write injection
|
|||||||
The system SHALL prefer new-format injection when new-format keys are detected.
|
The system SHALL prefer new-format injection when new-format keys are detected.
|
||||||
|
|
||||||
#### Scenario: New-format key exists
|
#### Scenario: New-format key exists
|
||||||
- **WHEN** `antigravityUnifiedStateSync.oauthToken` exists
|
- **WHEN** `geminiNexusUnifiedStateSync.oauthToken` exists
|
||||||
- **THEN** injection uses new format with higher priority
|
- **THEN** injection uses new format with higher priority
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
Add multilingual support to Antigravity Manager and automatically set the default UI language based on the user's OS language. If the OS language is unsupported, fall back to English. This includes updating i18n configuration, adding Chinese translation resources, and integrating a language detection plugin.
|
Add multilingual support to Gemini Nexus and automatically set the default UI language based on the user's OS language. If the OS language is unsupported, fall back to English. This includes updating i18n configuration, adding Chinese translation resources, and integrating a language detection plugin.
|
||||||
|
|
||||||
## Motivation
|
## Motivation
|
||||||
|
|
||||||
|
|||||||
@@ -2,32 +2,32 @@
|
|||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
Enable Antigravity Manager running in WSL (Windows Subsystem for Linux) to manage the Antigravity application installed on the Windows host.
|
Enable Gemini Nexus running in WSL (Windows Subsystem for Linux) to manage the Gemini Nexus application installed on the Windows host.
|
||||||
|
|
||||||
## Motivation
|
## Motivation
|
||||||
|
|
||||||
Users running the manager in a WSL development environment need to interact with the actual Antigravity instance running on Windows, as Antigravity is a Windows application.
|
Users running the manager in a WSL development environment need to interact with the actual Gemini Nexus instance running on Windows, as Gemini Nexus is a Windows application.
|
||||||
|
|
||||||
## Proposed Changes
|
## Proposed Changes
|
||||||
|
|
||||||
### 1. Path Resolution (`src/utils/paths.ts`)
|
### 1. Path Resolution (`src/utils/paths.ts`)
|
||||||
|
|
||||||
* Implement `isWsl()` utility function.
|
* Implement `isWsl()` utility function.
|
||||||
* In `getAppDataDir()`: If WSL, return the Windows AppData path (e.g., `/mnt/c/Users/<User>/AppData/Roaming/Antigravity`).
|
* In `getAppDataDir()`: If WSL, return the Windows AppData path (e.g., `/mnt/c/Users/<User>/AppData/Roaming/GeminiNexus`).
|
||||||
* In `getAntigravityExecutablePath()`: If WSL, return the Windows executable path (e.g., `/mnt/c/Users/<User>/AppData/Local/Programs/Antigravity/Antigravity.exe`).
|
* In `getGeminiNexusExecutablePath()`: If WSL, return the Windows executable path (e.g., `/mnt/c/Users/<User>/AppData/Local/Programs/GeminiNexus/GeminiNexus.exe`).
|
||||||
* **Challenge:** Determining the correct Windows username.
|
* **Challenge:** Determining the correct Windows username.
|
||||||
* **Strategy:** Assume Windows username matches WSL username, or scan `/mnt/c/Users` for a likely candidate (excluding Public, Default, etc.).
|
* **Strategy:** Assume Windows username matches WSL username, or scan `/mnt/c/Users` for a likely candidate (excluding Public, Default, etc.).
|
||||||
|
|
||||||
### 2. Process Management (`src/ipc/process/handler.ts`)
|
### 2. Process Management (`src/ipc/process/handler.ts`)
|
||||||
|
|
||||||
* In `isProcessRunning()`: If WSL, execute `tasklist.exe` (via `/mnt/c/Windows/System32/tasklist.exe`) to check for `Antigravity.exe`.
|
* In `isProcessRunning()`: If WSL, execute `tasklist.exe` (via `/mnt/c/Windows/System32/tasklist.exe`) to check for `GeminiNexus.exe`.
|
||||||
* In `startAntigravity()`: If WSL, execute the Windows executable directly.
|
* In `startGeminiNexus()`: If WSL, execute the Windows executable directly.
|
||||||
* In `closeAntigravity()`: If WSL, use `taskkill.exe` (via `/mnt/c/Windows/System32/taskkill.exe`).
|
* In `closeGeminiNexus()`: If WSL, use `taskkill.exe` (via `/mnt/c/Windows/System32/taskkill.exe`).
|
||||||
|
|
||||||
## Acceptance Criteria
|
## Acceptance Criteria
|
||||||
|
|
||||||
* \[ ] Application detects it is running in WSL.
|
* \[ ] Application detects it is running in WSL.
|
||||||
* \[ ] Database file is correctly located on the Windows file system.
|
* \[ ] Database file is correctly located on the Windows file system.
|
||||||
* \[ ] "Start" button successfully launches Antigravity on Windows.
|
* \[ ] "Start" button successfully launches Gemini Nexus on Windows.
|
||||||
* \[ ] "Stop" button successfully terminates Antigravity on Windows.
|
* \[ ] "Stop" button successfully terminates Gemini Nexus on Windows.
|
||||||
* \[ ] Process status (Running/Stopped) is correctly reflected in the UI.
|
* \[ ] Process status (Running/Stopped) is correctly reflected in the UI.
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
## ADDED Requirements
|
## ADDED Requirements
|
||||||
### Requirement: New-Format Injection for 1.16.5+
|
### Requirement: New-Format Injection for 1.16.5+
|
||||||
The system SHALL write only the new format `antigravityUnifiedStateSync.oauthToken` when IDE version is >= 1.16.5.
|
The system SHALL write only the new format `geminiNexusUnifiedStateSync.oauthToken` when IDE version is >= 1.16.5.
|
||||||
|
|
||||||
#### Scenario: New-version injection
|
#### Scenario: New-version injection
|
||||||
- **WHEN** IDE version is 1.16.5 or above
|
- **WHEN** IDE version is 1.16.5 or above
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
## Purpose
|
## Purpose
|
||||||
|
|
||||||
Antigravity Manager is a comprehensive enhancement tool for Antigravity, designed to remove AI development resource limits. It not only solves the lack of native multi-account switching in Antigravity IDE, but also introduces enterprise-grade AI account pool management. By taking control of app configuration state and cloud API resources, it allows users to switch seamlessly between unlimited local accounts and cloud AI services for an effectively "unlimited" AI usage experience.
|
Gemini Nexus is a comprehensive enhancement tool for Gemini Nexus, designed to remove AI development resource limits. It not only solves the lack of native multi-account switching in Gemini Nexus IDE, but also introduces enterprise-grade AI account pool management. By taking control of app configuration state and cloud API resources, it allows users to switch seamlessly between unlimited local accounts and cloud AI services for an effectively "unlimited" AI usage experience.
|
||||||
|
|
||||||
**Core goals:**
|
**Core goals:**
|
||||||
|
|
||||||
* **Local multi-account switching**: Seamlessly switch Antigravity IDE local user state while protecting data integrity (automatic backup).
|
* **Local multi-account switching**: Seamlessly switch Gemini Nexus IDE local user state while protecting data integrity (automatic backup).
|
||||||
* **AI resource pool management (new)**: Centrally manage account pools for Google Gemini, Claude 3.5, and similar services.
|
* **AI resource pool management (new)**: Centrally manage account pools for Google Gemini, Claude 3.5, and similar services.
|
||||||
* **Intelligent quota monitoring (new)**: Monitor API quota and health in real time with a visual dashboard.
|
* **Intelligent quota monitoring (new)**: Monitor API quota and health in real time with a visual dashboard.
|
||||||
* **Automatic resource scheduling (new)**: Automatically switch to the best available account when the current one runs out of quota (token keepalive + polling).
|
* **Automatic resource scheduling (new)**: Automatically switch to the best available account when the current one runs out of quota (token keepalive + polling).
|
||||||
@@ -88,17 +88,17 @@ src/
|
|||||||
|
|
||||||
## Domain Context
|
## Domain Context
|
||||||
|
|
||||||
### 1. Antigravity IDE Data Structure (Local)
|
### 1. Gemini Nexus IDE Data Structure (Local)
|
||||||
|
|
||||||
**Database locations:**
|
**Database locations:**
|
||||||
|
|
||||||
* macOS: `~/Library/Application Support/Antigravity/User/globalStorage/state.vscdb`
|
* macOS: `~/Library/Application Support/GeminiNexus/User/globalStorage/state.vscdb`
|
||||||
* Windows: `%APPDATA%/Antigravity/User/globalStorage/state.vscdb`
|
* Windows: `%APPDATA%/GeminiNexus/User/globalStorage/state.vscdb`
|
||||||
* Linux: `~/.config/Antigravity/User/globalStorage/state.vscdb`
|
* Linux: `~/.config/GeminiNexus/User/globalStorage/state.vscdb`
|
||||||
|
|
||||||
**Key database fields:**
|
**Key database fields:**
|
||||||
|
|
||||||
* `antigravityAuthStatus`: Authentication status and user information.
|
* `geminiNexusAuthStatus`: Authentication status and user information.
|
||||||
|
|
||||||
### 2. AI Service Resource Structure (Cloud / New)
|
### 2. AI Service Resource Structure (Cloud / New)
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ src/
|
|||||||
|
|
||||||
### System Dependencies
|
### System Dependencies
|
||||||
|
|
||||||
* **Antigravity IDE**: Local target to manage.
|
* **Gemini Nexus IDE**: Local target to manage.
|
||||||
* **SQLite**: Local data reads.
|
* **SQLite**: Local data reads.
|
||||||
|
|
||||||
### Node.js Dependencies (Key)
|
### Node.js Dependencies (Key)
|
||||||
@@ -159,7 +159,7 @@ src/
|
|||||||
|
|
||||||
### Filesystem Dependencies
|
### Filesystem Dependencies
|
||||||
|
|
||||||
* `~/.antigravity-agent/`
|
* `~/.geminiNexus-agent/`
|
||||||
* `accounts.json`: Local IDE account index.
|
* `accounts.json`: Local IDE account index.
|
||||||
* `cloud_accounts.db`: (new) Cloud account pool database (SQLite).
|
* `cloud_accounts.db`: (new) Cloud account pool database (SQLite).
|
||||||
* `backups/`: Backup files.
|
* `backups/`: Backup files.
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
{
|
{
|
||||||
"name": "antigravity-manager",
|
"name": "gemini-nexus",
|
||||||
"productName": "Antigravity Manager",
|
"productName": "Gemini Nexus",
|
||||||
"version": "0.10.0",
|
"version": "0.15.3",
|
||||||
"description": "Antigravity Manager - Electron App",
|
"description": "Gemini Nexus - Electron App",
|
||||||
"main": ".vite/build/main.js",
|
"main": ".vite/build/main.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"packageManager": "[email protected]",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron-forge start",
|
"start": "cross-env DEBUG=electron-forge:* electron-forge start",
|
||||||
|
"dev": "cross-env DEBUG=electron-forge:* electron-forge start",
|
||||||
"package": "electron-forge package",
|
"package": "electron-forge package",
|
||||||
"make": "electron-forge make",
|
"make": "electron-forge make",
|
||||||
|
"make:win": "node scripts/build-windows.js",
|
||||||
"publish": "electron-forge publish",
|
"publish": "electron-forge publish",
|
||||||
|
"setup": "node scripts/setup-dev.js",
|
||||||
|
"postinstall": "node scripts/setup-dev.js --check-only",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"format": "prettier --check .",
|
"format": "prettier --check .",
|
||||||
"format:write": "prettier --write .",
|
"format:write": "prettier --write .",
|
||||||
@@ -20,33 +25,33 @@
|
|||||||
"test:all": "vitest run && playwright test",
|
"test:all": "vitest run && playwright test",
|
||||||
"type-check": "tsc --noEmit"
|
"type-check": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"author": "Draculabo",
|
"author": "evandrodevbr",
|
||||||
"license": "CC-BY-NC-SA-4.0",
|
"license": "CC-BY-NC-SA-4.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@electron-forge/cli": "^7.10.2",
|
"@electron-forge/cli": "^7.6.1",
|
||||||
"@electron-forge/maker-deb": "^7.10.2",
|
"@electron-forge/maker-deb": "^7.11.1",
|
||||||
"@electron-forge/maker-dmg": "^7.10.2",
|
"@electron-forge/maker-dmg": "^7.11.1",
|
||||||
"@electron-forge/maker-rpm": "^7.10.2",
|
"@electron-forge/maker-rpm": "^7.11.1",
|
||||||
"@electron-forge/maker-squirrel": "^7.10.2",
|
"@electron-forge/maker-wix": "^7.9.0",
|
||||||
"@electron-forge/maker-wix": "^7.10.2",
|
"@electron-forge/maker-zip": "^7.11.1",
|
||||||
"@electron-forge/maker-zip": "^7.10.2",
|
"@electron-forge/plugin-auto-unpack-natives": "^7.11.1",
|
||||||
"@electron-forge/plugin-auto-unpack-natives": "^7.10.2",
|
"@electron-forge/plugin-fuses": "^7.11.1",
|
||||||
"@electron-forge/plugin-fuses": "^7.10.2",
|
"@electron-forge/plugin-vite": "^7.11.1",
|
||||||
"@electron-forge/plugin-vite": "^7.10.2",
|
"@electron-forge/publisher-github": "^7.11.1",
|
||||||
"@electron-forge/publisher-github": "^7.10.2",
|
"@electron-forge/shared-types": "^7.11.1",
|
||||||
"@electron-forge/shared-types": "^7.8.1",
|
|
||||||
"@electron/fuses": "~1.8.0",
|
"@electron/fuses": "~1.8.0",
|
||||||
"@electron/rebuild": "^3.7.1",
|
"@electron/rebuild": "^3.7.1",
|
||||||
"@eslint/compat": "^1.4.1",
|
"@eslint/compat": "^1.4.1",
|
||||||
"@eslint/js": "^9.39.0",
|
"@eslint/js": "^9.39.0",
|
||||||
"@pengx17/electron-forge-maker-appimage": "^1.2.1",
|
"@pengx17/electron-forge-maker-appimage": "^1.0.2",
|
||||||
"@playwright/test": "^1.56.1",
|
"@playwright/test": "^1.56.1",
|
||||||
|
"@rolldown/plugin-babel": "^0.2.3",
|
||||||
"@semantic-release/changelog": "^6.0.3",
|
"@semantic-release/changelog": "^6.0.3",
|
||||||
"@semantic-release/git": "^10.0.1",
|
"@semantic-release/git": "^10.0.1",
|
||||||
"@semantic-release/github": "^12.0.2",
|
"@semantic-release/github": "^12.0.6",
|
||||||
"@sentry/vite-plugin": "^4.8.0",
|
"@sentry/vite-plugin": "^4.8.0",
|
||||||
"@swc/core": "^1.15.8",
|
"@swc/core": "^1.15.8",
|
||||||
"@tailwindcss/vite": "^4.1.17",
|
"@tailwindcss/vite": "^4.2.4",
|
||||||
"@tanstack/router-plugin": "^1.135.0",
|
"@tanstack/router-plugin": "^1.135.0",
|
||||||
"@testing-library/jest-dom": "^6.9.1",
|
"@testing-library/jest-dom": "^6.9.1",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@testing-library/react": "^16.3.0",
|
||||||
@@ -58,11 +63,12 @@
|
|||||||
"@types/node": "^24.10.1",
|
"@types/node": "^24.10.1",
|
||||||
"@types/react": "^19.2.2",
|
"@types/react": "^19.2.2",
|
||||||
"@types/react-dom": "^19.2.2",
|
"@types/react-dom": "^19.2.2",
|
||||||
"@vitejs/plugin-react": "^4.7.0",
|
"@vitejs/plugin-react": "^6.0.1",
|
||||||
"babel-plugin-react-compiler": "1.0.0",
|
"babel-plugin-react-compiler": "1.0.0",
|
||||||
"code-inspector-plugin": "^1.3.3",
|
"code-inspector-plugin": "^1.3.3",
|
||||||
"conventional-changelog-conventionalcommits": "^9.1.0",
|
"conventional-changelog-conventionalcommits": "^9.1.0",
|
||||||
"electron": "^37.3.1",
|
"cross-env": "^10.1.0",
|
||||||
|
"electron": "^41.3.0",
|
||||||
"electron-devtools-installer": "^4.0.0",
|
"electron-devtools-installer": "^4.0.0",
|
||||||
"electron-packager-languages": "^0.6.0",
|
"electron-packager-languages": "^0.6.0",
|
||||||
"electron-playwright-helpers": "^1.8.2",
|
"electron-playwright-helpers": "^1.8.2",
|
||||||
@@ -73,12 +79,14 @@
|
|||||||
"eslint-plugin-react-hooks": "^7.0.1",
|
"eslint-plugin-react-hooks": "^7.0.1",
|
||||||
"eslint-plugin-unused-imports": "^4.4.1",
|
"eslint-plugin-unused-imports": "^4.4.1",
|
||||||
"globals": "^16.5.0",
|
"globals": "^16.5.0",
|
||||||
|
"happy-dom": "^20.8.9",
|
||||||
"icon-gen": "^5.0.0",
|
"icon-gen": "^5.0.0",
|
||||||
"jsdom": "^27.1.0",
|
"jsdom": "^27.1.0",
|
||||||
|
"node-abi": "^4.28.0",
|
||||||
"node-addon-api": "^8.3.1",
|
"node-addon-api": "^8.3.1",
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.6.2",
|
||||||
"prettier-plugin-tailwindcss": "^0.7.1",
|
"prettier-plugin-tailwindcss": "^0.7.1",
|
||||||
"semantic-release": "^25.0.2",
|
"semantic-release": "^25.0.3",
|
||||||
"semantic-release-config-gitmoji": "^1.5.3",
|
"semantic-release-config-gitmoji": "^1.5.3",
|
||||||
"sharp": "^0.34.5",
|
"sharp": "^0.34.5",
|
||||||
"tailwindcss": "^4.1.16",
|
"tailwindcss": "^4.1.16",
|
||||||
@@ -86,20 +94,24 @@
|
|||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"typescript-eslint": "^8.46.3",
|
"typescript-eslint": "^8.46.3",
|
||||||
"unplugin-swc": "^1.5.9",
|
"unplugin-swc": "^1.5.9",
|
||||||
"vite": "^5.4.21",
|
"vite": "^8.0.10",
|
||||||
|
"vite-tsconfig-paths": "^6.1.1",
|
||||||
"vitest": "^4.0.8"
|
"vitest": "^4.0.8"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@grpc/grpc-js": "^1.14.3",
|
|
||||||
"@grpc/proto-loader": "^0.8.0",
|
|
||||||
"@icons-pack/react-simple-icons": "^13.8.0",
|
"@icons-pack/react-simple-icons": "^13.8.0",
|
||||||
"@nestjs/common": "^11.1.10",
|
"@nestjs/common": "^11.1.18",
|
||||||
"@nestjs/core": "^11.1.10",
|
"@nestjs/core": "^11.1.18",
|
||||||
"@nestjs/microservices": "^11.1.11",
|
"@nestjs/microservices": "^11.1.18",
|
||||||
"@nestjs/platform-express": "^11.1.11",
|
"@nestjs/platform-express": "^11.1.18",
|
||||||
"@nestjs/platform-fastify": "^11.1.10",
|
"@nestjs/platform-fastify": "^11.0.20",
|
||||||
"@orpc/client": "^1.10.4",
|
"@nestjs/websockets": "^11.1.19",
|
||||||
"@orpc/server": "^1.11.3",
|
"@nivo/bar": "^0.99.0",
|
||||||
|
"@nivo/core": "^0.99.0",
|
||||||
|
"@nivo/line": "^0.99.0",
|
||||||
|
"@nivo/pie": "^0.99.0",
|
||||||
|
"@orpc/client": "^1.13.14",
|
||||||
|
"@orpc/server": "^1.13.14",
|
||||||
"@radix-ui/react-avatar": "^1.1.11",
|
"@radix-ui/react-avatar": "^1.1.11",
|
||||||
"@radix-ui/react-checkbox": "^1.3.3",
|
"@radix-ui/react-checkbox": "^1.3.3",
|
||||||
"@radix-ui/react-dialog": "^1.1.15",
|
"@radix-ui/react-dialog": "^1.1.15",
|
||||||
@@ -120,23 +132,22 @@
|
|||||||
"@tanstack/react-query": "^5.90.7",
|
"@tanstack/react-query": "^5.90.7",
|
||||||
"@tanstack/react-router": "^1.139.3",
|
"@tanstack/react-router": "^1.139.3",
|
||||||
"@tanstack/react-router-devtools": "^1.135.0",
|
"@tanstack/react-router-devtools": "^1.135.0",
|
||||||
"@types/uuid": "^11.0.0",
|
"axios": "^1.15.0",
|
||||||
"axios": "^1.13.2",
|
|
||||||
"better-sqlite3": "^12.4.6",
|
"better-sqlite3": "^12.4.6",
|
||||||
"class-transformer": "^0.5.1",
|
"class-transformer": "^0.5.1",
|
||||||
"class-validator": "^0.14.3",
|
"class-validator": "^0.14.3",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
"drizzle-orm": "^0.39.1",
|
"drizzle-orm": "^0.45.2",
|
||||||
"electron-squirrel-startup": "^1.0.1",
|
"electron-squirrel-startup": "^1.0.1",
|
||||||
"fastify": "^5.6.2",
|
"fastify": "^5.8.5",
|
||||||
"find-process": "^2.0.0",
|
"find-process": "^2.0.0",
|
||||||
"happy-dom": "^20.0.10",
|
"gpt-tokenizer": "^3.4.0",
|
||||||
"i18next": "^25.6.3",
|
"i18next": "^25.6.3",
|
||||||
"i18next-browser-languagedetector": "^8.2.0",
|
"i18next-browser-languagedetector": "^8.2.0",
|
||||||
"keytar": "^7.9.0",
|
"keytar": "^7.9.0",
|
||||||
"lodash-es": "^4.17.22",
|
"lodash-es": "^4.18.1",
|
||||||
"lucide-react": "^0.553.0",
|
"lucide-react": "^0.553.0",
|
||||||
"react": "^19.2.0",
|
"react": "^19.2.0",
|
||||||
"react-dom": "^19.2.0",
|
"react-dom": "^19.2.0",
|
||||||
@@ -148,10 +159,53 @@
|
|||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"undici": "^7.16.0",
|
"undici": "^7.16.0",
|
||||||
"update-electron-app": "^3.1.1",
|
"update-electron-app": "^3.1.1",
|
||||||
"uuid": "^13.0.0",
|
"uuid": "^14.0.0",
|
||||||
"winston": "^3.19.0",
|
"winston": "^3.19.0",
|
||||||
"winston-daily-rotate-file": "^5.0.0",
|
"winston-daily-rotate-file": "^5.0.0",
|
||||||
"yaml": "^2.8.2",
|
"yaml": "^2.8.2",
|
||||||
"zod": "^4.1.12"
|
"zod": "^4.1.12"
|
||||||
|
},
|
||||||
|
"trustedDependencies": [
|
||||||
|
"@bitdisaster/exe-icon-extractor",
|
||||||
|
"@nestjs/core",
|
||||||
|
"@sentry/cli",
|
||||||
|
"@swc/core",
|
||||||
|
"protobufjs",
|
||||||
|
"macos-alias",
|
||||||
|
"better-sqlite3",
|
||||||
|
"keytar",
|
||||||
|
"electron",
|
||||||
|
"electron-winstaller",
|
||||||
|
"esbuild",
|
||||||
|
"fs-xattr",
|
||||||
|
"appdmg"
|
||||||
|
],
|
||||||
|
"pnpm": {
|
||||||
|
"onlyBuiltDependencies": [
|
||||||
|
"@bitdisaster/exe-icon-extractor",
|
||||||
|
"@nestjs/core",
|
||||||
|
"@sentry/cli",
|
||||||
|
"@swc/core",
|
||||||
|
"protobufjs",
|
||||||
|
"macos-alias",
|
||||||
|
"better-sqlite3",
|
||||||
|
"keytar",
|
||||||
|
"electron",
|
||||||
|
"electron-winstaller",
|
||||||
|
"esbuild",
|
||||||
|
"fs-xattr",
|
||||||
|
"appdmg"
|
||||||
|
],
|
||||||
|
"overrides": {
|
||||||
|
"node-abi": "^4.28.0",
|
||||||
|
"fastify": "^5.8.5",
|
||||||
|
"tar": "^7.5.13",
|
||||||
|
"@octokit/request-error": "^5.1.1",
|
||||||
|
"@octokit/plugin-paginate-rest": "^9.2.2",
|
||||||
|
"@octokit/request": "^8.4.1",
|
||||||
|
"tmp": "^0.2.4",
|
||||||
|
"@tootallnate/once": "^3.0.1",
|
||||||
|
"esbuild": "^0.25.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
allowBuilds:
|
||||||
|
'@bitdisaster/exe-icon-extractor': true
|
||||||
|
'@nestjs/core': true
|
||||||
|
'@sentry/cli': true
|
||||||
|
'@swc/core': true
|
||||||
|
better-sqlite3: true
|
||||||
|
electron: true
|
||||||
|
electron-winstaller: true
|
||||||
|
esbuild: true
|
||||||
|
keytar: true
|
||||||
|
macos-alias: true
|
||||||
|
protobufjs: true
|
||||||
|
sharp: true
|
||||||
|
fs-xattr: true
|
||||||
|
appdmg: true
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* instead of Gitmoji (since the project history doesn't use emojis).
|
* instead of Gitmoji (since the project history doesn't use emojis).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const REPO_URL = 'https://github.com/Draculabo/AntigravityManager';
|
const REPO_URL = 'https://github.com/evandrodevbr/GeminiNexus';
|
||||||
const GITHUB_BASE_URL = 'https://github.com';
|
const GITHUB_BASE_URL = 'https://github.com';
|
||||||
const FULL_CHANGELOG_URL = `${REPO_URL}/blob/main/CHANGELOG.md`;
|
const FULL_CHANGELOG_URL = `${REPO_URL}/blob/main/CHANGELOG.md`;
|
||||||
|
|
||||||
@@ -244,8 +244,8 @@ const releaseConfig = {
|
|||||||
[
|
[
|
||||||
'@semantic-release/git',
|
'@semantic-release/git',
|
||||||
{
|
{
|
||||||
assets: ['CHANGELOG.md', 'package.json', 'package-lock.json', 'npm-shrinkwrap.json'],
|
assets: ['CHANGELOG.md', 'package.json', 'pnpm-lock.yaml'],
|
||||||
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
|
message: 'chore(release): ${nextRelease.version}\n\n${nextRelease.notes}',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
@echo off
|
|
||||||
set PYTHONPATH=%~dp0
|
|
||||||
python -m cli.main %*
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
|
const { execSync, spawn } = require('child_process');
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const WIX_ZIP = path.join(process.cwd(), 'wix314-binaries.zip');
|
||||||
|
const WIX_DIR = path.join(process.cwd(), 'tools', 'wix314');
|
||||||
|
|
||||||
|
function extractWix() {
|
||||||
|
if (!fs.existsSync(WIX_ZIP)) {
|
||||||
|
console.error(`WiX zip not found: ${WIX_ZIP}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs.existsSync(WIX_DIR)) {
|
||||||
|
console.log(`WiX already extracted at ${WIX_DIR}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Extracting WiX binaries to ${WIX_DIR}...`);
|
||||||
|
fs.mkdirSync(WIX_DIR, { recursive: true });
|
||||||
|
|
||||||
|
// Use PowerShell Expand-Archive (built into Windows)
|
||||||
|
const psCommand = `Expand-Archive -Path "${WIX_ZIP}" -DestinationPath "${WIX_DIR}" -Force`;
|
||||||
|
execSync(psCommand, { shell: 'powershell.exe', stdio: 'inherit' });
|
||||||
|
|
||||||
|
console.log('WiX extraction complete.');
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupWixPath() {
|
||||||
|
// electron-wix-msi's detect-wix.js runs execSync('candle -?') which relies on PATH
|
||||||
|
process.env.PATH = `${WIX_DIR};${process.env.PATH}`;
|
||||||
|
console.log(`Added ${WIX_DIR} to PATH`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function runMake() {
|
||||||
|
console.log('Running electron-forge make...');
|
||||||
|
const make = spawn('npx', ['electron-forge', 'make'], {
|
||||||
|
stdio: 'inherit',
|
||||||
|
shell: true,
|
||||||
|
env: process.env,
|
||||||
|
});
|
||||||
|
|
||||||
|
make.on('exit', (code) => {
|
||||||
|
process.exit(code ?? 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
extractWix();
|
||||||
|
setupWixPath();
|
||||||
|
runMake();
|
||||||
@@ -0,0 +1,670 @@
|
|||||||
|
/**
|
||||||
|
* Cross-platform development environment setup for Gemini Nexus.
|
||||||
|
*
|
||||||
|
* Detects and installs native build toolchains required by better-sqlite3,
|
||||||
|
* keytar, and other native Node.js modules used in this Electron project.
|
||||||
|
*
|
||||||
|
* Platforms:
|
||||||
|
* - Windows → Visual Studio 2022 Build Tools (C++ workload)
|
||||||
|
* - macOS → Xcode Command Line Tools
|
||||||
|
* - Ubuntu → build-essential, python3, libsecret-1-dev
|
||||||
|
* - Manjaro/Arch → base-devel, python, libsecret
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* node scripts/setup-dev.js # auto-detect and install/guide
|
||||||
|
* node scripts/setup-dev.js --check-only # only verify, don't install
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { execSync, spawnSync } = require('child_process');
|
||||||
|
const fs = require('fs');
|
||||||
|
const os = require('os');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
// ─── Terminal Color Helpers ─────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const RESET = '\x1b[0m';
|
||||||
|
const BOLD = '\x1b[1m';
|
||||||
|
const DIM = '\x1b[2m';
|
||||||
|
const RED = '\x1b[31m';
|
||||||
|
const GREEN = '\x1b[32m';
|
||||||
|
const YELLOW = '\x1b[33m';
|
||||||
|
const CYAN = '\x1b[36m';
|
||||||
|
const MAGENTA = '\x1b[35m';
|
||||||
|
|
||||||
|
// Disable colors if NO_COLOR is set or output is piped
|
||||||
|
const useColor = process.env.NO_COLOR === undefined && process.stdout.isTTY;
|
||||||
|
|
||||||
|
function color(code, text) {
|
||||||
|
return useColor ? `${code}${text}${RESET}` : text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function header(text) {
|
||||||
|
console.log(
|
||||||
|
`\n${color(BOLD + MAGENTA, '══')} ${color(BOLD, text)} ${color(BOLD + MAGENTA, '══')}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function success(text) {
|
||||||
|
console.log(` ${color(GREEN, '✓')} ${text}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function warn(text) {
|
||||||
|
console.log(` ${color(YELLOW, '⚠')} ${text}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function error(text) {
|
||||||
|
console.log(` ${color(RED, '✗')} ${text}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function info(text) {
|
||||||
|
console.log(` ${color(CYAN, '→')} ${text}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function dim(text) {
|
||||||
|
console.log(` ${color(DIM, text)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function section(title) {
|
||||||
|
console.log(`\n ${color(BOLD, title)}:`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Platform Detection ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const platform = os.platform(); // 'win32' | 'darwin' | 'linux'
|
||||||
|
const arch = os.arch();
|
||||||
|
|
||||||
|
/** Detect Linux distribution from os-release */
|
||||||
|
function detectLinuxDistro() {
|
||||||
|
try {
|
||||||
|
const osRelease = fs.readFileSync('/etc/os-release', 'utf8');
|
||||||
|
const idMatch = osRelease.match(/^ID="?([^"\n]+)"?/m);
|
||||||
|
const idLikeMatch = osRelease.match(/^ID_LIKE="?([^"\n]+)"?/m);
|
||||||
|
|
||||||
|
const id = idMatch ? idMatch[1].toLowerCase() : '';
|
||||||
|
const idLike = idLikeMatch ? idLikeMatch[1].toLowerCase() : '';
|
||||||
|
|
||||||
|
if (id === 'ubuntu' || id === 'debian' || idLike.includes('debian')) {
|
||||||
|
return 'debian';
|
||||||
|
}
|
||||||
|
if (id === 'arch' || id === 'manjaro' || idLike.includes('arch')) {
|
||||||
|
return 'arch';
|
||||||
|
}
|
||||||
|
if (id === 'fedora' || idLike.includes('fedora') || idLike.includes('rhel')) {
|
||||||
|
return 'fedora';
|
||||||
|
}
|
||||||
|
return id || 'unknown';
|
||||||
|
} catch {
|
||||||
|
return 'unknown';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Tool Checkers ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
/** Check if a command exists on PATH */
|
||||||
|
function commandExists(cmd) {
|
||||||
|
try {
|
||||||
|
const whereCmd = platform === 'win32' ? 'where' : 'which';
|
||||||
|
execSync(`${whereCmd} "${cmd}"`, { stdio: 'ignore' });
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Check if running with administrator/sudo privileges */
|
||||||
|
function hasAdminPrivileges() {
|
||||||
|
if (platform === 'win32') {
|
||||||
|
try {
|
||||||
|
// On Windows, check via net session (requires admin)
|
||||||
|
execSync('net session', { stdio: 'ignore' });
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// On Unix, check if UID is 0
|
||||||
|
return process.getuid ? process.getuid() === 0 : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Check Windows: Visual Studio Build Tools */
|
||||||
|
function checkWindows() {
|
||||||
|
const results = { ok: true, missing: [] };
|
||||||
|
|
||||||
|
// Check for cl.exe (C++ compiler from VS Build Tools)
|
||||||
|
if (commandExists('cl.exe')) {
|
||||||
|
success('MSVC Compiler (cl.exe) found');
|
||||||
|
} else {
|
||||||
|
// Try to find VS installation via vswhere or registry
|
||||||
|
let vsFound = false;
|
||||||
|
|
||||||
|
// vswhere.exe (shipped with VS 2017+)
|
||||||
|
const vswherePaths = [
|
||||||
|
'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe',
|
||||||
|
'C:\\Program Files\\Microsoft Visual Studio\\Installer\\vswhere.exe',
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const vswhere of vswherePaths) {
|
||||||
|
try {
|
||||||
|
const output = execSync(
|
||||||
|
`"${vswhere}" -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`,
|
||||||
|
{
|
||||||
|
stdio: ['ignore', 'pipe', 'ignore'],
|
||||||
|
encoding: 'utf8',
|
||||||
|
},
|
||||||
|
).trim();
|
||||||
|
|
||||||
|
if (output) {
|
||||||
|
vsFound = true;
|
||||||
|
success(`Visual Studio found at: ${output}`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// vswhere not found, continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check registry fallback
|
||||||
|
if (!vsFound) {
|
||||||
|
try {
|
||||||
|
execSync('reg query "HKLM\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7" /v 17.0', {
|
||||||
|
stdio: 'ignore',
|
||||||
|
});
|
||||||
|
vsFound = true;
|
||||||
|
success('Visual Studio 2022 found (registry)');
|
||||||
|
} catch {
|
||||||
|
// Not found in registry either
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!vsFound) {
|
||||||
|
error('MSVC Build Tools not found');
|
||||||
|
results.ok = false;
|
||||||
|
results.missing.push('msvc');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check Python (needed by node-gyp)
|
||||||
|
if (commandExists('python') || commandExists('python3')) {
|
||||||
|
success('Python found');
|
||||||
|
} else {
|
||||||
|
error('Python not found (required by node-gyp)');
|
||||||
|
results.ok = false;
|
||||||
|
results.missing.push('python');
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Check macOS: Xcode Command Line Tools */
|
||||||
|
function checkMacOS() {
|
||||||
|
const results = { ok: true, missing: [] };
|
||||||
|
|
||||||
|
try {
|
||||||
|
const xcodePath = execSync('xcode-select -p', {
|
||||||
|
stdio: ['ignore', 'pipe', 'ignore'],
|
||||||
|
encoding: 'utf8',
|
||||||
|
}).trim();
|
||||||
|
if (xcodePath) {
|
||||||
|
success(`Xcode CLT found at: ${xcodePath}`);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
error('Xcode Command Line Tools not found');
|
||||||
|
results.ok = false;
|
||||||
|
results.missing.push('xcode-clt');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (commandExists('make') || commandExists('gmake')) {
|
||||||
|
success('make found');
|
||||||
|
} else {
|
||||||
|
error('make not found');
|
||||||
|
results.ok = false;
|
||||||
|
results.missing.push('make');
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Check Linux: build-essential, python3, libsecret */
|
||||||
|
function checkLinux() {
|
||||||
|
const results = { ok: true, missing: [] };
|
||||||
|
const distro = detectLinuxDistro();
|
||||||
|
|
||||||
|
section(`Linux Distribution Detected: ${distro || 'unknown'}`);
|
||||||
|
|
||||||
|
// gcc / g++
|
||||||
|
if (commandExists('gcc') || commandExists('cc')) {
|
||||||
|
success('C compiler found');
|
||||||
|
} else {
|
||||||
|
error('C compiler not found');
|
||||||
|
results.ok = false;
|
||||||
|
results.missing.push('compiler');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (commandExists('g++') || commandExists('c++')) {
|
||||||
|
success('C++ compiler found');
|
||||||
|
} else {
|
||||||
|
error('C++ compiler not found');
|
||||||
|
results.ok = false;
|
||||||
|
results.missing.push('compiler');
|
||||||
|
}
|
||||||
|
|
||||||
|
// make
|
||||||
|
if (commandExists('make')) {
|
||||||
|
success('make found');
|
||||||
|
} else {
|
||||||
|
error('make not found');
|
||||||
|
results.ok = false;
|
||||||
|
results.missing.push('make');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Python 3
|
||||||
|
if (commandExists('python3')) {
|
||||||
|
success('Python 3 found');
|
||||||
|
} else if (commandExists('python')) {
|
||||||
|
// Check if python is python3
|
||||||
|
try {
|
||||||
|
const ver = execSync('python --version', { encoding: 'utf8' });
|
||||||
|
if (ver.includes('3.')) {
|
||||||
|
success('Python 3 found (as python)');
|
||||||
|
} else {
|
||||||
|
error('Python 3 not found (python is v2)');
|
||||||
|
results.ok = false;
|
||||||
|
results.missing.push('python3');
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
error('Python not found');
|
||||||
|
results.ok = false;
|
||||||
|
results.missing.push('python3');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
error('Python 3 not found');
|
||||||
|
results.ok = false;
|
||||||
|
results.missing.push('python3');
|
||||||
|
}
|
||||||
|
|
||||||
|
// libsecret (needed by keytar)
|
||||||
|
try {
|
||||||
|
if (distro === 'debian') {
|
||||||
|
execSync('dpkg -s libsecret-1-dev', { stdio: 'ignore' });
|
||||||
|
success('libsecret-1-dev found');
|
||||||
|
} else if (distro === 'arch') {
|
||||||
|
execSync('pacman -Qi libsecret', { stdio: 'ignore' });
|
||||||
|
success('libsecret found');
|
||||||
|
} else {
|
||||||
|
// Check for pkg-config
|
||||||
|
try {
|
||||||
|
execSync('pkg-config --exists libsecret-1', { stdio: 'ignore' });
|
||||||
|
success('libsecret (pkg-config) found');
|
||||||
|
} catch {
|
||||||
|
warn('libsecret not detected (may not be needed if using prebuilt keytar)');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
warn('libsecret not detected (may not be needed if using prebuilt keytar)');
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Installation Helpers ───────────────────────────────────────────────────
|
||||||
|
|
||||||
|
/** Run a command and stream output, return exit code */
|
||||||
|
function runCommand(cmd, args, opts = {}) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
console.log(`\n ${color(CYAN, 'Running:')} ${color(DIM, `${cmd} ${args.join(' ')}`)}`);
|
||||||
|
|
||||||
|
const child = spawnSync(cmd, args, {
|
||||||
|
stdio: 'inherit',
|
||||||
|
shell: platform === 'win32',
|
||||||
|
...opts,
|
||||||
|
});
|
||||||
|
|
||||||
|
resolve(child.status);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Install Windows: Visual Studio 2022 Build Tools via winget */
|
||||||
|
async function installWindows() {
|
||||||
|
// Check if winget is available
|
||||||
|
if (!commandExists('winget')) {
|
||||||
|
console.log('');
|
||||||
|
console.log(
|
||||||
|
color(RED, ' winget not found. Please install Visual Studio Build Tools manually:'),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
color(
|
||||||
|
CYAN,
|
||||||
|
' https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log('');
|
||||||
|
console.log(' During installation, select:');
|
||||||
|
console.log(color(BOLD, ' "Desktop development with C++" workload'));
|
||||||
|
console.log('');
|
||||||
|
console.log(' Or install via PowerShell (as Administrator):');
|
||||||
|
console.log(
|
||||||
|
color(
|
||||||
|
DIM,
|
||||||
|
' winget install Microsoft.VisualStudio.2022.BuildTools --override "--wait --quiet --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('');
|
||||||
|
info('Attempting automatic installation of Visual Studio 2022 Build Tools...');
|
||||||
|
dim('This may take several minutes and requires administrator privileges.');
|
||||||
|
console.log('');
|
||||||
|
|
||||||
|
if (!hasAdminPrivileges()) {
|
||||||
|
warn('Not running as Administrator. winget may prompt for elevation.');
|
||||||
|
}
|
||||||
|
|
||||||
|
const status = await runCommand('winget', [
|
||||||
|
'install',
|
||||||
|
'Microsoft.VisualStudio.2022.BuildTools',
|
||||||
|
'--override',
|
||||||
|
'"--quiet --wait --norestart --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.22621 --includeRecommended"',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (status === 0) {
|
||||||
|
success('Visual Studio 2022 Build Tools installed successfully.');
|
||||||
|
console.log('');
|
||||||
|
warn('You may need to restart your terminal for PATH changes to take effect.');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
error('Automatic installation failed. Please install manually.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Install macOS: Xcode Command Line Tools */
|
||||||
|
async function installMacOS() {
|
||||||
|
console.log('');
|
||||||
|
info('Installing Xcode Command Line Tools...');
|
||||||
|
dim('A GUI dialog will appear. Click "Install" to proceed.');
|
||||||
|
|
||||||
|
const status = await runCommand('xcode-select', ['--install']);
|
||||||
|
|
||||||
|
// xcode-select --install returns 1 if already installed or cancelled
|
||||||
|
if (status === 0) {
|
||||||
|
success('Xcode Command Line Tools installation initiated.');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if already installed (common false-negative)
|
||||||
|
try {
|
||||||
|
execSync('xcode-select -p', { stdio: 'ignore' });
|
||||||
|
success('Xcode Command Line Tools are already installed.');
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
warn('Xcode CLT installation was cancelled or failed.');
|
||||||
|
warn('You can install manually via: xcode-select --install');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Install Linux: distribution-specific packages */
|
||||||
|
async function installLinux() {
|
||||||
|
const distro = detectLinuxDistro();
|
||||||
|
|
||||||
|
if (distro === 'debian') {
|
||||||
|
// Ubuntu / Debian
|
||||||
|
if (!hasAdminPrivileges()) {
|
||||||
|
warn('Root privileges required. You may be prompted for your password.');
|
||||||
|
}
|
||||||
|
|
||||||
|
const status = await runCommand('sudo', [
|
||||||
|
'apt-get',
|
||||||
|
'install',
|
||||||
|
'-y',
|
||||||
|
'build-essential',
|
||||||
|
'python3',
|
||||||
|
'libsecret-1-dev',
|
||||||
|
'pkg-config',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (status === 0) {
|
||||||
|
success('Build dependencies installed successfully.');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
error('Failed to install build dependencies.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (distro === 'arch') {
|
||||||
|
// Manjaro / Arch
|
||||||
|
if (!hasAdminPrivileges()) {
|
||||||
|
warn('Root privileges required. You may be prompted for your password.');
|
||||||
|
}
|
||||||
|
|
||||||
|
const status = await runCommand('sudo', [
|
||||||
|
'pacman',
|
||||||
|
'-S',
|
||||||
|
'--needed',
|
||||||
|
'--noconfirm',
|
||||||
|
'base-devel',
|
||||||
|
'python',
|
||||||
|
'libsecret',
|
||||||
|
'pkg-config',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (status === 0) {
|
||||||
|
success('Build dependencies installed successfully.');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
error('Failed to install build dependencies.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (distro === 'fedora') {
|
||||||
|
if (!hasAdminPrivileges()) {
|
||||||
|
warn('Root privileges required. You may be prompted for your password.');
|
||||||
|
}
|
||||||
|
|
||||||
|
const status = await runCommand('sudo', [
|
||||||
|
'dnf',
|
||||||
|
'install',
|
||||||
|
'-y',
|
||||||
|
'gcc-c++',
|
||||||
|
'make',
|
||||||
|
'python3',
|
||||||
|
'libsecret-devel',
|
||||||
|
'pkg-config',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (status === 0) {
|
||||||
|
success('Build dependencies installed successfully.');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
error('Failed to install build dependencies.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unknown distro - provide generic instructions
|
||||||
|
console.log('');
|
||||||
|
warn(`Unknown Linux distribution: ${distro}`);
|
||||||
|
console.log('');
|
||||||
|
console.log(' You need the following packages to compile native Node.js modules:');
|
||||||
|
console.log(' - C/C++ compiler (gcc, g++)');
|
||||||
|
console.log(' - GNU Make');
|
||||||
|
console.log(' - Python 3');
|
||||||
|
console.log(' - libsecret development headers (for keytar)');
|
||||||
|
console.log(' - pkg-config');
|
||||||
|
console.log('');
|
||||||
|
console.log(
|
||||||
|
' Install them using your distribution package manager, then run npm install again.',
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Main ───────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
const checkOnly = args.includes('--check-only') || args.includes('--check');
|
||||||
|
|
||||||
|
console.log('');
|
||||||
|
console.log(color(BOLD + CYAN, '┌──────────────────────────────────────────┐'));
|
||||||
|
console.log(color(BOLD + CYAN, '│ Gemini Nexus - Dev Environment Setup │'));
|
||||||
|
console.log(color(BOLD + CYAN, '└──────────────────────────────────────────┘'));
|
||||||
|
console.log('');
|
||||||
|
dim(`Platform: ${platform} (${arch})`);
|
||||||
|
dim(`Node.js: ${process.version}`);
|
||||||
|
|
||||||
|
// Step 1: Check current state
|
||||||
|
header('Checking Build Toolchain');
|
||||||
|
|
||||||
|
let results;
|
||||||
|
switch (platform) {
|
||||||
|
case 'win32':
|
||||||
|
results = checkWindows();
|
||||||
|
break;
|
||||||
|
case 'darwin':
|
||||||
|
results = checkMacOS();
|
||||||
|
break;
|
||||||
|
case 'linux':
|
||||||
|
results = checkLinux();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log('');
|
||||||
|
error(`Unsupported platform: ${platform}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print summary
|
||||||
|
console.log('');
|
||||||
|
if (results.ok) {
|
||||||
|
success('All build tools are present and ready.');
|
||||||
|
console.log('');
|
||||||
|
dim('You can now run: npm install && npm start');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Missing tools ──
|
||||||
|
console.log('');
|
||||||
|
error(
|
||||||
|
'Some build tools are missing. Native modules like better-sqlite3 and keytar require compilation.',
|
||||||
|
);
|
||||||
|
|
||||||
|
if (checkOnly) {
|
||||||
|
console.log('');
|
||||||
|
warn('Build tools are missing. Native modules (better-sqlite3, keytar) require compilation.');
|
||||||
|
warn('Run "npm run setup" to install them automatically, or install manually:');
|
||||||
|
printManualInstructions(platform, results.missing);
|
||||||
|
console.log('');
|
||||||
|
dim(
|
||||||
|
'npm install succeeded, but npm start / electron-rebuild will fail until build tools are installed.',
|
||||||
|
);
|
||||||
|
// Don't exit with error - allow npm install to succeed (prebuilt binaries may work)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 2: Attempt installation
|
||||||
|
header('Installing Build Dependencies');
|
||||||
|
|
||||||
|
let installed = false;
|
||||||
|
switch (platform) {
|
||||||
|
case 'win32':
|
||||||
|
installed = await installWindows();
|
||||||
|
break;
|
||||||
|
case 'darwin':
|
||||||
|
installed = await installMacOS();
|
||||||
|
break;
|
||||||
|
case 'linux':
|
||||||
|
installed = await installLinux();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 3: Final status
|
||||||
|
console.log('');
|
||||||
|
if (installed) {
|
||||||
|
success('Setup complete. You can now run: npm install && npm start');
|
||||||
|
console.log('');
|
||||||
|
dim('If you encounter issues, restart your terminal and try again.');
|
||||||
|
} else {
|
||||||
|
console.log('');
|
||||||
|
warn('Automatic installation was not successful.');
|
||||||
|
warn('Please install the required tools manually, then run npm install again.');
|
||||||
|
printManualInstructions(platform, results.missing);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function printManualInstructions(platform, missing) {
|
||||||
|
console.log('');
|
||||||
|
console.log(color(BOLD, ' ── Manual Installation Instructions ──'));
|
||||||
|
console.log('');
|
||||||
|
|
||||||
|
switch (platform) {
|
||||||
|
case 'win32':
|
||||||
|
console.log(' 1. Download Visual Studio 2022 Build Tools:');
|
||||||
|
console.log(
|
||||||
|
color(
|
||||||
|
CYAN,
|
||||||
|
' https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log('');
|
||||||
|
console.log(' 2. Run the installer and select:');
|
||||||
|
console.log(color(BOLD, ' "Desktop development with C++"'));
|
||||||
|
console.log('');
|
||||||
|
console.log(' 3. Or install via PowerShell (as Administrator):');
|
||||||
|
console.log(
|
||||||
|
color(
|
||||||
|
DIM,
|
||||||
|
' winget install Microsoft.VisualStudio.2022.BuildTools --override "--quiet --wait --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log('');
|
||||||
|
console.log(' 4. Restart your terminal after installation.');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'darwin':
|
||||||
|
console.log(' Run this command in your terminal:');
|
||||||
|
console.log(color(DIM, ' xcode-select --install'));
|
||||||
|
console.log('');
|
||||||
|
console.log(' Then click "Install" in the dialog that appears.');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'linux': {
|
||||||
|
const distro = detectLinuxDistro();
|
||||||
|
if (distro === 'debian') {
|
||||||
|
console.log(' Run:');
|
||||||
|
console.log(
|
||||||
|
color(
|
||||||
|
DIM,
|
||||||
|
' sudo apt-get install -y build-essential python3 libsecret-1-dev pkg-config',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else if (distro === 'arch') {
|
||||||
|
console.log(' Run:');
|
||||||
|
console.log(
|
||||||
|
color(DIM, ' sudo pacman -S --needed base-devel python libsecret pkg-config'),
|
||||||
|
);
|
||||||
|
} else if (distro === 'fedora') {
|
||||||
|
console.log(' Run:');
|
||||||
|
console.log(
|
||||||
|
color(DIM, ' sudo dnf install -y gcc-c++ make python3 libsecret-devel pkg-config'),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
console.log(' Install: C/C++ compiler, make, python3, libsecret-dev, pkg-config');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Run ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
main().catch((err) => {
|
||||||
|
console.error(color(RED, `\nUnexpected error: ${err.message}`));
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
# Starts the installed Antigravity app with Proxyman proxy settings for local debugging.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# powershell -ExecutionPolicy Bypass -File .\scripts\start-antigravity-with-proxyman.ps1
|
||||||
|
# powershell -ExecutionPolicy Bypass -File .\scripts\start-antigravity-with-proxyman.ps1 -Port 9090 -AllowInsecureTls
|
||||||
|
#
|
||||||
|
# Notes:
|
||||||
|
# - This script is intended for local debugging only.
|
||||||
|
# - It terminates existing Antigravity processes first so the new environment variables take effect.
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[int]$Port = 9090,
|
||||||
|
[string]$ProxyHost = '127.0.0.1',
|
||||||
|
[string]$AppPath = 'C:\Users\Administrator\AppData\Local\Programs\Antigravity\Antigravity.exe',
|
||||||
|
[string]$CaPath = 'C:\Users\Administrator\AppData\Roaming\Proxyman\certificate\certs\ca.pem',
|
||||||
|
[string]$NoProxy = 'localhost,127.0.0.1,::1',
|
||||||
|
[switch]$AllowInsecureTls,
|
||||||
|
[switch]$KeepExisting
|
||||||
|
)
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
function Write-ColorLine {
|
||||||
|
param(
|
||||||
|
[string]$Color,
|
||||||
|
[string]$Message
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Host $Message -ForegroundColor $Color
|
||||||
|
}
|
||||||
|
|
||||||
|
function Info {
|
||||||
|
param([string]$Message)
|
||||||
|
|
||||||
|
Write-ColorLine -Color 'Cyan' -Message "[INFO] $Message"
|
||||||
|
}
|
||||||
|
|
||||||
|
function Success {
|
||||||
|
param([string]$Message)
|
||||||
|
|
||||||
|
Write-ColorLine -Color 'Green' -Message "[OK] $Message"
|
||||||
|
}
|
||||||
|
|
||||||
|
function Warn {
|
||||||
|
param([string]$Message)
|
||||||
|
|
||||||
|
Write-ColorLine -Color 'Yellow' -Message "[WARN] $Message"
|
||||||
|
}
|
||||||
|
|
||||||
|
function Fail {
|
||||||
|
param([string]$Message)
|
||||||
|
|
||||||
|
Write-ColorLine -Color 'Red' -Message "[ERROR] $Message"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
$proxyUrl = "http://${ProxyHost}:${Port}"
|
||||||
|
$proxyBypassList = '<local>;localhost;127.0.0.1;::1'
|
||||||
|
|
||||||
|
if (-not (Test-Path -LiteralPath $AppPath)) {
|
||||||
|
Fail "Antigravity executable not found: $AppPath"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-Path -LiteralPath $CaPath)) {
|
||||||
|
Fail "Proxyman CA file not found: $CaPath"
|
||||||
|
}
|
||||||
|
|
||||||
|
Info "Proxy URL: $proxyUrl"
|
||||||
|
Info "Antigravity path: $AppPath"
|
||||||
|
Info "CA path: $CaPath"
|
||||||
|
|
||||||
|
if (-not $KeepExisting) {
|
||||||
|
$existingProcesses = Get-Process -Name 'Antigravity' -ErrorAction SilentlyContinue
|
||||||
|
if ($existingProcesses) {
|
||||||
|
Warn "Stopping existing Antigravity processes so the new proxy environment takes effect..."
|
||||||
|
$existingProcesses | Stop-Process -Force
|
||||||
|
Start-Sleep -Milliseconds 800
|
||||||
|
} else {
|
||||||
|
Info 'No running Antigravity process found.'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Warn 'KeepExisting enabled; existing Antigravity processes were not terminated.'
|
||||||
|
}
|
||||||
|
|
||||||
|
$env:HTTP_PROXY = $proxyUrl
|
||||||
|
$env:HTTPS_PROXY = $proxyUrl
|
||||||
|
$env:ALL_PROXY = $proxyUrl
|
||||||
|
$env:NO_PROXY = $NoProxy
|
||||||
|
$env:ELECTRON_PROXY_SERVER = $proxyUrl
|
||||||
|
$env:ELECTRON_PROXY_BYPASS_LIST = $proxyBypassList
|
||||||
|
$env:NODE_EXTRA_CA_CERTS = $CaPath
|
||||||
|
|
||||||
|
if ($AllowInsecureTls) {
|
||||||
|
$env:NODE_TLS_REJECT_UNAUTHORIZED = '0'
|
||||||
|
Warn 'NODE_TLS_REJECT_UNAUTHORIZED=0 is enabled for this launch. Use for debugging only.'
|
||||||
|
} else {
|
||||||
|
Remove-Item Env:NODE_TLS_REJECT_UNAUTHORIZED -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
Info 'Starting Antigravity with Proxyman proxy settings...'
|
||||||
|
$process = Start-Process -FilePath $AppPath -ArgumentList @(
|
||||||
|
"--proxy-server=$proxyUrl",
|
||||||
|
"--proxy-bypass-list=$proxyBypassList"
|
||||||
|
) -WorkingDirectory (Split-Path -Parent $AppPath) -PassThru
|
||||||
|
|
||||||
|
Success "Antigravity started. PID: $($process.Id)"
|
||||||
|
Write-Host ''
|
||||||
|
Write-Host 'Environment used for this launch:' -ForegroundColor Gray
|
||||||
|
Write-Host " HTTP_PROXY=$($env:HTTP_PROXY)" -ForegroundColor Gray
|
||||||
|
Write-Host " HTTPS_PROXY=$($env:HTTPS_PROXY)" -ForegroundColor Gray
|
||||||
|
Write-Host " NO_PROXY=$($env:NO_PROXY)" -ForegroundColor Gray
|
||||||
|
Write-Host " NODE_EXTRA_CA_CERTS=$($env:NODE_EXTRA_CA_CERTS)" -ForegroundColor Gray
|
||||||
|
if ($AllowInsecureTls) {
|
||||||
|
Write-Host ' NODE_TLS_REJECT_UNAUTHORIZED=0' -ForegroundColor Gray
|
||||||
|
}
|
||||||
|
Write-Host ''
|
||||||
|
Write-Host 'If Proxyman still does not show traffic, verify that no older Antigravity instance is still alive.' -ForegroundColor Gray
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { createRoot } from 'react-dom/client';
|
import { createRoot } from 'react-dom/client';
|
||||||
import { syncWithLocalTheme } from './actions/theme';
|
import { syncWithLocalTheme } from './actions/theme';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@@ -29,12 +29,10 @@ const queryClient = new QueryClient();
|
|||||||
|
|
||||||
const root = createRoot(document.getElementById('app')!);
|
const root = createRoot(document.getElementById('app')!);
|
||||||
root.render(
|
root.render(
|
||||||
<React.StrictMode>
|
<QueryClientProvider client={queryClient}>
|
||||||
<QueryClientProvider client={queryClient}>
|
<ThemeProvider storageKey={LOCAL_STORAGE_KEYS.THEME} defaultTheme="dark">
|
||||||
<ThemeProvider storageKey={LOCAL_STORAGE_KEYS.THEME} defaultTheme="system">
|
<App />
|
||||||
<App />
|
<Toaster />
|
||||||
<Toaster />
|
</ThemeProvider>
|
||||||
</ThemeProvider>
|
</QueryClientProvider>,
|
||||||
</QueryClientProvider>
|
|
||||||
</React.StrictMode>,
|
|
||||||
);
|
);
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
import { ipc } from '@/ipc/manager';
|
import { ipc } from '@/ipc/manager';
|
||||||
import type { DeviceProfile } from '@/types/account';
|
import type { DeviceProfile } from '@/types/account';
|
||||||
|
import { isValidProxyUrl } from '@/utils/url';
|
||||||
|
|
||||||
export function addGoogleAccount(input: { authCode: string }) {
|
export function addGoogleAccount(input: { authCode: string; oauthClientKey?: string }) {
|
||||||
return ipc.client.cloud.addGoogleAccount(input);
|
return ipc.client.cloud.addGoogleAccount(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,6 +15,7 @@ export function deleteCloudAccount(input: { accountId: string }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function refreshAccountQuota(input: { accountId: string }) {
|
export function refreshAccountQuota(input: { accountId: string }) {
|
||||||
|
console.log(`[Action] Calling refreshAccountQuota for: ${input.accountId}`);
|
||||||
return ipc.client.cloud.refreshAccountQuota(input);
|
return ipc.client.cloud.refreshAccountQuota(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,8 +39,29 @@ export function syncLocalAccount() {
|
|||||||
return ipc.client.cloud.syncLocalAccount();
|
return ipc.client.cloud.syncLocalAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function startAuthFlow() {
|
export interface OAuthClientDescriptor {
|
||||||
return ipc.client.cloud.startAuthFlow();
|
key: string;
|
||||||
|
label: string;
|
||||||
|
client_id: string;
|
||||||
|
is_active: boolean;
|
||||||
|
is_builtin: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function startAuthFlow(input?: { oauthClientKey?: string }) {
|
||||||
|
return ipc.client.cloud.startAuthFlow(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function listOAuthClients() {
|
||||||
|
return ipc.client.cloud.listOAuthClients() as Promise<OAuthClientDescriptor[]>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getActiveOAuthClient() {
|
||||||
|
const response = await ipc.client.cloud.getActiveOAuthClient();
|
||||||
|
return response.client_key;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setActiveOAuthClient(input: { clientKey: string }) {
|
||||||
|
return ipc.client.cloud.setActiveOAuthClient(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSwitchStatus() {
|
export function getSwitchStatus() {
|
||||||
@@ -88,3 +111,26 @@ export function deleteCloudIdentityProfileRevision(input: {
|
|||||||
export function openCloudIdentityStorageFolder() {
|
export function openCloudIdentityStorageFolder() {
|
||||||
return ipc.client.cloud.openIdentityStorageFolder();
|
return ipc.client.cloud.openIdentityStorageFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function setAccountProxy(input: { accountId: string; proxyUrl: string | null }) {
|
||||||
|
if (input.proxyUrl && !isValidProxyUrl(input.proxyUrl)) {
|
||||||
|
throw new Error('Invalid proxy URL format');
|
||||||
|
}
|
||||||
|
return ipc.client.cloud.setAccountProxy(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function exportCloudAccounts(input: { stripTokens?: boolean }) {
|
||||||
|
return ipc.client.cloud.exportCloudAccounts(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function importCloudAccounts(input: {
|
||||||
|
jsonContent: string;
|
||||||
|
strategy?: 'merge' | 'overwrite' | 'skip-existing';
|
||||||
|
}) {
|
||||||
|
try {
|
||||||
|
JSON.parse(input.jsonContent);
|
||||||
|
} catch {
|
||||||
|
throw new Error('Invalid JSON content provided for import');
|
||||||
|
}
|
||||||
|
return ipc.client.cloud.importCloudAccounts(input);
|
||||||
|
}
|
||||||
@@ -4,10 +4,10 @@ export function isProcessRunning() {
|
|||||||
return ipc.client.proc.isProcessRunning();
|
return ipc.client.proc.isProcessRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function closeAntigravity() {
|
export function closeGeminiNexus() {
|
||||||
return ipc.client.proc.closeAntigravity();
|
return ipc.client.proc.closeGeminiNexus();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function startAntigravity() {
|
export function startGeminiNexus() {
|
||||||
return ipc.client.proc.startAntigravity();
|
return ipc.client.proc.startGeminiNexus();
|
||||||
}
|
}
|
||||||