magpie-gemini-web 0.8.0 → 0.9.0
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.
- package/README.en.md +22 -15
- package/README.md +22 -15
- package/docs/backend-release.md +1 -1
- package/docs/studio-release.md +33 -11
- package/index.mjs +5 -1
- package/lib/backend-release.json +15 -15
- package/lib/backend.mjs +9 -2
- package/lib/native.mjs +7 -7
- package/lib/studio-native.mjs +5 -2
- package/lib/studio-release.json +21 -20
- package/lib/studio.mjs +3 -3
- package/lib/usage.mjs +55 -38
- package/package.json +2 -2
- package/patches/argon.patch +833 -166
- package/patches/studio-0.2.19-managed-config.patch +110 -0
- package/scripts/backend-argon.mjs +2 -2
- package/scripts/studio-managed-smoke.mjs +25 -3
- package/scripts/studio-release.mjs +1 -1
package/README.en.md
CHANGED
|
@@ -17,11 +17,11 @@ The plugin provides two independent providers that can be used individually or t
|
|
|
17
17
|
| **Best for** | **Coding agents (recommended)** | General chat, web-only models & web quota |
|
|
18
18
|
| **Tool calling** | **Native Function Calling**, reliable | Prompt-emulated (experimental; Flash often skips tools) |
|
|
19
19
|
| **Thinking levels** | Supported levels from the model catalog: `minimal` / `low` / `medium` / `high` | `low` (base) / `medium` (`-thinking-medium`, `gemini-4-argon` only) / `high` (`-thinking` extended thinking) |
|
|
20
|
-
| **Image input** | On by default; chat models read images |
|
|
20
|
+
| **Image input** | On by default; chat models read images | On by default; chat models read images (needs a signed-in cookie) |
|
|
21
21
|
| **Image generation** | Nano Banana models, for Magpie's image generation (Magpie v0.1.2075+, see below) | Not supported |
|
|
22
22
|
| **Sign-in method** | Sign in directly in an isolated popup browser window | Copy `cookie` from a private/incognito window |
|
|
23
23
|
| **Usage cards** | Shows models currently on cooldown and recovery times | Syncs **5-hour** & **weekly** usage and reset times from the web |
|
|
24
|
-
| **Local backend** | AIStudio2API (`v0.2.
|
|
24
|
+
| **Local backend** | AIStudio2API (`v0.2.19`) | gemini-web2api-go (`4.27.0-magpie.1` optimized build) |
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
@@ -58,7 +58,7 @@ Install **magpie-gemini-web** from the Magpie plugin market, then sign in to eit
|
|
|
58
58
|
- *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.
|
|
59
59
|
- **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.
|
|
60
60
|
- **Usage reporting:**
|
|
61
|
-
- `gemini-web`: Available only with the one-click local backend.
|
|
61
|
+
- `gemini-web`: Available only with the one-click local backend. Usage is read from Google again whenever Magpie asks for it (at most once every 30 seconds per account), so pressing refresh shows the current allowance, including usage from the Gemini app, the website or other devices. On its own, Magpie asks about once a minute while the Usage page or the menu bar's allowances panel is open, whenever it updates allowances shown in the menu bar (every 3 minutes by default), and at most once a minute while it routes requests among accounts; otherwise it doesn't ask. A failed read isn't retried on its own for 10 minutes; pressing refresh in that time retries it at once (press it again if the first press doesn't).
|
|
62
62
|
- `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.
|
|
63
63
|
|
|
64
64
|
---
|
|
@@ -67,10 +67,15 @@ Install **magpie-gemini-web** from the Magpie plugin market, then sign in to eit
|
|
|
67
67
|
|
|
68
68
|
`ai-studio` lists the Nano Banana image models your account can use (such as `gemini-3.1-flash-image` and `gemini-3-pro-image`), for Magpie's image generation. **This needs Magpie v0.1.2075 or later**, the first to take a plugin's Gemini image models as models that draw.
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
**Drawing from an agent** (pi, Claude Code, Codex and the rest alike):
|
|
71
|
+
|
|
72
|
+
1. **Pick the model to draw with:** Magpie's Settings list these models under **Images → Image generation**. Pick one (such as `ai-studio/gemini-nano-banana-2.1`), or leave it on Automatic. There's no need to tick them in any model list.
|
|
73
|
+
2. **Give the agent the drawing tool:** click **Give agents Magpie Image…** under that row, tick the agents that should draw in the Library it opens, then start a new session in the agent. With the Library turned off, the row says **Turn on the Library** instead: click that first. From the command line: `magpie library mcp add magpie-image magpie mcp image agents=pi` (several agents separated by commas, as in `agents=pi,claude`).
|
|
74
|
+
3. **Chat as usual:** keep the agent on its usual chat model and ask it to draw something. It calls the `generate_image` tool, which draws with the model from step 1 and saves the image in the project's `generated-images/` folder; reference images make it an edit.
|
|
75
|
+
|
|
76
|
+
- **Don't pick an image model as the chat model:** Magpie still keeps a plugin's models that draw in its chat model lists ([yetone/magpie#2792](https://github.com/yetone/magpie/issues/2792)). Picked there, they show no picture: an agent such as pi has no place for an image in the model's reply, so the image the model draws is dropped, while the model believes it was shown. They take no tool calls either, and have 32K–128K context windows.
|
|
77
|
+
- **Drawing from the command line:** `magpie tool generate_image "a magpie on a branch, watercolour" --size 16:9 -o magpie.png`; add `--model ai-studio/gemini-3-pro-image` to draw with another model this once. If the terminal can't find the `magpie` command (step 2's command too), click **Add to PATH** on the **Command line** row of Magpie's Settings, then open a new terminal.
|
|
72
78
|
- **Size:** `size` gives the aspect ratio. A ratio (such as `16:9` or `1:4`) is used as it is when the model takes it, else the nearest one it does; a size such as `1536x1024` is made the nearest usual ratio by Magpie first. `quality` makes no difference for these models.
|
|
73
|
-
- **Don't tick them as chat models:** Magpie still keeps a plugin's models that draw in its chat model lists ([yetone/magpie#2792](https://github.com/yetone/magpie/issues/2792)). They take no tool calls and have 32K–128K context windows, so they make poor chat models for agents.
|
|
74
79
|
- If you don't want the image models, turn them off with `studio.imageModels` (see the options below).
|
|
75
80
|
|
|
76
81
|
---
|
|
@@ -82,11 +87,11 @@ Install **magpie-gemini-web** from the Magpie plugin market, then sign in to eit
|
|
|
82
87
|
|
|
83
88
|
<br>
|
|
84
89
|
|
|
85
|
-
Tool calling
|
|
90
|
+
Tool calling and image input are enabled by default. Configure plugin options via the CLI:
|
|
86
91
|
|
|
87
92
|
```bash
|
|
88
|
-
# Turn image input on for
|
|
89
|
-
magpie plugin options magpie-gemini-web '{"allowImages":true}'
|
|
93
|
+
# Turn image input off only for Gemini Web, keeping it on for AI Studio
|
|
94
|
+
magpie plugin options magpie-gemini-web '{"allowImages":false,"studio":{"allowImages":true}}'
|
|
90
95
|
|
|
91
96
|
# Turn image input off for AI Studio
|
|
92
97
|
magpie plugin options magpie-gemini-web '{"studio":{"allowImages":false}}'
|
|
@@ -102,8 +107,8 @@ magpie plugin options magpie-gemini-web '{"studio":{"proxy":"http://127.0.0.1:78
|
|
|
102
107
|
| Option | Default | Scope | Description |
|
|
103
108
|
| :--- | :--- | :--- | :--- |
|
|
104
109
|
| `allowTools` | `true` | Shared (override via `studio.allowTools`) | Allow tool calls. When `false`, requests with tools return 400 |
|
|
105
|
-
| `allowImages` |
|
|
106
|
-
| `requestTimeoutMs` / `modelTimeoutMs` | Web: `
|
|
110
|
+
| `allowImages` | `true` | Shared (override via `studio.allowImages`) | Allow image input in a chat (an image model's reference images don't need it). Gemini Web reads images only when signed in and returns 400 otherwise |
|
|
111
|
+
| `requestTimeoutMs` / `modelTimeoutMs` | Web: `570000` / `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 |
|
|
107
112
|
| `stripCitations` | `true` | `gemini-web` only | Strip `[cite: 1]` and `[cite_start]` markers from replies and tool arguments (not supported on AI Studio) |
|
|
108
113
|
| `proxy` | none | `gemini-web` only | Proxy for the managed Gemini Web backend to reach Google (`http` / `https` / `socks5` / `socks5h`), or set `GEMINI_WEB_PROXY` env var / enter during sign-in |
|
|
109
114
|
| `baseURL` | `http://127.0.0.1:8083/v1` | `gemini-web` only | Default Gemini Web backend URL |
|
|
@@ -164,10 +169,12 @@ When a plugin error asks you to run a command, it includes the full ready-to-cop
|
|
|
164
169
|
- Both backends listen on `127.0.0.1` only. Cookies and sessions remain on your machine; Magpie stores only a locally generated API key.
|
|
165
170
|
- **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).
|
|
166
171
|
- **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.
|
|
167
|
-
-
|
|
172
|
+
- Gemini Web takes at most 2 requests at once per sign-in (AI Studio 1), adjustable in Magpie's provider settings. Google account rate-limiting or flagging cannot be completely ruled out—use at your own risk.
|
|
168
173
|
|
|
169
174
|
**AI Studio upgrades and model selection:**
|
|
170
|
-
- The plugin pins SHA-256-verified `v0.2.
|
|
175
|
+
- The plugin pins SHA-256-verified `v0.2.19-magpie.1`, based on upstream `v0.2.19`. Upgrade the plugin to update the backend. Official releases at or below that upstream version, and managed backends an older plugin installed, are upgraded on the next managed startup, preserving accounts, port and sign-in credentials.
|
|
176
|
+
- Account bindings and hedge model selections from 0.2.19 are preserved. Settings saved in the admin page, including upstream defaults, survive plugin restarts. Hedge requests remain off by default; enable them and select models in the admin page if needed.
|
|
177
|
+
- For users upgrading from 0.2.18 with `auto` enabled, hedging now applies only to `FIRST_EVENT_HEDGE_MODELS`, defaulting to Argon when that list is absent. Saving in the admin page fixes the current defaults in the file; later upstream default changes require manual adjustment. When taking over an official 0.2.19 sparse configuration, missing settings follow the plugin's initialization rules (for example, hedging becomes `off`). See the [upgrade compatibility notes](docs/studio-release.md#0219-升级兼容).
|
|
171
178
|
- **Online updates are disabled in the managed backend on macOS, Linux, and Windows.** The admin page says updates are managed by magpie-gemini-web; the update endpoint returns HTTP 409 and update checks do not contact GitHub. Independently managed external servers are unaffected. See [docs/studio-release.md](docs/studio-release.md) for how the managed build is made and reproduced.
|
|
172
179
|
- 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.
|
|
173
180
|
- 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.
|
|
@@ -177,11 +184,11 @@ When a plugin error asks you to run a command, it includes the full ready-to-cop
|
|
|
177
184
|
- 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.
|
|
178
185
|
|
|
179
186
|
**Gemini Web optimized backend upgrades & rollback:**
|
|
180
|
-
- One-click setup uses [4.
|
|
187
|
+
- One-click setup uses [4.27.0-magpie.1](https://github.com/BUKOWSKIREAL/magpie-gemini-web/releases/tag/backend-v4.27.0-magpie.1) by default (built from pinned upstream v4.27.0 with XSRF caching, request cancellation propagation, early tool-call completion, and Argon model verification). Chat requests are timed by silence: while Google queues a request it sends a heartbeat every 60 s, and the backend waits through it for the first words. A try is given up, and retried, only after Google has sent nothing for `request_timeout_sec` (180 s by default), so a long reply that keeps coming is never cut off either.
|
|
181
188
|
- **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.
|
|
182
189
|
- **Rollback to upstream / restore optimized build** (run in the plugin directory after stopping the backend):
|
|
183
190
|
```bash
|
|
184
|
-
npm run backend:install:upstream # Roll back and pin to official v4.
|
|
191
|
+
npm run backend:install:upstream # Roll back and pin to official v4.27.0
|
|
185
192
|
npm run backend:install # Restore default optimized build
|
|
186
193
|
```
|
|
187
194
|
- For reproducible builds and release procedures, see [docs/backend-release.md](docs/backend-release.md).
|
package/README.md
CHANGED
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
| **适用场景** | **推荐 Coding Agent 使用** | 日常对话、使用网页版专属模型与额度 |
|
|
18
18
|
| **工具调用** | **原生 Function Calling**,稳定可靠 | 提示词模拟(实验性,Flash 系列常不调工具) |
|
|
19
19
|
| **思考档位** | 按模型目录提供 `minimal` / `low` / `medium` / `high` 中支持的档位 | `low`(普通)/ `medium`(`-thinking-medium`,仅 `gemini-4-argon`)/ `high`(`-thinking` 扩展思考) |
|
|
20
|
-
| **图片输入** | 默认开启,对话模型可以读图 |
|
|
20
|
+
| **图片输入** | 默认开启,对话模型可以读图 | 默认开启,对话模型可以读图(需登录态挂 Cookie) |
|
|
21
21
|
| **图片生成** | Nano Banana 系列模型,供 Magpie 的图片生成使用(需要 Magpie v0.1.2075+,见下文) | 不支持 |
|
|
22
22
|
| **登录方式** | 弹出独立浏览器窗口直接登录 Google | 用无痕窗口登录并复制 `cookie` |
|
|
23
23
|
| **额度卡片** | 显示冷却中的模型与恢复时间 | 同步网页版 **5 小时** 与 **每周** 用量及重置时间 |
|
|
24
|
-
| **本地后端** | AIStudio2API (`v0.2.
|
|
24
|
+
| **本地后端** | AIStudio2API (`v0.2.19`) | gemini-web2api-go (`4.27.0-magpie.1` 优化版) |
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
- *旧版迁移(Gemini Web)*:若后端里已有早期版本添加的账号,在登录时选 **「添加本地后端里已有的 Google 账号」** 即可生成独立卡片,随后可删掉旧的 `API key …` 汇总卡片。
|
|
59
59
|
- **账号池自动调度**:请求实际使用哪个账号由本地后端决定(Gemini Web 在账号池中轮流挑选;AI Studio 先用一个,进入冷却再切下一个)。在 Magpie 界面切换卡片不会改变后端的账号调度。
|
|
60
60
|
- **用量刷新说明**:
|
|
61
|
-
- `gemini-web
|
|
61
|
+
- `gemini-web`:仅一键配置的本地后端可读取用量。Magpie 每次来查都会向 Google 重新读取(同一账号 30 秒内只读一次),点刷新即显示最新额度,包括在 Gemini 官方 App、网页或其他设备上的用量。Magpie 自己来查的频率:用量页或菜单栏的额度面板开着时约每分钟一次;菜单栏显示任何一家额度时随菜单栏更新(默认每 3 分钟);经 Magpie 转发请求时最多每分钟一次;都没有时不查。读取失败后 10 分钟内不自动重试,这期间点刷新会立即重试,若未生效再点一次。
|
|
62
62
|
- `ai-studio`:AI Studio 不提供剩余总额度,卡片会展示当前账号正在冷却的模型、恢复时间或重新登录提示。
|
|
63
63
|
|
|
64
64
|
---
|
|
@@ -67,10 +67,15 @@
|
|
|
67
67
|
|
|
68
68
|
`ai-studio` 会列出账号可用的 Nano Banana 系列图像模型(如 `gemini-3.1-flash-image`、`gemini-3-pro-image`),供 Magpie 的图片生成使用。**需要 Magpie v0.1.2075 及以上**:从这个版本起,Magpie 才会把插件的 Gemini 图像模型列为出图模型。
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
**让 Agent 出图**(pi、Claude Code、Codex 等都一样):
|
|
71
|
+
|
|
72
|
+
1. **选画图模型**:Magpie 设置的 **Images → Image generation** 会直接列出这些模型,选中一个(如 `ai-studio/gemini-nano-banana-2.1`),或保持 Automatic(自动)。不用在模型列表里勾选它们。
|
|
73
|
+
2. **把画图工具交给 Agent**:点这一行下面的 **Give agents Magpie Image…**,在打开的 Library 里勾选要出图的 Agent,然后新开一个 Agent 会话。Library 被关掉时,这里显示的是 **Turn on the Library**,先点它。也可以用命令行:`magpie library mcp add magpie-image magpie mcp image agents=pi`(多个 Agent 用逗号隔开,如 `agents=pi,claude`)。
|
|
74
|
+
3. **照常对话**:Agent 继续用平常的对话模型,跟它说「画一张……」就行。它会调用 `generate_image` 工具,用第 1 步选的模型出图,图片存进项目的 `generated-images/` 文件夹;带参考图就是改图。
|
|
75
|
+
|
|
76
|
+
- **别把图像模型选成对话模型**:Magpie 目前会把能出图的插件模型也留在对话模型列表里([yetone/magpie#2792](https://github.com/yetone/magpie/issues/2792))。选了也看不到图:pi 等 Agent 的回复里放不下图片,模型画出的图会被直接丢掉,模型却以为已经发出去了。它们也不支持工具调用,上下文只有 32K–128K。
|
|
77
|
+
- **在命令行出图**:`magpie tool generate_image "a magpie on a branch, watercolour" --size 16:9 -o magpie.png`,加 `--model ai-studio/gemini-3-pro-image` 可以临时换模型。终端里找不到 `magpie` 命令时(第 2 步的命令也一样),在 Magpie 设置的 **Command line** 一行点 **Add to PATH**,再开一个新终端。
|
|
72
78
|
- **尺寸**:`size` 决定宽高比:写比例(如 `16:9`、`1:4`)时,模型支持就照用,不支持就取它支持的最接近的比例;写 `1536x1024` 这样的尺寸时,Magpie 先换成最接近的常用比例。`quality` 对这些模型不起作用。
|
|
73
|
-
- **别把它们勾进对话模型**:Magpie 目前会把能出图的插件模型也留在对话模型列表里([yetone/magpie#2792](https://github.com/yetone/magpie/issues/2792))。它们不支持工具调用,上下文也只有 32K–128K,不适合当 Agent 的对话模型。
|
|
74
79
|
- 不需要图像模型时,可以用 `studio.imageModels` 关掉(见下方选项)。
|
|
75
80
|
|
|
76
81
|
---
|
|
@@ -82,11 +87,11 @@
|
|
|
82
87
|
|
|
83
88
|
<br>
|
|
84
89
|
|
|
85
|
-
|
|
90
|
+
工具调用与图片输入默认开启。可通过命令行修改插件配置:
|
|
86
91
|
|
|
87
92
|
```bash
|
|
88
|
-
#
|
|
89
|
-
magpie plugin options magpie-gemini-web '{"allowImages":true}'
|
|
93
|
+
# 仅关闭 Gemini Web 的图片输入,保留 AI Studio 的图片输入
|
|
94
|
+
magpie plugin options magpie-gemini-web '{"allowImages":false,"studio":{"allowImages":true}}'
|
|
90
95
|
|
|
91
96
|
# 关闭 AI Studio 的图片输入
|
|
92
97
|
magpie plugin options magpie-gemini-web '{"studio":{"allowImages":false}}'
|
|
@@ -102,8 +107,8 @@ magpie plugin options magpie-gemini-web '{"studio":{"proxy":"http://127.0.0.1:78
|
|
|
102
107
|
| 选项 | 默认值 | 适用范围 | 说明 |
|
|
103
108
|
| :--- | :--- | :--- | :--- |
|
|
104
109
|
| `allowTools` | `true` | 共用(可用 `studio.allowTools` 单独覆盖) | 允许工具调用。设为 `false` 时带工具的请求返回 400 |
|
|
105
|
-
| `allowImages` |
|
|
106
|
-
| `requestTimeoutMs` / `modelTimeoutMs` | Web:`
|
|
110
|
+
| `allowImages` | `true` | 共用(可用 `studio.allowImages` 单独覆盖) | 允许对话中的图片输入(图像模型的参考图不受它限制)。Gemini Web 读图需要登录,未登录时返回 400 |
|
|
111
|
+
| `requestTimeoutMs` / `modelTimeoutMs` | Web:`570000` / `10000`;Studio:`1800000` / `10000` | 共用(`studio.*` 可覆盖) | 单次等待后端 / 拉取模型列表的超时(毫秒);收到流数据后重新计时,显式配置优先 |
|
|
107
112
|
| `stripCitations` | `true` | 仅 `gemini-web` | 剥离回复与工具参数中的 `[cite: 1]`、`[cite_start]` 标记(AI Studio 不支持剥离) |
|
|
108
113
|
| `proxy` | 无 | 仅 `gemini-web` | 一键配置后端访问 Google 的代理(`http` / `https` / `socks5` / `socks5h`),也可用环境变量 `GEMINI_WEB_PROXY` 或在登录第一步填写 |
|
|
109
114
|
| `baseURL` | `http://127.0.0.1:8083/v1` | 仅 `gemini-web` | Gemini Web 默认后端地址 |
|
|
@@ -164,10 +169,12 @@ magpie plugin options magpie-gemini-web '{"studio":{"proxy":"http://127.0.0.1:78
|
|
|
164
169
|
- 两个后端均只监听 `127.0.0.1`,Cookie 与登录态仅保存在本机,Magpie 仅保存本地生成的随机 API Key。
|
|
165
170
|
- **Gemini Web 数据目录**:`~/.local/share/magpie-gemini-web`(可通过 `GEMINI_WEB_DATA_DIR` 修改),日志位于 `backend.log`。支持 macOS、Linux、Windows(x64 / arm64)。
|
|
166
171
|
- **AI Studio 数据目录**:`~/.local/share/magpie-ai-studio`(可通过 `AI_STUDIO_DATA_DIR` 修改),日志位于 `backend.log`(超 10 MB 下次启动自动轮转)。默认使用 2048 端口,被占用时自动顺延并记录在 `config.json`。支持 macOS、Linux(x64 / arm64)与 Windows x64。
|
|
167
|
-
-
|
|
172
|
+
- Gemini Web 每个登录同时最多 2 个请求(AI Studio 为 1),可在 Magpie 的 provider 设置里调整;仍无法完全排除 Google 账号风控风险,请自行评估使用。
|
|
168
173
|
|
|
169
174
|
**AI Studio 升级与模型范围:**
|
|
170
|
-
- 插件固定使用经过 SHA-256 校验的 `v0.2.
|
|
175
|
+
- 插件固定使用经过 SHA-256 校验的 `v0.2.19-magpie.1`(基于上游 `v0.2.19`),通过升级插件更新后端。同基线或更旧的官方版、以及旧版插件装的托管后端,在下次管理启动时自动升级,保留账号、端口与登录凭据。
|
|
176
|
+
- 0.2.19 的账号绑定与备用请求模型设置会保留;管理页保存的默认值不会在重启后被改回插件默认值。备用请求默认关闭,需要时可在管理页开启并选择模型。
|
|
177
|
+
- 从 0.2.18 升级且已开启 `auto` 时,备用请求从所有模型缩为 `FIRST_EVENT_HEDGE_MODELS` 中的模型,未配置该列表时仅有 Argon。管理页完整保存会固定当时的默认值,后续上游默认值变化需要手动调整。接管官方 0.2.19 的稀疏配置时,缺失项会按插件规则补齐(例如备用请求变为 `off`);详见[升级兼容说明](docs/studio-release.md#0219-升级兼容)。
|
|
171
178
|
- **托管后端已在 macOS、Linux、Windows 统一禁用在线更新**:管理页提示“更新由 magpie-gemini-web 管理”,更新接口返回 HTTP 409,检查更新也不会访问 GitHub。用户自行连接的外部服务不受影响。托管构建方式和可复现构建流程见 [docs/studio-release.md](docs/studio-release.md)。
|
|
172
179
|
- Unix 的 `package/` 仍尽力设置为 `0555`,作为额外的文件保护;权限设置失败不阻断服务,在线更新的禁用也不依赖该权限。若要手动删除数据目录来重置,请先停止服务,再运行 `chmod -R u+w "<数据目录>/package"` 恢复可写权限,然后删除;将 `<数据目录>` 替换为实际路径。
|
|
173
180
|
- 若自行更新到更新版或定制版,插件会提示版本冲突,并提供带正确 `--data-dir` 的 `stop`、`install`、`start` 命令。停止时会找回更新后的监听进程 PID,并核对可执行文件路径;无法核实身份就不会发送终止信号。HTTP 端口关闭但进程尚未退出时,插件不会重装或启动第二个进程。
|
|
@@ -177,11 +184,11 @@ magpie plugin options magpie-gemini-web '{"studio":{"proxy":"http://127.0.0.1:78
|
|
|
177
184
|
- 模型列表过滤 `-build` / `assistant_route` 模型:这类模型附带 Build 写代码助手的系统提示词,不作为普通 Agent 模型提供。升级后可执行 `magpie provider models ai-studio` 刷新列表。
|
|
178
185
|
|
|
179
186
|
**Gemini Web 优化后端升级与回退:**
|
|
180
|
-
- 插件默认使用本仓库发布的 [4.
|
|
187
|
+
- 插件默认使用本仓库发布的 [4.27.0-magpie.1](https://github.com/BUKOWSKIREAL/magpie-gemini-web/releases/tag/backend-v4.27.0-magpie.1)(基于上游 v4.27.0 集成 XSRF 缓存、请求取消传播、工具调用提前收尾与 Argon 校验补丁)。对话请求按上游沉默计时:Google 让请求排队时每 60 秒发一次心跳,后端会一直等到出字;连续 `request_timeout_sec`(默认 180 秒)没有任何数据才放弃这一次并重试,还在出字的长回复也不会被截断。
|
|
181
188
|
- **旧版升级**:插件不会打断运行中的后端。先停止旧进程(PID 见数据目录 `backend.pid`),下次启动 Magpie 或发请求时会自动更新二进制并保留原有配置与账号。
|
|
182
189
|
- **回退官方版 / 恢复优化版**(停止后端后在插件目录执行):
|
|
183
190
|
```bash
|
|
184
|
-
npm run backend:install:upstream # 回退并固定使用官方 v4.
|
|
191
|
+
npm run backend:install:upstream # 回退并固定使用官方 v4.27.0
|
|
185
192
|
npm run backend:install # 恢复默认优化版
|
|
186
193
|
```
|
|
187
194
|
- 源码复现构建与发布流程见 [docs/backend-release.md](docs/backend-release.md)。
|
package/docs/backend-release.md
CHANGED
|
@@ -30,4 +30,4 @@ Existing running processes are left alone to avoid interrupting requests. Once a
|
|
|
30
30
|
|
|
31
31
|
New cookie imports require the running backend to advertise `capabilities.account_proxy_binding: true` at `/`. The plugin checks this before changing the proxy pool and again before submitting a cookie, so a reused older or upstream backend cannot silently ignore `proxy_id`. Unsupported builds receive instructions to stop the old process and run the installed plugin's CLI with `install --data-dir=<path>`. This explicitly selects the optimized channel, including for previous upstream or custom-build installations. The check does not interrupt existing conversations. Release smoke verifies the capability and actual proxy selection; version strings alone do not establish support.
|
|
32
32
|
|
|
33
|
-
An explicit `npm run backend:install:upstream` installs the pinned upstream v4.
|
|
33
|
+
An explicit `npm run backend:install:upstream` installs the pinned upstream v4.27.0 and persists `upstream` in `backend-channel.json`. Automatic startup respects that choice. `npm run backend:install` returns to the optimized channel. Stop a running backend before replacing it, particularly on Windows. Explicit local Argon builds remain trusted through their existing build manifest.
|
package/docs/studio-release.md
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
# AI Studio 托管后端构建
|
|
2
2
|
|
|
3
|
-
插件使用 `0.2.
|
|
3
|
+
插件使用 `0.2.19-magpie.1`,基于 AIStudio2API `v0.2.19` 的固定 commit。上游版本、commit、Go 版本、C/C++ 工具链与 SpiderMonkey 静态库(`toolchains`)、补丁列表、安装包及二进制 SHA-256 均记录在 `lib/studio-release.json`。`upstream.camoufox` 是这个 commit 要求的 Camoufox 版本(上游 `internal/camoufoxnative/download.go` 里的 `camoufoxRelease`),更新上游 commit 时要一起核对,构建脚本发现不一致会报错。MIT 许可见 `LICENSE-AISTUDIO`。
|
|
4
4
|
|
|
5
|
-
## 升级兼容
|
|
5
|
+
## 0.2.19 升级兼容
|
|
6
|
+
|
|
7
|
+
- 基线为上游 `v0.2.19`(`0451f26248b7ce263a4fdbf92b280897cb79d74f`)。包含无正文输出时的函数调用格式错误/断流/流尾 5xx 重试、复杂 Schema 修复、SpiderMonkey 堆收缩和 HTTP/2 连接复用。Camoufox、SpiderMonkey 静态库和固定工具链沿用上一版。
|
|
8
|
+
- 新增 `API_KEY_ACCOUNTS` 与 `FIRST_EVENT_HEDGE_MODELS`:插件保留管理页保存的值,并隔离宿主环境的同名变量。账号绑定约束后端选号,不会把 Magpie 卡片切换变成账号切换。
|
|
9
|
+
- 上游默认 `FIRST_EVENT_HEDGE=auto`,仅对 `gemini-4-argon` 发备用请求。托管插件在未配置时明确写入 `off`,保留已有单 Worker 策略,避免升级后增加额度消耗;已有设置原样保留,用户可以在管理页开启并选择模型。
|
|
10
|
+
- 从 0.2.18 升级时,已开启 `FIRST_EVENT_HEDGE=auto` 的用户需要留意模型范围:0.2.18 对所有模型生效,0.2.19 只对 `FIRST_EVENT_HEDGE_MODELS` 列出的模型生效。旧配置没有该列表时,默认只剩 `gemini-4-argon`;需要其他模型时在管理页选择并保存。
|
|
11
|
+
- `patches/studio-0.2.19-managed-config.patch` 为配置包增加链接时标识 `internal/config.managedBy=magpie-gemini-web`。托管构建跳过旧全量 `.env` 的自动改写,并继续完整保存可编辑设置,包括等于上游默认值的值。否则用户保存的搜索开关、轮转策略和并发数会从 `.env` 消失,插件下次启动又补回自己的默认值;显式关闭的备用请求和 5 分钟超时也可能被迁移重置。环境变量控制的设置仍锁定,并保留文件里的原值。未设置该构建标识的上游构建仍使用原来的稀疏保存与迁移逻辑。
|
|
12
|
+
- 请求正文迁移补丁原样保留。配置补丁测试覆盖旧设置保留、默认值完整保存和环境锁定;真实二进制冒烟测试覆盖管理 API 保存、插件重启、账号绑定和备用请求模型持久化。
|
|
13
|
+
- 完整保存的代价是固定当时的上游默认值:在管理页保存一次后,`CONTINUATION_PROMPT`、`FIRST_EVENT_HEDGE_MODELS`、`LOG_MAX_TOTAL_MB` 等可编辑设置都会明确写入文件。以后上游修改默认提示词、模型列表或其他默认值时,已保存的配置不会自动跟随,需要用户在管理页调整。这延续了托管 0.2.18 的全量保存行为。
|
|
14
|
+
- 接管官方 0.2.19 安装时,官方稀疏 `.env` 中缺失的项会按插件的初始化规则补齐。例如官方默认 `FIRST_EVENT_HEDGE=auto` 保存后可能不在文件里,接管后就会补成插件默认的 `off`。文件无法区分“刻意选择上游默认值”和“从未设置”;接管后请在管理页核对需要保留的设置。
|
|
15
|
+
|
|
16
|
+
## 既有升级兼容
|
|
6
17
|
|
|
7
18
|
- 上游 v0.2.18 删除了纯 Go(goja)的 WAA 后端 `go`,改为经 CGO 内嵌 Firefox 的 JS 引擎 SpiderMonkey(`WAA_BACKEND=spidermonkey`)。插件固定使用 `spidermonkey`:生成仍在服务进程内完成,不需要浏览器;Camoufox 仍只用于 Google 登录。上游默认的 `camoufox` 后端未采用。
|
|
8
19
|
- SpiderMonkey 使用上游自己发布时用的预编译静态库(`Mag1cFall/firefox` 的 `v152.0.4-aistudio2api.1` release),每个目标的归档名与 SHA-256 记录在 `toolchains.spidermonkey`,构建时下载到 `studio-build/toolchains/` 并校验。头文件与库经 `CGO_CXXFLAGS` / `CGO_LDFLAGS` 传入,库名由上游 `internal/waa/mozjs` 的 `#cgo` 指令给出,与上游 `.github/actions/spidermonkey` 一致。
|
|
@@ -10,17 +21,19 @@
|
|
|
10
21
|
- Gemini 原生接口(`/v1beta`,Magpie 画图用)在 v0.2.18 按 Gemini 的方式拒绝密钥:错误密钥返回 400 `API_KEY_INVALID`,缺少密钥返回 403。插件把这两种情况当作 401 处理,提示重新登录;Google 自身返回的 403(如 code 7 “The caller does not have permission”)属于账号问题,原样传回。
|
|
11
22
|
- 上游 v0.2.17 改用需要 CGO 的原生 SQLite。账号和配置沿用原目录;首次打开旧数据库会整理空闲页。降级前应停止服务并备份完整数据目录,旧版不保证能读取迁移后的数据。
|
|
12
23
|
- 上游(v0.2.17 起,v0.2.18 仍然)会删除旧的请求正文 `bodies` 表。`patches/studio-0.2.17-preserve-request-bodies.patch` 改为在事务内压缩并迁移到 `request_bodies`,已有新版同 ID 记录优先,成功后才删除旧表;失败回滚。补丁原样适用于 v0.2.18,供从 0.2.16 及更早版本直接升级的用户使用;它包含旧正文读取、重复打开及迁移失败回滚测试,随上游测试一起运行。
|
|
13
|
-
- 新增的 `FIRST_EVENT_HEDGE`
|
|
24
|
+
- 新增的 `FIRST_EVENT_HEDGE` 保留管理页保存的值,同时隔离宿主环境同名变量。托管插件在未配置时设为 `off`。备用请求需要空闲账号和 Worker;插件默认单 Worker,不自动提高并发。
|
|
14
25
|
- 模型档位优先使用 `/v1/models` 返回的 `thinking_levels`;旧外部服务未返回该字段时沿用四档。Playground 通道、托管更新限制及插件默认并发保持原设置。
|
|
15
26
|
- macOS 与 Windows 都可能使用系统代理;显式代理及管理页设置仍优先,宿主的 `HTTP_PROXY` 等变量不传入服务。
|
|
16
27
|
|
|
17
28
|
## 在线更新策略
|
|
18
29
|
|
|
19
|
-
上游从 v0.2.14 起原生支持分发方管理更新。构建时通过 `-ldflags`
|
|
30
|
+
上游从 v0.2.14 起原生支持分发方管理更新。构建时通过 `-ldflags` 写入以下值:
|
|
20
31
|
|
|
21
|
-
- `internal/app.version=v0.2.
|
|
32
|
+
- `internal/app.version=v0.2.19-magpie.1`:明确的版本标识。同基线或更旧的官方版、以及更旧的托管版需要升级;更新的官方版、更新的托管版或不认识的定制版仍提示冲突。
|
|
22
33
|
- `internal/app.managedBy=magpie-gemini-web`:`GET /api/update`(包括 `?refresh=1`)只返回本地版本、`mode: managed` 和 `managed_by`,不访问 GitHub;`POST /api/update` 返回 HTTP 409,不下载、不替换文件、不重启。管理页显示“更新由 magpie-gemini-web 管理”。
|
|
23
34
|
|
|
35
|
+
`internal/config.managedBy=magpie-gemini-web` 同时启用上面的配置兼容补丁。
|
|
36
|
+
|
|
24
37
|
构建不带 `desktop` 标签,不包含桌面窗口。普通插件升级、账户登录、模型调用及管理功能继续保留,用户自行连接的外部服务不受影响。
|
|
25
38
|
|
|
26
39
|
## 复现构建
|
|
@@ -93,9 +106,18 @@ AI_STUDIO_TEST_ARCHIVE=/absolute/path/to/archive.tar.gz npm test
|
|
|
93
106
|
|
|
94
107
|
真实安装验证检查旧版请求正文迁移及重启后可读、管理页保存的备用请求设置、启动、版本、GET 更新状态、POST 更新返回 409、二进制及 PID 不变、管理页面显示托管提示、停止与状态。`.github/workflows/studio.yml` 在五种系统/架构的原生 runner 上重新构建、对比 SHA-256 并运行该验证;本机交叉编译不能代替 Linux/Windows 真机验证。
|
|
95
108
|
|
|
96
|
-
## 0.2.
|
|
109
|
+
## 0.2.19 升级验证(2026-11-02)
|
|
110
|
+
|
|
111
|
+
- 五个平台的候选构建([run 41378024737](https://github.com/BUKOWSKIREAL/magpie-gemini-web/actions/runs/41378024737))通过上游测试、真实安装冒烟验证及插件测试;安装包和二进制 pin 来自该次构建。Windows 首次在安装前的 PowerShell 进程查询超时,失败作业重跑通过,未修改测试或放宽超时。提交 pin 后仍需由严格验证工作流在新 runner 上重建并逐一比对哈希,结果见升级 PR。
|
|
112
|
+
- 本地使用 CI 的 darwin-arm64 安装包运行完整插件测试:212 项通过、无跳过;Python bridge 测试 41 项通过。打包检查包含配置补丁,不包含本地构建和账号数据。
|
|
113
|
+
- 从用户界面操作 Magpie 和本地管理页:刷新模型、测试 Argon(界面报告 4.7 秒响应),并确认生图选择器列出五个 AI Studio 图片模型。管理页实际修改账号绑定、每账号并发、轮转策略、搜索模型别名、备用请求开关及模型,保存后完整重启服务;六项均在界面和 API 中保留。测试后恢复原值并再次重启核对。
|
|
114
|
+
- 通过真实 Magpie 网关调用 `gemini-4-argon`,九项检查全部通过:无登录浏览器启动、两轮原生工具调用、缺少回传签名时续接、字面引用文本保留、下一轮对话读取两次工具结果、取消活跃请求、取消后再次调用、后端进程重启后用原登录继续工具历史,以及结束时无登录浏览器。重启恢复约 30 秒。
|
|
115
|
+
- 通过 Magpie 的 `generate_image` 工具调用 `ai-studio/gemini-3.1-flash-image`,请求 16:9 水彩喜鹊,实际返回 1376×768 JPEG,已打开检查画面。
|
|
116
|
+
- 验证使用现有已登录账号;Google 新登录和重新登录流程本次未验证。升级前已备份完整本地数据目录;本机后端已升级,临时调整的设置和 Magpie 供应商开关均已恢复。此分支未 merge,未发布后端 release 或 npm 包。
|
|
117
|
+
|
|
118
|
+
## 0.2.18 升级验证(2026-10-30,历史记录)
|
|
97
119
|
|
|
98
|
-
|
|
120
|
+
以下为上一版 `0.2.18-magpie.1` 的验证结果,不代表 0.2.19。
|
|
99
121
|
|
|
100
122
|
- 首次候选构建(run 41025535280)中,Linux x64/arm64 在上游测试 `TestUserCacheRootWithoutEnvironment` 的 `t.Setenv` 处崩溃(见上文环境变量拦截函数),Windows 的 macOS 本机交叉编译结果与 CI 不同(见上文 C++ 运行库)。两处修复后的候选构建(run 41033635405)五个平台都通过上游测试、真实安装冒烟验证(含 `waa_backend=spidermonkey`、`search_model_aliases=false`)与插件测试。
|
|
101
123
|
- 跨机器一致性:Linux x64/arm64 与 Windows x64 的 CI 候选哈希与 macOS arm64 本机交叉编译完全一致;darwin-arm64 两次 CI 构建得到相同哈希。pin 来自第二次候选构建,随后的严格验证构建(run 41036094948)在五个平台的全新 runner 上重新构建,哈希与 pin 完全一致,冒烟验证与插件测试通过。
|
|
@@ -115,14 +137,14 @@ AI_STUDIO_TEST_ARCHIVE=/absolute/path/to/archive.tar.gz npm test
|
|
|
115
137
|
- 新版 Google 登录/生成端到端验证尚未完成。
|
|
116
138
|
- 此分支未发布后端 release 或 npm 包。本机日常后端仍使用 `0.2.16-magpie.1`,新版仅在临时数据目录运行。
|
|
117
139
|
|
|
118
|
-
发布前必须审查各平台 CI 与构建记录,再将安装包及许可证上传到本仓库 `studio-v0.2.
|
|
140
|
+
发布前必须审查各平台 CI 与构建记录,再将安装包及许可证上传到本仓库 `studio-v0.2.19-magpie.1` release。该 release 的安装包可公开下载后,才能发布 npm `0.9.0`,否则新安装会遇到 404。合并 PR 不代表已经满足发布条件;构建脚本及验证 CI 不自动发布 release 或 npm 包。
|
|
119
141
|
|
|
120
142
|
本地试用建议使用独立数据目录:
|
|
121
143
|
|
|
122
144
|
```bash
|
|
123
|
-
node scripts/studio.mjs install --data-dir /path/to/studio-
|
|
124
|
-
node scripts/studio.mjs start --data-dir /path/to/studio-
|
|
125
|
-
node scripts/studio.mjs stop --data-dir /path/to/studio-
|
|
145
|
+
node scripts/studio.mjs install --data-dir /path/to/studio-019-trial --archive /absolute/path/to/archive
|
|
146
|
+
node scripts/studio.mjs start --data-dir /path/to/studio-019-trial
|
|
147
|
+
node scripts/studio.mjs stop --data-dir /path/to/studio-019-trial
|
|
126
148
|
```
|
|
127
149
|
|
|
128
150
|
使用现有账号数据测试前,先停止旧服务并备份;不要让两个进程同时写同一个数据目录。
|
package/index.mjs
CHANGED
|
@@ -102,7 +102,11 @@ export const GeminiWebPlugin = async (_input, options = {}) => {
|
|
|
102
102
|
auth: {
|
|
103
103
|
provider: ID,
|
|
104
104
|
icon: PLUGIN_ICON,
|
|
105
|
-
|
|
105
|
+
// Two at once per sign-in, as a person with two Gemini tabs: an agent's first turn and
|
|
106
|
+
// the session title it asks for alongside no longer wait one behind the other, which
|
|
107
|
+
// Gemini Web can take minutes to answer (#33). The backend still caps each way out to
|
|
108
|
+
// Google (per-IP limits), and Magpie's own setting on the provider goes over this.
|
|
109
|
+
maxConcurrency: 2,
|
|
106
110
|
methods: [{
|
|
107
111
|
type: 'oauth',
|
|
108
112
|
label: '一键配置本地 Gemini Web(推荐)',
|
package/lib/backend-release.json
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.
|
|
2
|
+
"version": "4.27.0-magpie.1",
|
|
3
3
|
"repository": "BUKOWSKIREAL/magpie-gemini-web",
|
|
4
|
-
"tag": "backend-v4.
|
|
4
|
+
"tag": "backend-v4.27.0-magpie.1",
|
|
5
5
|
"upstream": {
|
|
6
6
|
"repository": "https://github.com/zexadev/gemini-web2api-go.git",
|
|
7
|
-
"commit": "
|
|
7
|
+
"commit": "e97cfccc7e68e356ac504ba220e0b004382029a8"
|
|
8
8
|
},
|
|
9
9
|
"goVersion": "1.27.1",
|
|
10
10
|
"binaries": {
|
|
11
11
|
"darwin-arm64": {
|
|
12
|
-
"asset": "gemini-web2api-go_v4.
|
|
13
|
-
"sha256": "
|
|
12
|
+
"asset": "gemini-web2api-go_v4.27.0-magpie.1_darwin_arm64",
|
|
13
|
+
"sha256": "ffc3c4c23fcf1c5000bae4dc75e6677a9ace067914f67099d361d32ec759d70b"
|
|
14
14
|
},
|
|
15
15
|
"darwin-x64": {
|
|
16
|
-
"asset": "gemini-web2api-go_v4.
|
|
17
|
-
"sha256": "
|
|
16
|
+
"asset": "gemini-web2api-go_v4.27.0-magpie.1_darwin_amd64",
|
|
17
|
+
"sha256": "9e6c907a37d890cab5d89797f32072ff19e9b473c607770205c9f8628f18a177"
|
|
18
18
|
},
|
|
19
19
|
"linux-x64": {
|
|
20
|
-
"asset": "gemini-web2api-go_v4.
|
|
21
|
-
"sha256": "
|
|
20
|
+
"asset": "gemini-web2api-go_v4.27.0-magpie.1_linux_amd64",
|
|
21
|
+
"sha256": "043e4de4672ed3e614cea44268b7c9309ffa87a368b99ac40413e7cd5e833839"
|
|
22
22
|
},
|
|
23
23
|
"linux-arm64": {
|
|
24
|
-
"asset": "gemini-web2api-go_v4.
|
|
25
|
-
"sha256": "
|
|
24
|
+
"asset": "gemini-web2api-go_v4.27.0-magpie.1_linux_arm64",
|
|
25
|
+
"sha256": "0c243071655d8b54714da7e30a6c30a847a4813b0be674cc9a9fec6a1464bb86"
|
|
26
26
|
},
|
|
27
27
|
"win32-x64": {
|
|
28
|
-
"asset": "gemini-web2api-go_v4.
|
|
29
|
-
"sha256": "
|
|
28
|
+
"asset": "gemini-web2api-go_v4.27.0-magpie.1_windows_amd64.exe",
|
|
29
|
+
"sha256": "c6a093ca0bb71246df3f21d7b061ef73064ace274d612acdfbffe704d9ce60b2"
|
|
30
30
|
},
|
|
31
31
|
"win32-arm64": {
|
|
32
|
-
"asset": "gemini-web2api-go_v4.
|
|
33
|
-
"sha256": "
|
|
32
|
+
"asset": "gemini-web2api-go_v4.27.0-magpie.1_windows_arm64.exe",
|
|
33
|
+
"sha256": "a4f969c0a4f3e6f21f409f597e3d29344807cf417bcfba645cb646af6e9e3fd3"
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
package/lib/backend.mjs
CHANGED
|
@@ -137,7 +137,8 @@ export function settings(options = {}) {
|
|
|
137
137
|
allowTools = options.allowTools;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
// On by default: multimodal chat models read images in a chat.
|
|
141
|
+
let allowImages = true;
|
|
141
142
|
if (options.allowImages !== undefined) {
|
|
142
143
|
if (typeof options.allowImages !== 'boolean') {
|
|
143
144
|
throw new Error('Invalid option allowImages: must be a boolean');
|
|
@@ -165,7 +166,13 @@ export function settings(options = {}) {
|
|
|
165
166
|
throw new Error('Invalid option outputLimit: cannot exceed contextLimit');
|
|
166
167
|
}
|
|
167
168
|
|
|
168
|
-
|
|
169
|
+
// The backend sends nothing until a reply's first words, and Gemini Web can queue a request
|
|
170
|
+
// for minutes before them (3.6 Flash: 48 s to 6.5 minutes), sending the backend only a heartbeat
|
|
171
|
+
// a minute, which it waits through. The plugin can't tell that queue from a stuck backend, so
|
|
172
|
+
// it waits as long as it may: under the 10 minutes Magpie gives a provider to begin answering,
|
|
173
|
+
// so this timeout reaches the client rather than Magpie's. That also outlasts
|
|
174
|
+
// 4.26.0-magpie.1's three tries of 180 s each, 2 s apart: 544 s (#33).
|
|
175
|
+
let requestTimeoutMs = 570000;
|
|
169
176
|
if (options.requestTimeoutMs !== undefined) {
|
|
170
177
|
if (!Number.isInteger(options.requestTimeoutMs) || options.requestTimeoutMs <= 0) {
|
|
171
178
|
throw new Error('Invalid option requestTimeoutMs: must be a positive integer');
|
package/lib/native.mjs
CHANGED
|
@@ -10,16 +10,16 @@ export const BACKEND_VERSION = `v${release.version}`;
|
|
|
10
10
|
const RELEASE_BASE = `https://github.com/${release.repository}/releases/download/${release.tag}/`;
|
|
11
11
|
export const PINNED_BINARIES = release.binaries;
|
|
12
12
|
|
|
13
|
-
const UPSTREAM_VERSION = 'v4.
|
|
13
|
+
const UPSTREAM_VERSION = 'v4.27.0';
|
|
14
14
|
const UPSTREAM_BASE = `https://github.com/zexadev/gemini-web2api-go/releases/download/${UPSTREAM_VERSION}/`;
|
|
15
15
|
// Retained for an explicit, checksum-verified rollback to the upstream release.
|
|
16
16
|
export const UPSTREAM_BINARIES = {
|
|
17
|
-
'darwin-arm64': { asset: 'gemini-web2api-go_v4.
|
|
18
|
-
'darwin-x64': { asset: 'gemini-web2api-go_v4.
|
|
19
|
-
'linux-x64': { asset: 'gemini-web2api-go_v4.
|
|
20
|
-
'linux-arm64': { asset: 'gemini-web2api-go_v4.
|
|
21
|
-
'win32-x64': { asset: 'gemini-web2api-go_v4.
|
|
22
|
-
'win32-arm64': { asset: 'gemini-web2api-go_v4.
|
|
17
|
+
'darwin-arm64': { asset: 'gemini-web2api-go_v4.27.0_darwin_arm64', sha256: '0cc9b5628e24624aa6d6c6c2fadbbc4702632f9c2387b9271e0f596d6d2a44af' },
|
|
18
|
+
'darwin-x64': { asset: 'gemini-web2api-go_v4.27.0_darwin_amd64', sha256: '424e2c7c91922941a9e1beef72d1936da595aa74719f50132998fb2d2e57f20b' },
|
|
19
|
+
'linux-x64': { asset: 'gemini-web2api-go_v4.27.0_linux_amd64', sha256: '5320ff87c6158b648c074b9ae6c700a75b672c8f7119b62e6f22b034e970cfca' },
|
|
20
|
+
'linux-arm64': { asset: 'gemini-web2api-go_v4.27.0_linux_arm64', sha256: '66392aa8c67151ead0f5e2baa1f686e97754f8cc54b856e3605ae1e26633af01' },
|
|
21
|
+
'win32-x64': { asset: 'gemini-web2api-go_v4.27.0_windows_amd64.exe', sha256: 'd8e051abbb657bcaa2edf68faa5a077be881ba4de26facc87fc1f6b8fde04b81' },
|
|
22
|
+
'win32-arm64': { asset: 'gemini-web2api-go_v4.27.0_windows_arm64.exe', sha256: 'faae38bb2d88e583a0c7ef96f7dceb687b2ecf167675a20f0d75e011884d74a4' }
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export function pinnedBinary(platform = process.platform, arch = process.arch, channel = 'optimized') {
|
package/lib/studio-native.mjs
CHANGED
|
@@ -192,13 +192,13 @@ export function validateConfig(config) {
|
|
|
192
192
|
|
|
193
193
|
// ENV_KEYS are the settings upstream reads from .env, in the order it writes them (config.configKeys).
|
|
194
194
|
const ENV_KEYS = [
|
|
195
|
-
'AISTUDIO_AUTH_STATES', 'LISTEN_ADDR', 'PREVIEW_LISTEN_ADDR', 'PROXY_API_KEY', 'PROXY', 'INIT_TIMEOUT', 'REQUEST_TIMEOUT',
|
|
195
|
+
'AISTUDIO_AUTH_STATES', 'LISTEN_ADDR', 'PREVIEW_LISTEN_ADDR', 'PROXY_API_KEY', 'API_KEY_ACCOUNTS', 'PROXY', 'INIT_TIMEOUT', 'REQUEST_TIMEOUT',
|
|
196
196
|
'WARM_WORKER_LIMIT', 'MAX_ACTIVE_WORKERS', 'WARM_STARTUP_CONCURRENCY', 'PER_ACCOUNT_CONCURRENCY',
|
|
197
197
|
'ROUTING_STRATEGY', 'UPSTREAM_CHANNELS', 'MODEL_MAPPING', 'MODEL_CHANNELS', 'TEMPORARY_CHAT', 'WAA_BACKEND',
|
|
198
198
|
'MEDIA_OUTPUT', 'MEDIA_BASE_URL', 'AUTO_START', 'REQUEST_BODY_LOG', 'LOG_FILE', 'LOG_MAX_TOTAL_MB',
|
|
199
199
|
'ADMIN_AUTH_ENABLED', 'ADMIN_USERNAME', 'ADMIN_PASSWORD', 'BUILD_NATIVE_NONSTREAM',
|
|
200
200
|
'NONSTREAM_KEEPALIVE', 'FAKE_STREAM', 'YOUTUBE_LINKS', 'SEARCH_MODEL_ALIASES', 'GOOGLE_SEARCH',
|
|
201
|
-
'FIRST_EVENT_HEDGE', 'CONTINUATION_REWRITE', 'CONTINUATION_PROMPT'
|
|
201
|
+
'FIRST_EVENT_HEDGE', 'FIRST_EVENT_HEDGE_MODELS', 'CONTINUATION_REWRITE', 'CONTINUATION_PROMPT'
|
|
202
202
|
];
|
|
203
203
|
|
|
204
204
|
// PROXY_ENV are the proxy variables the service would fall back to with no PROXY of its own.
|
|
@@ -218,6 +218,9 @@ const SETTING_DEFAULTS = {
|
|
|
218
218
|
REQUEST_TIMEOUT: '30m',
|
|
219
219
|
INIT_TIMEOUT: '2m',
|
|
220
220
|
NONSTREAM_KEEPALIVE: 'false',
|
|
221
|
+
// Keep the existing single-worker policy; extra hedge requests consume account quota.
|
|
222
|
+
// Users may enable them and select models in the admin page.
|
|
223
|
+
FIRST_EVENT_HEDGE: 'off',
|
|
221
224
|
// Upstream lists each chat model that can search Google again as <id>-search (0.2.18), which
|
|
222
225
|
// would list most of Magpie's AI Studio models twice.
|
|
223
226
|
SEARCH_MODEL_ALIASES: 'false'
|
package/lib/studio-release.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.2.
|
|
2
|
+
"version": "0.2.19-magpie.1",
|
|
3
3
|
"repository": "BUKOWSKIREAL/magpie-gemini-web",
|
|
4
|
-
"tag": "studio-v0.2.
|
|
4
|
+
"tag": "studio-v0.2.19-magpie.1",
|
|
5
5
|
"goVersion": "1.27.1",
|
|
6
6
|
"toolchains": {
|
|
7
7
|
"zig": "0.16.0",
|
|
@@ -55,39 +55,40 @@
|
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"upstream": {
|
|
58
|
-
"version": "0.2.
|
|
58
|
+
"version": "0.2.19",
|
|
59
59
|
"repository": "https://github.com/Mag1cFall/AIStudio2API.git",
|
|
60
|
-
"commit": "
|
|
60
|
+
"commit": "0451f26248b7ce263a4fdbf92b280897cb79d74f",
|
|
61
61
|
"camoufox": "152.0.4-beta.29"
|
|
62
62
|
},
|
|
63
63
|
"patches": [
|
|
64
|
-
"studio-0.2.17-preserve-request-bodies.patch"
|
|
64
|
+
"studio-0.2.17-preserve-request-bodies.patch",
|
|
65
|
+
"studio-0.2.19-managed-config.patch"
|
|
65
66
|
],
|
|
66
67
|
"binaries": {
|
|
67
68
|
"darwin-arm64": {
|
|
68
|
-
"asset": "aistudio2api-v0.2.
|
|
69
|
-
"sha256": "
|
|
70
|
-
"binarySha256": "
|
|
69
|
+
"asset": "aistudio2api-v0.2.19-magpie.1-darwin-arm64.tar.gz",
|
|
70
|
+
"sha256": "280d14c3420e51013876cb2f3fd25aa950d8fdbc92b9c6e3b92de2b9fe317921",
|
|
71
|
+
"binarySha256": "1a6da93cedb3d2df2f939ca02d34498c19038cfbb5281bce5d26b9a7b308ac65"
|
|
71
72
|
},
|
|
72
73
|
"darwin-x64": {
|
|
73
|
-
"asset": "aistudio2api-v0.2.
|
|
74
|
-
"sha256": "
|
|
75
|
-
"binarySha256": "
|
|
74
|
+
"asset": "aistudio2api-v0.2.19-magpie.1-darwin-amd64.tar.gz",
|
|
75
|
+
"sha256": "ec23a00edf9b211dddbedac72c27dd32b8f800a44ec8aa425adc605f609fb137",
|
|
76
|
+
"binarySha256": "513b5512d2b038dd48430f37c8e89f31bcb2ee898063debcb1374f876502d5a3"
|
|
76
77
|
},
|
|
77
78
|
"linux-x64": {
|
|
78
|
-
"asset": "aistudio2api-v0.2.
|
|
79
|
-
"sha256": "
|
|
80
|
-
"binarySha256": "
|
|
79
|
+
"asset": "aistudio2api-v0.2.19-magpie.1-linux-amd64.tar.gz",
|
|
80
|
+
"sha256": "8dfaf0d4d2a263ca3f4d64ba6f82841331d4a5c937724ab8b33bb6a61af4c6c5",
|
|
81
|
+
"binarySha256": "384b092cb05172b49666b7e3be39bcce377e7b2aff33f94c3287f280ce72c877"
|
|
81
82
|
},
|
|
82
83
|
"linux-arm64": {
|
|
83
|
-
"asset": "aistudio2api-v0.2.
|
|
84
|
-
"sha256": "
|
|
85
|
-
"binarySha256": "
|
|
84
|
+
"asset": "aistudio2api-v0.2.19-magpie.1-linux-arm64.tar.gz",
|
|
85
|
+
"sha256": "4c20174a731ea699c2a0adab686f063d88088ff93cbd33c399f444fc4b5bcbaa",
|
|
86
|
+
"binarySha256": "c82303992bd340883a69fada20a34eb8491ea9f653ed966df4ed98efe6a81470"
|
|
86
87
|
},
|
|
87
88
|
"win32-x64": {
|
|
88
|
-
"asset": "aistudio2api-v0.2.
|
|
89
|
-
"sha256": "
|
|
90
|
-
"binarySha256": "
|
|
89
|
+
"asset": "aistudio2api-v0.2.19-magpie.1-windows-amd64.zip",
|
|
90
|
+
"sha256": "e3b48e86afabf417551bcc7d09eed986df80f901c3d107c8fa14255d771b5a3c",
|
|
91
|
+
"binarySha256": "8418be330e49421079c723de825e6ce0086454c7a1c1e20ddaa300f42a545d6d"
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
}
|
package/lib/studio.mjs
CHANGED
|
@@ -566,13 +566,13 @@ export function proxyLine(proxy, local) {
|
|
|
566
566
|
}
|
|
567
567
|
|
|
568
568
|
// serviceWindows are the usage card's lines about the local service itself: the proxy it goes out
|
|
569
|
-
// through (when it could be read), and where its admin page is.
|
|
569
|
+
// through (when it could be read), and where its admin page is. Omit used: these are text,
|
|
570
|
+
// not allowance readings; used: 0 makes Magpie draw misleading "100% remaining" meters (#34).
|
|
570
571
|
function serviceWindows(local, proxy) {
|
|
571
572
|
const windows = [];
|
|
572
|
-
if (proxy) windows.push({ name: '代理出口',
|
|
573
|
+
if (proxy) windows.push({ name: '代理出口', display: proxyLine(proxy, local) });
|
|
573
574
|
windows.push({
|
|
574
575
|
name: '管理页',
|
|
575
|
-
used: 0,
|
|
576
576
|
display: `${local.origin}(用户名 ${local.adminUsername},密码是 ${path.join(local.dataDir, 'config.json')} 里的 adminPassword)`
|
|
577
577
|
});
|
|
578
578
|
return windows;
|