-
-
Notifications
You must be signed in to change notification settings - Fork 542
Feat/refresh account #401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/refresh account #401
Changes from all commits
15d41f7
152aa5d
f24a68d
6986a25
55291da
f150cbe
f015fa7
efc44bf
61f7e7a
299e461
fc8860d
e9d4e42
31758b6
d46412e
dfbb6c6
644ad03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -185,10 +185,86 @@ OPENCODE_ANTIGRAVITY_LOG_DIR=/path # log_dir | |||||||||||||||||||||||
| OPENCODE_ANTIGRAVITY_KEEP_THINKING=1 # keep_thinking | ||||||||||||||||||||||||
| OPENCODE_ANTIGRAVITY_ACCOUNT_SELECTION_STRATEGY=round-robin | ||||||||||||||||||||||||
| OPENCODE_ANTIGRAVITY_PID_OFFSET_ENABLED=1 | ||||||||||||||||||||||||
| OPENCODE_ANTIGRAVITY_TELEGRAM_BOT_TOKEN="your-bot-token" # Telegram notifications | ||||||||||||||||||||||||
| OPENCODE_ANTIGRAVITY_TELEGRAM_CHAT_ID="your-chat-id" # Telegram chat ID | ||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## Error Notifications | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| Get alerts when accounts encounter errors. Session continues with next account instead of stopping. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| | Option | Default | Description | | ||||||||||||||||||||||||
| |--------|---------|-------------| | ||||||||||||||||||||||||
| | `notify_on_account_error` | `true` | Enable notifications when accounts fail | | ||||||||||||||||||||||||
| | `telegram_bot_token` | - | Telegram bot token for remote notifications | | ||||||||||||||||||||||||
| | `telegram_chat_id` | - | Your Telegram chat ID | | ||||||||||||||||||||||||
| | `notification_cooldown_seconds` | `60` | Cooldown between notifications (prevents spam) | | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ### Telegram Setup (Optional) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| Receive account error notifications directly to Telegram - useful for monitoring long-running agents. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| **Step 1: Create a Telegram Bot** | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| 1. Open Telegram and search for [@BotFather](https://t.me/BotFather) | ||||||||||||||||||||||||
| 2. Send `/newbot` and follow the prompts | ||||||||||||||||||||||||
| 3. BotFather will give you a token like `123456789:ABCdefGHIjklMNOpqrsTUVwxyz` | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| **Step 2: Get Your Chat ID** | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| 1. Search for [@userinfobot](https://t.me/userinfobot) on Telegram | ||||||||||||||||||||||||
| 2. Send any message to it | ||||||||||||||||||||||||
| 3. It will reply with your chat ID (e.g., `123456789`) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| **Step 3: Configure the Plugin** | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| Add to your `antigravity.json`: | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ```json | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| "$schema": "https://raw.githubusercontent.com/NoeFabris/opencode-antigravity-auth/main/assets/antigravity.schema.json", | ||||||||||||||||||||||||
| "telegram_bot_token": "123456789:ABCdefGHIjklMNOpqrsTUVwxyz", | ||||||||||||||||||||||||
| "telegram_chat_id": "123456789" | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| Or via environment variables: | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||
| export OPENCODE_ANTIGRAVITY_TELEGRAM_BOT_TOKEN="123456789:ABCdefGHIjklMNOpqrsTUVwxyz" | ||||||||||||||||||||||||
| export OPENCODE_ANTIGRAVITY_TELEGRAM_CHAT_ID="123456789" | ||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| **Step 4: Start Your Bot** | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| > ⚠️ You must send at least one message to your bot before it can message you. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| 1. Open your new bot in Telegram (use the link BotFather gave you) | ||||||||||||||||||||||||
| 2. Send any message (e.g., `/start`) | ||||||||||||||||||||||||
| 3. Now the plugin can send notifications to you! | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ### What You'll Receive | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| When an account encounters an error, you'll get a Telegram message like: | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||
| ⚠️ Account Error | ||||||||||||||||||||||||
| ━━━━━━━━━━━━━━━━━━━━━━━━ | ||||||||||||||||||||||||
| 📧 Account: user@gmail.com | ||||||||||||||||||||||||
| ❌ Error: invalid_grant | ||||||||||||||||||||||||
| 💬 Message: Token revoked - run `opencode auth login` | ||||||||||||||||||||||||
| 📊 Status: 401 | ||||||||||||||||||||||||
| 🤖 Model: claude-sonnet-4-20250514 | ||||||||||||||||||||||||
| 📋 Remaining: 2 account(s) | ||||||||||||||||||||||||
| 🕐 Time: 2025-02-08T10:30:00.000Z | ||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||
|
Comment on lines
+252
to
+262
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a language identifier to the fenced code block. The static analysis tool (markdownlint MD040) flags this code block for missing a language specifier. Since this is a plain-text notification example, use Proposed fix-```
+```text
⚠️ Account Error📝 Committable suggestion
Suggested change
🧰 Tools🪛 markdownlint-cli2 (0.20.0)[warning] 252-252: Fenced code blocks should have a language specified (MD040, fenced-code-language) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| The session will automatically continue with the next available account. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ## Advanced Settings | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| > These settings are for edge cases. Most users don't need to change them. | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
rg -n 'telegram_bot_token|TELEGRAM_BOT_TOKEN' --type=ts -C3Repository: NoeFabris/opencode-antigravity-auth
Length of output: 3107
🏁 Script executed:
Repository: NoeFabris/opencode-antigravity-auth
Length of output: 95
🏁 Script executed:
Repository: NoeFabris/opencode-antigravity-auth
Length of output: 8458
🏁 Script executed:
sed -n '116,250p' src/plugin/config/loader.tsRepository: NoeFabris/opencode-antigravity-auth
Length of output: 3913
Environment variable override for
telegram_bot_tokenis documented but not implemented.telegram_bot_tokenis a secret credential. The schema (line 446 insrc/plugin/config/schema.ts) documents an env-var overrideOPENCODE_ANTIGRAVITY_TELEGRAM_BOT_TOKEN, but theapplyEnvOverrides()function insrc/plugin/config/loader.tsdoes not actually implement this override. The token is currently loaded only from config files, forcing users to store it in plaintext on disk.Implement the env-var override in
applyEnvOverrides()to allow users to set the token via environment variable (consistent with other config fields likequiet_mode,debug,log_dir, etc.), or remove the false documentation from the schema.🤖 Prompt for AI Agents