magpie-gemini-web 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mag1cFall
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md CHANGED
@@ -2,178 +2,165 @@
2
2
 
3
3
  [中文](README.md) | English
4
4
 
5
- Use Gemini on the web and Google AI Studio through your Google account in [Magpie](https://usemagpie.ai/). The plugin runs [gemini-web2api-go](https://github.com/zexadev/gemini-web2api-go) and [AIStudio2API](https://github.com/Mag1cFall/AIStudio2API) backends on your machine, turning Google web interfaces into OpenAI-compatible APIs.
6
-
7
- The plugin provides two independent providers:
8
- - `gemini-web`: the Gemini web app; see [Getting started](#getting-started-gemini-web).
9
- - `ai-studio`: Google AI Studio, with native tool calling; see [Google AI Studio](#google-ai-studio-ai-studio).
5
+ Use **Google AI Studio** and **Gemini on the web** through your Google account in [Magpie](https://usemagpie.ai/). The plugin runs [AIStudio2API](https://github.com/Mag1cFall/AIStudio2API) and [gemini-web2api-go](https://github.com/zexadev/gemini-web2api-go) locally, turning Google web interfaces into OpenAI-compatible APIs.
10
6
 
11
7
  > **2026-10-16 update:** Full-price Google AI Pro accounts can now use `gemini-4-argon` directly in Antigravity, and can likewise be proxied directly with Magpie.
12
8
 
13
- ## Getting started (Gemini Web)
14
-
15
- 1. Install **magpie-gemini-web** from the Magpie plugin market.
16
- 2. Sign in to Gemini Web and choose **一键配置本地 Gemini Web (one-click local setup, recommended)**. The plugin downloads this project's optimized backend, verifies its SHA-256 and starts it in the background. No Go installation or manual patching is needed.
17
- 3. Copy your cookie when prompted. **Use a private / incognito window** (Firefox recommended):
18
- 1. In the private window, open <https://gemini.google.com/app> and sign in to the Google account you want to use.
19
- 2. Press F12 (⌥⌘I on macOS), switch to **Network** and reload the page.
20
- 3. Click any `gemini.google.com` request and go to **Headers** → **Request Headers**.
21
- 4. Copy the value of the `cookie` line and paste it into Magpie.
22
- 5. Close the private window. **Don't sign out**, because signing out invalidates the cookie.
23
- 4. The plugin checks that the account works, then finishes signing in.
24
-
25
- > **Why a private window?** The backend refreshes this sign-in periodically to keep it alive. If it shares a session with the browser you normally use, Google revokes the session and your browser gets signed out of every Google service. A private window gives the backend a session of its own. Using a separate Google account for the backend is safer still.
26
-
27
- From then on, Magpie starts the backend automatically every time it launches. To add another account, run the one-click setup again.
28
-
29
- > Need a proxy to reach Google? The backend ignores `HTTP_PROXY`. Add the proxy in the proxy pool of the admin panel at `http://127.0.0.1:8083/admin`. The admin password is `adminToken` in `secrets.json` in the data directory.
9
+ ## Which Provider Should I Choose?
30
10
 
31
- **Connecting an existing backend:** if you already run gemini-web2api-go yourself, choose 连接已有后端 (connect an existing backend with a custom URL and API key). Enter its URL (ending in `/v1`) and its `API_KEY`.
32
-
33
- ## Plugin options (Gemini Web)
34
-
35
- Tool calls are on by default (coding agents send tools with every request); image input is off. To allow images:
36
-
37
- ```bash
38
- magpie plugin options magpie-gemini-web '{"allowImages":true}'
39
- ```
11
+ The plugin provides two independent providers that can be used individually or together:
40
12
 
41
- | Option | Default | Description |
13
+ | Feature | Google AI Studio (`ai-studio`) | Gemini Web (`gemini-web`) |
42
14
  | :--- | :--- | :--- |
43
- | `allowTools` | `true` | Allows tool calls (experimental; upstream emulates them with prompts). When `false`, requests with tools get a 400 |
44
- | `allowImages` | `false` | Allows image input |
45
- | `baseURL` | `http://127.0.0.1:8083/v1` | Default backend URL |
46
- | `contextLimit` / `outputLimit` | `1000000` / `8192` | Context and output limits reported to clients |
47
- | `requestTimeoutMs` / `modelTimeoutMs` | `240000` / `10000` | Timeouts in ms for requests and for fetching the model list. The request timeout counts each wait on the backend, so a reply that keeps coming is never cut off |
48
- | `stripCitations` | `true` | Removes the citation markers Gemini adds to replies, `[cite: 1]` and `[cite_start]`, tool call arguments included. Set it to `false` while Gemini edits code that contains such text itself |
49
-
50
- ## Thinking effort
51
-
52
- You can switch a model between `low` and `high` effort in Magpie if it has a `-thinking` version. `low` uses the base model and `high` uses the `-thinking` model with extended thinking, so the `-thinking` model isn't listed on its own. After upgrading the plugin, run `magpie provider models gemini-web` to refresh the model list. Argon's medium tier will be added once upstream supports it ([#5](https://github.com/BUKOWSKIREAL/magpie-gemini-web/issues/5)).
53
-
54
- ## Security and data
15
+ | **Best for** | **Coding agents (recommended)** | General chat, web-only models & web quota |
16
+ | **Tool calling** | **Native Function Calling**, reliable | Prompt-emulated (experimental; Flash often skips tools) |
17
+ | **Thinking levels** | `minimal` / `low` / `medium` / `high` (`minimal` is fastest & cheapest) | `low` (base) / `high` (`-thinking` extended thinking) |
18
+ | **Sign-in method** | Sign in directly in an isolated popup browser window | Copy `cookie` from a private/incognito window |
19
+ | **Usage cards** | Shows models currently on cooldown and recovery times | Syncs **5-hour** & **weekly** usage and reset times from the web |
20
+ | **Local backend** | AIStudio2API (`v0.2.13`) | gemini-web2api-go (`4.22.0-magpie.1` optimized build) |
55
21
 
56
- - The backend listens on `127.0.0.1` only. Your cookie goes only to that local backend, and Magpie stores a locally generated API key instead.
57
- - The default backend is this project's **4.22.0-magpie.1**, built from pinned upstream v4.22.0 sources with this repository's patch. SHA-256 is checked on download and before launching a new process. Builds cover macOS, Linux and Windows on x64 and arm64; the release includes sources, build metadata and checksums.
58
- - The data directory is `~/.local/share/magpie-gemini-web` (set `GEMINI_WEB_DATA_DIR` to change it). The backend writes its log to `backend.log` there.
59
- - The plugin sends one request at a time, but this can't guarantee that Google won't flag your account. Use it at your own risk.
22
+ ---
60
23
 
61
- ## Usage
24
+ ## Quick Start
62
25
 
63
- Magpie's usage cards show each Google account's **5-hour** and **weekly** usage and reset times, as <https://gemini.google.com/usage> does. Each Google account gets a card of its own, named by its email:
26
+ Install **magpie-gemini-web** from the Magpie plugin market, then sign in to either (or both) providers below. The plugin automatically downloads the corresponding backend, verifies its SHA-256 checksum, and runs it in the background—no Go installation or extra setup required.
64
27
 
65
- - An account added by one-click setup becomes its own card.
66
- - For an account already in the backend (one added by an older version, say), add another Gemini Web account in Magpie and pick **「添加本地后端里已有的 Google 账号」** (add an account already in the local backend), then choose it from the list. The old `API key …` sign-in can then go: it shows the whole pool as one card (each window at the account that has used the most).
28
+ ### Option 1: Google AI Studio (`ai-studio`)
67
29
 
68
- Note that the backend picks the Google account for each request from its pool in turn: how Magpie spreads requests over the cards doesn't decide which account serves them. Only the one-click local backend has usage; a backend you connect to yourself keeps its cookies out of the plugin's reach.
30
+ 1. Sign in to **Google AI Studio** in Magpie and choose **「用 Google 账号登录(推荐)」** (Sign in with a Google account).
31
+ 2. Sign in to your Google account in the separate login window that opens (your regular browser is unaffected), then close the window.
32
+ > On first run, the login browser Camoufox (~300 MB) is downloaded first, so the window may take a few minutes to appear. Complete sign-in within 15 minutes.
33
+ 3. **Managing accounts:** Choose "Sign in with a Google account" again at any time to **add a new account**, create a card for an existing local account, or **re-authenticate** an expired account.
69
34
 
70
- To send Google fewer requests, usage isn't read on every refresh. An account is read again once the backend has used it or one of its windows has reset, and never twice within 10 minutes. An idle account is read at most every 6 hours, which also picks up what you used in the Gemini web app.
35
+ ### Option 2: Gemini Web (`gemini-web`)
71
36
 
72
- Usage and emails are read the way the backend reaches Google for that account. When that way isn't certain, nothing is read and the card says why:
37
+ 1. Sign in to **Gemini Web** in Magpie and choose **「一键配置本地 Gemini Web(推荐)」** (One-click local setup).
38
+ 2. Copy your cookie using a **private / incognito window** (Firefox recommended):
39
+ 1. Open <https://gemini.google.com/app> in the private window and sign in to your Google account.
40
+ 2. Press `F12` (`⌥⌘I` on macOS), switch to the **Network** tab, and reload the page.
41
+ 3. Click any `gemini.google.com` request → **Headers** → **Request Headers**, copy the `cookie` value, and paste it into Magpie.
42
+ 4. **Close the private window directly—do not sign out** (signing out invalidates the cookie).
43
+ 3. The plugin verifies the account and completes sign-in. Repeat the steps above to add more accounts.
73
44
 
74
- - the backend has a proxy pool, but the account isn't bound to a proxy yet (the backend binds it on its first request);
75
- - the account's proxy is disabled, or is a SOCKS proxy.
45
+ > **Why is a private window required?** The backend periodically refreshes this session to keep it alive. If it shares a session with your daily browser, Google will revoke the session and sign your browser out of all Google services. A private window (or a dedicated secondary Google account) gives the backend an isolated session.
76
46
 
77
- So with a proxy pool, an account just added by one-click setup has no email yet. Send one request with it, sign in to it again with **「添加本地后端里已有的 Google 账号」**, then remove the sign-in without an email.
47
+ ---
78
48
 
79
- ## Limitations (Gemini Web)
49
+ ## Multiple Accounts & Usage Cards
80
50
 
81
- - Upstream emulates tool calls with prompts, so they aren't always reliable. Flash models often don't call tools.
82
- - Only text models whose names start with `gemini-` are exposed. A `cost` of 0 doesn't reflect your actual Google quota.
51
+ - **One card per account:** Each Google account gets its own usage card titled with its email address.
52
+ - *Migrating older Gemini Web accounts:* For accounts added in earlier versions, add a Gemini Web account in Magpie and choose **「添加本地后端里已有的 Google 账号」** (Add an existing Google account from the local backend) to create individual cards, then remove the old pooled `API key …` card.
53
+ - **Automatic account rotation:** The local backend selects which Google account serves each request (Gemini Web rotates across the pool; AI Studio uses one account until cooldown and switches to the next). Switching cards in Magpie does not change which account the backend picks.
54
+ - **Usage reporting:**
55
+ - `gemini-web`: Available only with the one-click local backend. To minimize requests to Google, usage is refreshed only after an account is used or a quota window resets (at least 10 minutes apart, and at most once every 6 hours when idle).
56
+ - `ai-studio`: AI Studio does not report remaining total quota; cards display models currently on cooldown and their recovery times, or prompt when re-authentication is needed.
83
57
 
84
- ## Google AI Studio (`ai-studio`)
58
+ ---
85
59
 
86
- Uses Google AI Studio through [AIStudio2API](https://github.com/Mag1cFall/AIStudio2API) (pinned to v0.2.12). Unlike Gemini Web, tool calls use native Function Calling, thinking models offer four levels in Magpie, `minimal` / `low` / `medium` / `high` (`minimal` is the fastest and uses the least quota), and generation needs no browser.
60
+ ## Configuration & Advanced Usage
87
61
 
88
- ### Getting started
62
+ <details>
63
+ <summary><b>⚙️ Plugin Options & Proxy Setup</b> (image input, proxy configuration, custom backends)</summary>
89
64
 
90
- 1. Sign in to Google AI Studio and choose **用 Google 账号登录(推荐)** (sign in with a Google account). The first time, the plugin downloads AIStudio2API, verifies its SHA-256 and starts it in the background.
91
- 2. Sign in to your Google account in the separate login window that opens (your usual browser is not affected), then close it. The first time, the login browser Camoufox (about 300 MB) is downloaded first, so the window can take a few minutes to appear while Magpie shows no change; the login must finish within 15 minutes.
65
+ <br>
92
66
 
93
- Choosing it again later lists:
67
+ Tool calling is enabled by default; image input is disabled by default. Configure plugin options via the CLI:
94
68
 
95
- - **添加新的 Google 账号** (add a new Google account): opens the login window for another account;
96
- - **the accounts already on this machine**: makes a card for one at once; one marked as needing to sign in again opens the login window to do so.
97
-
98
- Each Google account gets a card of its own. As with Gemini Web, the local service picks the account for each request (one until it cools down, then the next), whichever card Magpie uses.
69
+ ```bash
70
+ # Enable image input (applies to both providers)
71
+ magpie plugin options magpie-gemini-web '{"allowImages":true}'
99
72
 
100
- If you run AIStudio2API yourself, choose **连接已有 AIStudio2API** (connect an existing AIStudio2API) and enter its address (default `http://127.0.0.1:2048/v1`) and `PROXY_API_KEY`.
73
+ # Configure a proxy for AI Studio
74
+ magpie plugin options magpie-gemini-web '{"studio":{"proxy":"http://127.0.0.1:7890"}}'
75
+ ```
101
76
 
102
- Usage card: AI Studio reports no remaining quota. The card shows the models the account is cooling down on and when each comes back, or that the account needs to sign in again.
77
+ | Option | Default | Scope | Description |
78
+ | :--- | :--- | :--- | :--- |
79
+ | `allowTools` | `true` | Shared (override via `studio.allowTools`) | Allow tool calls. When `false`, requests with tools return 400 |
80
+ | `allowImages` | `false` | Shared (override via `studio.allowImages`) | Allow image input |
81
+ | `requestTimeoutMs` / `modelTimeoutMs` | Web: `240000` / `10000`; Studio: `1800000` / `10000` | Shared (override via `studio.*`) | Timeout (ms) per backend wait or model list fetch; resets on stream data, explicit settings take precedence |
82
+ | `stripCitations` | `true` | `gemini-web` only | Strip `[cite: 1]` and `[cite_start]` markers from replies and tool arguments (not supported on AI Studio) |
83
+ | `baseURL` | `http://127.0.0.1:8083/v1` | `gemini-web` only | Default Gemini Web backend URL |
84
+ | `contextLimit` / `outputLimit` | `1000000` / `8192` | `gemini-web` only | Context and output limits reported to clients |
85
+ | `studio.proxy` | none | `ai-studio` only | Proxy for reaching Google (`http` / `https` / `socks5`), or set `AI_STUDIO_PROXY` env var; when set, it takes precedence over the proxy saved in the admin page. An empty value counts as unset |
86
+ | `studio.baseURL` | `http://127.0.0.1:2048/v1` | `ai-studio` only | Default URL when connecting an existing AIStudio2API instance |
87
+ | `studio.contextLimit` / `studio.outputLimit` | Model catalog defaults | `ai-studio` only | Limits reported to clients (can only lower the catalog defaults) |
103
88
 
104
- ### Plugin options
89
+ **Using a proxy to reach Google:**
90
+ - **AI Studio:** Preferably set it in the local admin page. Open the address on the usage card's "管理页" (admin page) line (default `http://127.0.0.1:2048`) and sign in as `magpie` with `adminPassword` from `config.json` in the data directory. Save the proxy, then restart the service from the admin page. The plugin keeps the saved value when it restarts the backend.
91
+ - Alternatively, `studio.proxy` or `AI_STUDIO_PROXY` take precedence over the saved proxy. A change applies after the local service restarts (`npm run studio:stop`; the next request starts it again).
92
+ - With neither set, the backend falls back to the `HTTPS_PROXY` environment variable or the system proxy (Windows proxy settings).
93
+ - **The provider proxy set for `ai-studio` in Magpie is not passed to the local backend**; use one of the options above.
94
+ - The usage card's "代理出口" (proxy) line, the Google sign-in instructions and failure messages, and `npm run studio:status` show the proxy the backend actually uses, where it comes from, and whether a new setting still needs a restart.
95
+ - The listen address, API key and admin credentials are managed by the plugin; changing them in the admin page has no effect.
96
+ - **Gemini Web:** The backend ignores `HTTP_PROXY`. Add your proxy to the proxy pool in the local admin panel at `http://127.0.0.1:8083/admin` (password is `adminToken` in `secrets.json` inside the data directory).
97
+ - *Note:* When using a proxy pool, send one request with a newly added account so the backend binds it to a proxy, then re-add it via "Add an existing Google account from the local backend" to load its email and usage (SOCKS proxies are not supported for usage reads).
105
98
 
106
- `allowTools`, `allowImages`, `requestTimeoutMs` and `modelTimeoutMs` apply to both providers; the other AI Studio options go under `studio`. The root `baseURL`, `contextLimit`, `outputLimit` and `stripCitations` apply to Gemini Web only.
99
+ **Connecting a self-hosted backend:**
100
+ If you already run `gemini-web2api-go` or `AIStudio2API` yourself, select **Connect an existing backend / AIStudio2API** during sign-in and provide its `/v1` URL and API key.
107
101
 
108
- ```bash
109
- magpie plugin options magpie-gemini-web '{"studio":{"proxy":"http://127.0.0.1:7890"}}'
110
- ```
102
+ **Refreshing the model list:**
103
+ After upgrading the plugin, run `magpie provider models gemini-web` to refresh available models.
111
104
 
112
- | Option | Default | Description |
113
- | :--- | :--- | :--- |
114
- | `studio.proxy` | none | Proxy for reaching Google (http / https / socks5). The `AI_STUDIO_PROXY` environment variable works too |
115
- | `studio.baseURL` | `http://127.0.0.1:2048/v1` | Default address for connecting an existing AIStudio2API |
116
- | `studio.contextLimit` / `studio.outputLimit` | the model catalog's | Limits declared to clients; they can only lower the catalog's |
117
- | `studio.allowTools` etc. | as at the root | Override the root option of the same name for AI Studio only |
105
+ </details>
118
106
 
119
- AI Studio replies keep their citation marks such as `[cite: 1]`; they can't be stripped.
107
+ <details>
108
+ <summary><b>🛠️ AI Studio CLI Commands</b> (service status, re-login, offline install)</summary>
120
109
 
121
- ### Command line
110
+ <br>
122
111
 
123
- When an error from the plugin asks you to run a command, it gives the command with its full path, ready to copy. In the plugin's directory you can also use:
112
+ When a plugin error asks you to run a command, it includes the full ready-to-copy path. From the plugin directory, you can also run:
124
113
 
125
- | Command | What it does |
114
+ | Command | Description |
126
115
  | :--- | :--- |
127
- | `npm run studio:status` | Show the service and account status |
116
+ | `npm run studio:status` | Show local service and account status |
128
117
  | `npm run studio:start` / `studio:stop` | Start / stop the local service |
129
118
  | `npm run studio:login` | Add a Google account |
130
- | `npm run studio:relogin -- [<account>]` | Sign an expired account in again (optional when only one is) |
131
- | `npm run studio:install -- --archive <file>` | Install offline from a downloaded archive |
119
+ | `npm run studio:relogin -- [<account>]` | Re-authenticate an expired account (argument optional if only one) |
120
+ | `npm run studio:install -- --archive <file>` | Offline install from a pre-downloaded archive |
132
121
  | `node scripts/studio.mjs import <dir>` | Import existing accounts while the service is stopped |
133
- | `npm run studio:smoke` | Live acceptance run (uses account quota) |
134
-
135
- ### Security and data
136
-
137
- - The service listens on `127.0.0.1` only; Magpie keeps a locally generated API key.
138
- - Data directory: `~/.local/share/magpie-ai-studio` (override with `AI_STUDIO_DATA_DIR`). The log is `backend.log`, started afresh on the next start once it passes 10 MB.
139
- - A first setup uses port 2048, or another free port when 2048 is taken (by an AIStudio2API of your own, say), saved in the data directory's `config.json`.
140
- - The downloaded archive stays in the data directory; installing again uses it when its checksum matches.
141
- - Supported on macOS, Linux (x64 / arm64) and Windows x64.
142
-
143
- ## Native Task on macOS (experimental)
144
-
145
- On macOS, sign-in offers one more option, "macOS 原生 Task(实验性)": requests skip the Gemini Web backend and go to a local daemon that runs them in Gemini.app's own Task mode, with tool calls on its native Function Calling channel, as the model `gemini-task-argon`. Windows and Linux don't offer it; keep using one-click setup there.
122
+ | `npm run studio:smoke` | Run a live acceptance check (consumes account quota) |
146
123
 
147
- This is an alpha: it supports only the verified Gemini.app build, needs a local setup first (Gemini.app signed in, plus session templates), has passed only one live tool round trip against real Argon, and shows no usage; if an agent is interrupted before it returns a tool result, that call holds the only Task slot for up to about 4 minutes. See [native-task/README.md](native-task/README.md) for setup, session requirements and limitations.
124
+ </details>
148
125
 
149
- ## Default optimized backend and rollback
126
+ <details>
127
+ <summary><b>🔒 Security, Data Directories & Backend Version Management</b> (logs, rollback, macOS Native Task)</summary>
150
128
 
151
- Starting with plugin **0.4.1**, one-click setup uses [4.22.0-magpie.1](https://github.com/BUKOWSKIREAL/magpie-gemini-web/releases/tag/backend-v4.22.0-magpie.1). It includes the changes that previously required a manual build: stable XSRF caching, cancellation propagation for the main generation and upload requests, early completion after complete tool calls, browser headers, and verification of the returned Argon model. Your Google account still needs access to the requested model.
129
+ <br>
152
130
 
153
- **Upgrading an existing installation:** the plugin leaves a running backend alone. Stop the existing backend process (its process ID is in `backend.pid` in the data directory), then start Magpie or send a request. A stopped old official backend is upgraded automatically, preserving configuration, the cookie database and API keys. Explicitly installed local Argon builds are kept; to replace one with the published build, stop it and run `backend:install` below.
131
+ **Security & data directories:**
132
+ - Both backends listen on `127.0.0.1` only. Cookies and sessions remain on your machine; Magpie stores only a locally generated API key.
133
+ - **Gemini Web data directory:** `~/.local/share/magpie-gemini-web` (override with `GEMINI_WEB_DATA_DIR`), logs at `backend.log`. Supports macOS, Linux, and Windows (x64 / arm64).
134
+ - **AI Studio data directory:** `~/.local/share/magpie-ai-studio` (override with `AI_STUDIO_DATA_DIR`), logs at `backend.log` (rotated on next start after exceeding 10 MB). Uses port 2048 by default (or picks a free port and saves it in `config.json`). Supports macOS, Linux (x64 / arm64), and Windows x64.
135
+ - Concurrency is capped at 1, but Google account rate-limiting or flagging cannot be completely ruled out—use at your own risk.
154
136
 
155
- To roll back, stop the backend and run this from the plugin directory:
137
+ **AI Studio upgrades and model selection:**
138
+ - The plugin pins SHA-256-verified `v0.2.13-magpie.1`, based on upstream `v0.2.13`. Upgrade the plugin to update the backend. Official managed releases at or below that upstream version are upgraded on the next managed startup, preserving accounts, port and sign-in credentials.
139
+ - **Online updates are disabled in the managed backend on macOS, Linux, and Windows.** The admin page directs users to upgrade through the Magpie plugin; the update endpoint returns HTTP 403 and update checks do not contact GitHub. Independently managed external servers are unaffected. See [docs/studio-release.md](docs/studio-release.md) for the patch and reproducible build process.
140
+ - Managed Unix installs still attempt to set `package/` to `0555` as additional file protection. Permission failures do not block service, and disabling online updates does not depend on permissions. To reset by manually deleting the data directory, stop the service first, then run `chmod -R u+w "<data-dir>/package"` before deleting it; replace `<data-dir>` with the actual path.
141
+ - If a newer or custom version is installed, the plugin reports a conflict with `stop`, `install`, and `start` commands carrying the correct `--data-dir`. Stop can recover a changed listener PID and verifies its executable path before signaling it. If HTTP is down but the process is still alive, the plugin refuses to reinstall or launch a second process.
142
+ - When stopped, a replaced executable is restored from the verified pinned archive; failed verification never launches the replacement. Existing account and runtime data files are kept, but **an older backend may not read data migrated by a newer version**. Before manually downgrading, stop the service and back up the entire data directory, including `auth/` and `runtime/requests.db`. If data migration is known to have occurred, update the plugin to match the newer backend.
143
+ - The backend's base request deadline and the plugin's default response/stream-idle timeout are 30 minutes (override via `studio.requestTimeoutMs`). This allows long non-streaming replies to finish collecting on the server. A stalled backend can also take 30 minutes to time out, and its single worker can hold up later requests. Cancel a request or choose a shorter timeout when needed; shorter limits can interrupt valid long replies. Upstream controls deadline scaling for automatic continuation.
144
+ - Source review of the locally installed Magpie `v0.1.1285` (`d783df46`) found no shorter fixed total timeout on this plugin's generation path: `Provider.Do → plugin.Fetch → loader.fetch` bypasses the ordinary HTTP transport's 10-minute response-header timeout. The gateway's 5-minute `IdleTimeout` applies between requests. Clients or reverse proxies can impose shorter limits; this was not a 30-minute end-to-end waiting test.
145
+ - Models with `-build` or `assistant_route` are filtered out: they inject the Build coding assistant's own system prompt and are not offered as ordinary Agent models. Refresh with `magpie provider models ai-studio` after upgrading.
156
146
 
157
- ```bash
158
- npm run backend:install:upstream
159
- ```
160
-
161
- This installs the checksum-verified official v4.22.0 and saves the selection, so automatic starts keep using upstream. To restore the default optimized build:
147
+ **Gemini Web optimized backend upgrades & rollback:**
148
+ - One-click setup uses [4.22.0-magpie.1](https://github.com/BUKOWSKIREAL/magpie-gemini-web/releases/tag/backend-v4.22.0-magpie.1) by default (built from pinned upstream v4.22.0 with XSRF caching, request cancellation propagation, early tool-call completion, and Argon model verification).
149
+ - **Upgrading:** Running backends are not interrupted automatically. Stop the existing process (PID in `backend.pid` inside the data directory); the next Magpie launch or request will upgrade the binary while preserving config and cookies.
150
+ - **Rollback to upstream / restore optimized build** (run in the plugin directory after stopping the backend):
151
+ ```bash
152
+ npm run backend:install:upstream # Roll back and pin to official v4.22.0
153
+ npm run backend:install # Restore default optimized build
154
+ ```
155
+ - For reproducible builds and release procedures, see [docs/backend-release.md](docs/backend-release.md).
162
156
 
163
- ```bash
164
- npm run backend:install
165
- ```
157
+ **Native Task on macOS (experimental):**
158
+ On macOS, Gemini Web sign-in includes an experimental **macOS Native Task** option that routes requests through `Gemini.app`'s native Task mode (`gemini-task-argon` with native Function Calling). Currently in Alpha and requires local setup first—see [native-task/README.md](native-task/README.md).
166
159
 
167
- A failed download or checksum verification keeps the previous binary. On Windows, stop the old process before replacing its executable.
168
-
169
- The backend release includes source and build metadata. Developers with Git, Node 22+ and Go 1.27.1 can reproduce all six builds and compare the pinned hashes from this repository:
170
-
171
- ```bash
172
- npm run backend:release:build
173
- ```
160
+ </details>
174
161
 
175
- The script extracts clean sources from the pinned upstream commit and applies `patches/argon.patch`; it never changes the developer's `backend-source` working tree. See [docs/backend-release.md](docs/backend-release.md) for the release procedure.
162
+ ---
176
163
 
177
164
  ## License
178
165
 
179
- MIT. The upstream gemini-web2api-go project is also MIT (see `LICENSE-UPSTREAM`).
166
+ MIT. The upstream `gemini-web2api-go` project is also MIT (see `LICENSE-UPSTREAM`).