magpie-gemini-web 0.8.1 → 0.10.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 +16 -9
- package/README.md +16 -9
- package/docs/backend-release.md +1 -1
- package/docs/studio-release.md +45 -11
- package/index.mjs +17 -10
- package/lib/backend-release.json +15 -15
- package/lib/backend.mjs +2 -1
- package/lib/cleanup-detached.cjs +61 -0
- package/lib/cleanup.mjs +357 -0
- package/lib/native.mjs +172 -7
- package/lib/studio-native.mjs +281 -10
- package/lib/studio-release.json +21 -20
- package/lib/studio.mjs +21 -16
- package/lib/usage.mjs +31 -18
- package/package.json +4 -1
- package/patches/argon.patch +187 -120
- package/patches/studio-0.2.19-managed-config.patch +113 -0
- package/scripts/backend-argon.mjs +2 -2
- package/scripts/backend.mjs +15 -2
- package/scripts/studio-managed-smoke.mjs +27 -3
- package/scripts/studio-release.mjs +1 -1
- package/scripts/studio.mjs +17 -5
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.
|
|
24
|
+
| **Local backend** | AIStudio2API (`v0.3.0`) | gemini-web2api-go (`4.27.0-magpie.2` optimized build) |
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
@@ -87,11 +87,11 @@ Install **magpie-gemini-web** from the Magpie plugin market, then sign in to eit
|
|
|
87
87
|
|
|
88
88
|
<br>
|
|
89
89
|
|
|
90
|
-
Tool calling
|
|
90
|
+
Tool calling and image input are enabled by default. Configure plugin options via the CLI:
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
|
-
# Turn image input on for
|
|
94
|
-
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}}'
|
|
95
95
|
|
|
96
96
|
# Turn image input off for AI Studio
|
|
97
97
|
magpie plugin options magpie-gemini-web '{"studio":{"allowImages":false}}'
|
|
@@ -107,7 +107,7 @@ magpie plugin options magpie-gemini-web '{"studio":{"proxy":"http://127.0.0.1:78
|
|
|
107
107
|
| Option | Default | Scope | Description |
|
|
108
108
|
| :--- | :--- | :--- | :--- |
|
|
109
109
|
| `allowTools` | `true` | Shared (override via `studio.allowTools`) | Allow tool calls. When `false`, requests with tools return 400 |
|
|
110
|
-
| `allowImages` |
|
|
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
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 |
|
|
112
112
|
| `stripCitations` | `true` | `gemini-web` only | Strip `[cite: 1]` and `[cite_start]` markers from replies and tool arguments (not supported on AI Studio) |
|
|
113
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 |
|
|
@@ -152,6 +152,7 @@ When a plugin error asks you to run a command, it includes the full ready-to-cop
|
|
|
152
152
|
| :--- | :--- |
|
|
153
153
|
| `npm run studio:status` | Show local service and account status |
|
|
154
154
|
| `npm run studio:start` / `studio:stop` | Start / stop the local service |
|
|
155
|
+
| `npm run studio:clean` | Stop the service and remove downloaded binaries & Camoufox (keeps accounts & config) |
|
|
155
156
|
| `npm run studio:login` | Add a Google account |
|
|
156
157
|
| `npm run studio:relogin -- [<account>]` | Re-authenticate an expired account (argument optional if only one) |
|
|
157
158
|
| `npm run studio:install -- --archive <file>` | Offline install from a pre-downloaded archive |
|
|
@@ -169,24 +170,30 @@ When a plugin error asks you to run a command, it includes the full ready-to-cop
|
|
|
169
170
|
- Both backends listen on `127.0.0.1` only. Cookies and sessions remain on your machine; Magpie stores only a locally generated API key.
|
|
170
171
|
- **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).
|
|
171
172
|
- **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.
|
|
173
|
+
- **Uninstalling & cleaning downloaded assets:** Removing the plugin in Magpie (or running `npm run studio:clean` / `npm run backend:clean`) stops the local services and deletes the downloaded `AIStudio2API`, `Camoufox`, and `gemini-web2api-go` binaries and archives.
|
|
174
|
+
- `auth/`, `gemini.db`, `config.json`, `.env`, and `secrets.json` are kept so reinstalling the plugin or sending a new request restores the backend on demand without signing in or importing cookies again; to prevent automatic reinstallation permanently, remove the sign-in in Magpie or delete `config.json` / `secrets.json`.
|
|
175
|
+
- Default data directories are shared per OS user; set separate `AI_STUDIO_DATA_DIR` and `GEMINI_WEB_DATA_DIR` when running multiple isolated Magpie config directories so removing the plugin in one does not clean another's shared binaries.
|
|
172
176
|
- 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.
|
|
173
177
|
|
|
174
178
|
**AI Studio upgrades and model selection:**
|
|
175
|
-
- The plugin pins SHA-256-verified `v0.2.
|
|
179
|
+
- 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.
|
|
180
|
+
- 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.
|
|
181
|
+
- 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-升级兼容).
|
|
176
182
|
- **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.
|
|
177
183
|
- 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.
|
|
178
184
|
- 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.
|
|
179
185
|
- 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.
|
|
180
186
|
- 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.
|
|
181
187
|
- 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.
|
|
188
|
+
- Deep Research models (`deep-research-preview-04-2026`, `deep-research-max-preview-04-2026`) are supported: listed when signed in with a Google AI Pro / Ultra account; the backend adapts asynchronous Interactions tasks onto `/v1/chat/completions` streaming (including reasoning and built-in server-side search), without client `tool_call` (Function Calling) or `temperature`.
|
|
182
189
|
- 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.
|
|
183
190
|
|
|
184
191
|
**Gemini Web optimized backend upgrades & rollback:**
|
|
185
|
-
- One-click setup uses [4.
|
|
192
|
+
- One-click setup uses [4.27.0-magpie.2](https://github.com/BUKOWSKIREAL/magpie-gemini-web/releases/tag/backend-v4.27.0-magpie.2) 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.
|
|
186
193
|
- **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.
|
|
187
194
|
- **Rollback to upstream / restore optimized build** (run in the plugin directory after stopping the backend):
|
|
188
195
|
```bash
|
|
189
|
-
npm run backend:install:upstream # Roll back and pin to official v4.
|
|
196
|
+
npm run backend:install:upstream # Roll back and pin to official v4.27.0
|
|
190
197
|
npm run backend:install # Restore default optimized build
|
|
191
198
|
```
|
|
192
199
|
- 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.
|
|
24
|
+
| **本地后端** | AIStudio2API (`v0.3.0`) | gemini-web2api-go (`4.27.0-magpie.2` 优化版) |
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
@@ -87,11 +87,11 @@
|
|
|
87
87
|
|
|
88
88
|
<br>
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
工具调用与图片输入默认开启。可通过命令行修改插件配置:
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
|
-
#
|
|
94
|
-
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}}'
|
|
95
95
|
|
|
96
96
|
# 关闭 AI Studio 的图片输入
|
|
97
97
|
magpie plugin options magpie-gemini-web '{"studio":{"allowImages":false}}'
|
|
@@ -107,7 +107,7 @@ magpie plugin options magpie-gemini-web '{"studio":{"proxy":"http://127.0.0.1:78
|
|
|
107
107
|
| 选项 | 默认值 | 适用范围 | 说明 |
|
|
108
108
|
| :--- | :--- | :--- | :--- |
|
|
109
109
|
| `allowTools` | `true` | 共用(可用 `studio.allowTools` 单独覆盖) | 允许工具调用。设为 `false` 时带工具的请求返回 400 |
|
|
110
|
-
| `allowImages` |
|
|
110
|
+
| `allowImages` | `true` | 共用(可用 `studio.allowImages` 单独覆盖) | 允许对话中的图片输入(图像模型的参考图不受它限制)。Gemini Web 读图需要登录,未登录时返回 400 |
|
|
111
111
|
| `requestTimeoutMs` / `modelTimeoutMs` | Web:`570000` / `10000`;Studio:`1800000` / `10000` | 共用(`studio.*` 可覆盖) | 单次等待后端 / 拉取模型列表的超时(毫秒);收到流数据后重新计时,显式配置优先 |
|
|
112
112
|
| `stripCitations` | `true` | 仅 `gemini-web` | 剥离回复与工具参数中的 `[cite: 1]`、`[cite_start]` 标记(AI Studio 不支持剥离) |
|
|
113
113
|
| `proxy` | 无 | 仅 `gemini-web` | 一键配置后端访问 Google 的代理(`http` / `https` / `socks5` / `socks5h`),也可用环境变量 `GEMINI_WEB_PROXY` 或在登录第一步填写 |
|
|
@@ -152,6 +152,7 @@ magpie plugin options magpie-gemini-web '{"studio":{"proxy":"http://127.0.0.1:78
|
|
|
152
152
|
| :--- | :--- |
|
|
153
153
|
| `npm run studio:status` | 查看本地服务与账号状态 |
|
|
154
154
|
| `npm run studio:start` / `studio:stop` | 启动 / 停止本地服务 |
|
|
155
|
+
| `npm run studio:clean` | 停止服务并清理已下载的后端与 Camoufox 浏览器(保留账号与配置) |
|
|
155
156
|
| `npm run studio:login` | 添加 Google 账号 |
|
|
156
157
|
| `npm run studio:relogin -- [<账号>]` | 重新登录过期账号(仅一个账号时可省略参数) |
|
|
157
158
|
| `npm run studio:install -- --archive <文件>` | 使用已下载的安装包离线安装 |
|
|
@@ -169,24 +170,30 @@ magpie plugin options magpie-gemini-web '{"studio":{"proxy":"http://127.0.0.1:78
|
|
|
169
170
|
- 两个后端均只监听 `127.0.0.1`,Cookie 与登录态仅保存在本机,Magpie 仅保存本地生成的随机 API Key。
|
|
170
171
|
- **Gemini Web 数据目录**:`~/.local/share/magpie-gemini-web`(可通过 `GEMINI_WEB_DATA_DIR` 修改),日志位于 `backend.log`。支持 macOS、Linux、Windows(x64 / arm64)。
|
|
171
172
|
- **AI Studio 数据目录**:`~/.local/share/magpie-ai-studio`(可通过 `AI_STUDIO_DATA_DIR` 修改),日志位于 `backend.log`(超 10 MB 下次启动自动轮转)。默认使用 2048 端口,被占用时自动顺延并记录在 `config.json`。支持 macOS、Linux(x64 / arm64)与 Windows x64。
|
|
173
|
+
- **卸载与清理下载资产**:在 Magpie 中删除插件(或运行 `npm run studio:clean`、`npm run backend:clean`)会停止本地服务并删除 `AIStudio2API`、`Camoufox` 与 `gemini-web2api-go` 二进制及安装包。
|
|
174
|
+
- 清理会保留 `auth/`、`gemini.db`、`config.json`、`.env` 与 `secrets.json`,以便重装插件或下次发起请求时自动按需重装后端、免去重新登录或导 Cookie;若要彻底停用自动重装,请在 Magpie 中删除对应登录卡片或一并删除数据目录中的配置文件。
|
|
175
|
+
- 默认数据目录按当前系统用户共享;若在同一账号下隔离运行多个 Magpie 配置目录,请分别设置 `AI_STUDIO_DATA_DIR` 与 `GEMINI_WEB_DATA_DIR`,避免卸载其一时清理共享资产。
|
|
172
176
|
- Gemini Web 每个登录同时最多 2 个请求(AI Studio 为 1),可在 Magpie 的 provider 设置里调整;仍无法完全排除 Google 账号风控风险,请自行评估使用。
|
|
173
177
|
|
|
174
178
|
**AI Studio 升级与模型范围:**
|
|
175
|
-
- 插件固定使用经过 SHA-256 校验的 `v0.2.
|
|
179
|
+
- 插件固定使用经过 SHA-256 校验的 `v0.2.19-magpie.1`(基于上游 `v0.2.19`),通过升级插件更新后端。同基线或更旧的官方版、以及旧版插件装的托管后端,在下次管理启动时自动升级,保留账号、端口与登录凭据。
|
|
180
|
+
- 0.2.19 的账号绑定与备用请求模型设置会保留;管理页保存的默认值不会在重启后被改回插件默认值。备用请求默认关闭,需要时可在管理页开启并选择模型。
|
|
181
|
+
- 从 0.2.18 升级且已开启 `auto` 时,备用请求从所有模型缩为 `FIRST_EVENT_HEDGE_MODELS` 中的模型,未配置该列表时仅有 Argon。管理页完整保存会固定当时的默认值,后续上游默认值变化需要手动调整。接管官方 0.2.19 的稀疏配置时,缺失项会按插件规则补齐(例如备用请求变为 `off`);详见[升级兼容说明](docs/studio-release.md#0219-升级兼容)。
|
|
176
182
|
- **托管后端已在 macOS、Linux、Windows 统一禁用在线更新**:管理页提示“更新由 magpie-gemini-web 管理”,更新接口返回 HTTP 409,检查更新也不会访问 GitHub。用户自行连接的外部服务不受影响。托管构建方式和可复现构建流程见 [docs/studio-release.md](docs/studio-release.md)。
|
|
177
183
|
- Unix 的 `package/` 仍尽力设置为 `0555`,作为额外的文件保护;权限设置失败不阻断服务,在线更新的禁用也不依赖该权限。若要手动删除数据目录来重置,请先停止服务,再运行 `chmod -R u+w "<数据目录>/package"` 恢复可写权限,然后删除;将 `<数据目录>` 替换为实际路径。
|
|
178
184
|
- 若自行更新到更新版或定制版,插件会提示版本冲突,并提供带正确 `--data-dir` 的 `stop`、`install`、`start` 命令。停止时会找回更新后的监听进程 PID,并核对可执行文件路径;无法核实身份就不会发送终止信号。HTTP 端口关闭但进程尚未退出时,插件不会重装或启动第二个进程。
|
|
179
185
|
- 已停止但文件被替换的后端会从校验通过的固定版本安装包恢复;校验失败不会启动替换文件。安装会保留账号和运行数据文件,但**不保证旧版本能读取新版迁移过的数据**。手动降级前先停止服务并备份整个数据目录(包括 `auth/`、`runtime/requests.db` 等);已知发生数据迁移时应升级插件以匹配新版后端。
|
|
180
186
|
- AI Studio 后端基础请求期限为 30 分钟;插件默认单次响应等待/流空闲超时也是 30 分钟(仍可用 `studio.requestTimeoutMs` 调整)。这允许非流式长回复在服务端完整收集;后端卡死时也可能等满 30 分钟,且单 worker 会拖住后续请求。可主动取消请求或设置更短的等待时间,但较短期限可能中断正常长回复。上游自动续写的期限按其规则计算。
|
|
181
187
|
- 已核对本机 Magpie `v0.1.1285`(`d783df46`)源码:插件请求走 `Provider.Do → plugin.Fetch → loader.fetch`,绕过普通 HTTP transport 的 10 分钟响应头限制;此插件生成路径没有发现更短的固定总超时。网关 5 分钟 `IdleTimeout` 仅针对请求之间的空闲连接。客户端或反向代理仍可设置更短期限;这不是一次实等 30 分钟的端到端验证。
|
|
188
|
+
- 支持 Deep Research 模型(`deep-research-preview-04-2026`、`deep-research-max-preview-04-2026`):需要登录 Google AI Pro / Ultra 账号才会在列表中出现;由后端将异步 Interactions 任务适配到 `/v1/chat/completions` 流式返回(含思考过程与服务端内置联网搜索),不支持客户端 `tool_call`(Function Calling)或 `temperature`。
|
|
182
189
|
- 模型列表过滤 `-build` / `assistant_route` 模型:这类模型附带 Build 写代码助手的系统提示词,不作为普通 Agent 模型提供。升级后可执行 `magpie provider models ai-studio` 刷新列表。
|
|
183
190
|
|
|
184
191
|
**Gemini Web 优化后端升级与回退:**
|
|
185
|
-
- 插件默认使用本仓库发布的 [4.
|
|
192
|
+
- 插件默认使用本仓库发布的 [4.27.0-magpie.2](https://github.com/BUKOWSKIREAL/magpie-gemini-web/releases/tag/backend-v4.27.0-magpie.2)(基于上游 v4.27.0 集成 XSRF 缓存、请求取消传播、工具调用提前收尾与 Argon 校验补丁)。对话请求按上游沉默计时:Google 让请求排队时每 60 秒发一次心跳,后端会一直等到出字;连续 `request_timeout_sec`(默认 180 秒)没有任何数据才放弃这一次并重试,还在出字的长回复也不会被截断。
|
|
186
193
|
- **旧版升级**:插件不会打断运行中的后端。先停止旧进程(PID 见数据目录 `backend.pid`),下次启动 Magpie 或发请求时会自动更新二进制并保留原有配置与账号。
|
|
187
194
|
- **回退官方版 / 恢复优化版**(停止后端后在插件目录执行):
|
|
188
195
|
```bash
|
|
189
|
-
npm run backend:install:upstream # 回退并固定使用官方 v4.
|
|
196
|
+
npm run backend:install:upstream # 回退并固定使用官方 v4.27.0
|
|
190
197
|
npm run backend:install # 恢复默认优化版
|
|
191
198
|
```
|
|
192
199
|
- 源码复现构建与发布流程见 [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,26 @@
|
|
|
1
1
|
# AI Studio 托管后端构建
|
|
2
2
|
|
|
3
|
-
插件使用 `0.
|
|
3
|
+
插件使用 `0.3.0-magpie.1`,基于 AIStudio2API `v0.3.0` 及其后续修复 commit `48f75fa722b25d22a493e75f6d4e5f9d5035d7e3`。上游版本、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.3.0 升级兼容
|
|
6
|
+
|
|
7
|
+
- 基线为上游 `v0.3.0` 加 PR #109(`48f75fa722b25d22a493e75f6d4e5f9d5035d7e3`)。包含账号异步任务流、本机 Chrome / Cookie / CDP 浏览器账号导入、超过 63 字符的工具函数名自动压缩还原、`STRIP_THOUGHT_SIGNATURES`、Responses / Interactions / 音频状态持久化(`runtime/states.db`)、`gemini-live-2.5-flash` 与 `gemini-2.5-pro-tts` 等模型更新,以及上游默认 `WAA_BACKEND=spidermonkey`。Camoufox、SpiderMonkey 静态库和固定工具链沿用上一版。
|
|
8
|
+
- 后台账户任务适配:上游 `POST /api/accounts` 与 `POST /api/accounts/{id}/login` 改为启动不随 HTTP 请求取消的后台任务(返回 `202 Accepted` 与 `{ task }`)。插件与 CLI 通过 `studioLogin` 轮询 `GET /api/accounts/tasks` 等待完成,再从 `GET /api/accounts` 读取账号,并在结束或超时退出时调用 `DELETE /api/accounts/tasks/{id}` 清理或取消后台任务(超时会自动关闭弹出的 Camoufox 登录窗口)。
|
|
9
|
+
- 配置项变更:上游移除了废弃的 `TEMPORARY_CHAT`,新增 `STRIP_THOUGHT_SIGNATURES`(默认 `false`)。插件移除 `TEMPORARY_CHAT` 默认项,保留管理页保存的 `STRIP_THOUGHT_SIGNATURES`,并隔离宿主环境的同名变量。
|
|
10
|
+
- `patches/studio-0.2.19-managed-config.patch` 同步适配上游 `v0.3.0` 新增的 `workerDefaultKeys`(`WARM_WORKER_LIMIT`、`MAX_ACTIVE_WORKERS`)分支:托管构建(`internal/config.managedBy=magpie-gemini-web`)继续完整写出全部非环境变量控制项,避免插件默认并发设置覆盖管理页保存的上游默认值。
|
|
11
|
+
|
|
12
|
+
## 0.2.19 升级兼容
|
|
13
|
+
|
|
14
|
+
- 基线为上游 `v0.2.19`(`0451f26248b7ce263a4fdbf92b280897cb79d74f`)。包含无正文输出时的函数调用格式错误/断流/流尾 5xx 重试、复杂 Schema 修复、SpiderMonkey 堆收缩和 HTTP/2 连接复用。Camoufox、SpiderMonkey 静态库和固定工具链沿用上一版。
|
|
15
|
+
- 新增 `API_KEY_ACCOUNTS` 与 `FIRST_EVENT_HEDGE_MODELS`:插件保留管理页保存的值,并隔离宿主环境的同名变量。账号绑定约束后端选号,不会把 Magpie 卡片切换变成账号切换。
|
|
16
|
+
- 上游默认 `FIRST_EVENT_HEDGE=auto`,仅对 `gemini-4-argon` 发备用请求。托管插件在未配置时明确写入 `off`,保留已有单 Worker 策略,避免升级后增加额度消耗;已有设置原样保留,用户可以在管理页开启并选择模型。
|
|
17
|
+
- 从 0.2.18 升级时,已开启 `FIRST_EVENT_HEDGE=auto` 的用户需要留意模型范围:0.2.18 对所有模型生效,0.2.19 只对 `FIRST_EVENT_HEDGE_MODELS` 列出的模型生效。旧配置没有该列表时,默认只剩 `gemini-4-argon`;需要其他模型时在管理页选择并保存。
|
|
18
|
+
- `patches/studio-0.2.19-managed-config.patch` 为配置包增加链接时标识 `internal/config.managedBy=magpie-gemini-web`。托管构建跳过旧全量 `.env` 的自动改写,并继续完整保存可编辑设置,包括等于上游默认值的值。否则用户保存的搜索开关、轮转策略和并发数会从 `.env` 消失,插件下次启动又补回自己的默认值;显式关闭的备用请求和 5 分钟超时也可能被迁移重置。环境变量控制的设置仍锁定,并保留文件里的原值。未设置该构建标识的上游构建仍使用原来的稀疏保存与迁移逻辑。
|
|
19
|
+
- 请求正文迁移补丁原样保留。配置补丁测试覆盖旧设置保留、默认值完整保存和环境锁定;真实二进制冒烟测试覆盖管理 API 保存、插件重启、账号绑定和备用请求模型持久化。
|
|
20
|
+
- 完整保存的代价是固定当时的上游默认值:在管理页保存一次后,`CONTINUATION_PROMPT`、`FIRST_EVENT_HEDGE_MODELS`、`LOG_MAX_TOTAL_MB` 等可编辑设置都会明确写入文件。以后上游修改默认提示词、模型列表或其他默认值时,已保存的配置不会自动跟随,需要用户在管理页调整。这延续了托管 0.2.18 的全量保存行为。
|
|
21
|
+
- 接管官方 0.2.19 安装时,官方稀疏 `.env` 中缺失的项会按插件的初始化规则补齐。例如官方默认 `FIRST_EVENT_HEDGE=auto` 保存后可能不在文件里,接管后就会补成插件默认的 `off`。文件无法区分“刻意选择上游默认值”和“从未设置”;接管后请在管理页核对需要保留的设置。
|
|
22
|
+
|
|
23
|
+
## 既有升级兼容
|
|
6
24
|
|
|
7
25
|
- 上游 v0.2.18 删除了纯 Go(goja)的 WAA 后端 `go`,改为经 CGO 内嵌 Firefox 的 JS 引擎 SpiderMonkey(`WAA_BACKEND=spidermonkey`)。插件固定使用 `spidermonkey`:生成仍在服务进程内完成,不需要浏览器;Camoufox 仍只用于 Google 登录。上游默认的 `camoufox` 后端未采用。
|
|
8
26
|
- 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 +28,19 @@
|
|
|
10
28
|
- Gemini 原生接口(`/v1beta`,Magpie 画图用)在 v0.2.18 按 Gemini 的方式拒绝密钥:错误密钥返回 400 `API_KEY_INVALID`,缺少密钥返回 403。插件把这两种情况当作 401 处理,提示重新登录;Google 自身返回的 403(如 code 7 “The caller does not have permission”)属于账号问题,原样传回。
|
|
11
29
|
- 上游 v0.2.17 改用需要 CGO 的原生 SQLite。账号和配置沿用原目录;首次打开旧数据库会整理空闲页。降级前应停止服务并备份完整数据目录,旧版不保证能读取迁移后的数据。
|
|
12
30
|
- 上游(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`
|
|
31
|
+
- 新增的 `FIRST_EVENT_HEDGE` 保留管理页保存的值,同时隔离宿主环境同名变量。托管插件在未配置时设为 `off`。备用请求需要空闲账号和 Worker;插件默认单 Worker,不自动提高并发。
|
|
14
32
|
- 模型档位优先使用 `/v1/models` 返回的 `thinking_levels`;旧外部服务未返回该字段时沿用四档。Playground 通道、托管更新限制及插件默认并发保持原设置。
|
|
15
33
|
- macOS 与 Windows 都可能使用系统代理;显式代理及管理页设置仍优先,宿主的 `HTTP_PROXY` 等变量不传入服务。
|
|
16
34
|
|
|
17
35
|
## 在线更新策略
|
|
18
36
|
|
|
19
|
-
上游从 v0.2.14 起原生支持分发方管理更新。构建时通过 `-ldflags`
|
|
37
|
+
上游从 v0.2.14 起原生支持分发方管理更新。构建时通过 `-ldflags` 写入以下值:
|
|
20
38
|
|
|
21
|
-
- `internal/app.version=v0.
|
|
39
|
+
- `internal/app.version=v0.3.0-magpie.1`:明确的版本标识。同基线或更旧的官方版、以及更旧的托管版需要升级;更新的官方版、更新的托管版或不认识的定制版仍提示冲突。
|
|
22
40
|
- `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
41
|
|
|
42
|
+
`internal/config.managedBy=magpie-gemini-web` 同时启用上面的配置兼容补丁。
|
|
43
|
+
|
|
24
44
|
构建不带 `desktop` 标签,不包含桌面窗口。普通插件升级、账户登录、模型调用及管理功能继续保留,用户自行连接的外部服务不受影响。
|
|
25
45
|
|
|
26
46
|
## 复现构建
|
|
@@ -93,9 +113,23 @@ AI_STUDIO_TEST_ARCHIVE=/absolute/path/to/archive.tar.gz npm test
|
|
|
93
113
|
|
|
94
114
|
真实安装验证检查旧版请求正文迁移及重启后可读、管理页保存的备用请求设置、启动、版本、GET 更新状态、POST 更新返回 409、二进制及 PID 不变、管理页面显示托管提示、停止与状态。`.github/workflows/studio.yml` 在五种系统/架构的原生 runner 上重新构建、对比 SHA-256 并运行该验证;本机交叉编译不能代替 Linux/Windows 真机验证。
|
|
95
115
|
|
|
96
|
-
## 0.
|
|
116
|
+
## 0.3.0 升级验证(2026-11-05)
|
|
117
|
+
|
|
118
|
+
- 五个平台的候选构建([run 41976798432](https://github.com/BUKOWSKIREAL/magpie-gemini-web/actions/runs/41976798432))一次性通过上游测试、真实安装冒烟验证(含 `strip_thought_signatures=false`、`/api/accounts/tasks` 接口与管理页配置持久化)及插件测试;安装包和二进制 pin 来自该次构建。
|
|
119
|
+
- 随后的严格验证构建([run 41977975873](https://github.com/BUKOWSKIREAL/magpie-gemini-web/actions/runs/41977975873))在五个平台的全新 runner 上重新构建,哈希与 pin 完全一致,真实安装冒烟验证与插件测试全部通过。
|
|
120
|
+
|
|
121
|
+
## 0.2.19 升级验证(2026-11-02,历史记录)
|
|
122
|
+
|
|
123
|
+
- 五个平台的候选构建([run 41378024737](https://github.com/BUKOWSKIREAL/magpie-gemini-web/actions/runs/41378024737))通过上游测试、真实安装冒烟验证及插件测试;安装包和二进制 pin 来自该次构建。Windows 首次在安装前的 PowerShell 进程查询超时,失败作业重跑通过,未修改测试或放宽超时。提交 pin 后仍需由严格验证工作流在新 runner 上重建并逐一比对哈希,结果见升级 PR。
|
|
124
|
+
- 本地使用 CI 的 darwin-arm64 安装包运行完整插件测试:212 项通过、无跳过;Python bridge 测试 41 项通过。打包检查包含配置补丁,不包含本地构建和账号数据。
|
|
125
|
+
- 从用户界面操作 Magpie 和本地管理页:刷新模型、测试 Argon(界面报告 4.7 秒响应),并确认生图选择器列出五个 AI Studio 图片模型。管理页实际修改账号绑定、每账号并发、轮转策略、搜索模型别名、备用请求开关及模型,保存后完整重启服务;六项均在界面和 API 中保留。测试后恢复原值并再次重启核对。
|
|
126
|
+
- 通过真实 Magpie 网关调用 `gemini-4-argon`,九项检查全部通过:无登录浏览器启动、两轮原生工具调用、缺少回传签名时续接、字面引用文本保留、下一轮对话读取两次工具结果、取消活跃请求、取消后再次调用、后端进程重启后用原登录继续工具历史,以及结束时无登录浏览器。重启恢复约 30 秒。
|
|
127
|
+
- 通过 Magpie 的 `generate_image` 工具调用 `ai-studio/gemini-3.1-flash-image`,请求 16:9 水彩喜鹊,实际返回 1376×768 JPEG,已打开检查画面。
|
|
128
|
+
- 验证使用现有已登录账号;Google 新登录和重新登录流程本次未验证。升级前已备份完整本地数据目录;本机后端已升级,临时调整的设置和 Magpie 供应商开关均已恢复。此分支未 merge,未发布后端 release 或 npm 包。
|
|
129
|
+
|
|
130
|
+
## 0.2.18 升级验证(2026-10-30,历史记录)
|
|
97
131
|
|
|
98
|
-
|
|
132
|
+
以下为上一版 `0.2.18-magpie.1` 的验证结果,不代表 0.2.19。
|
|
99
133
|
|
|
100
134
|
- 首次候选构建(run 41025535280)中,Linux x64/arm64 在上游测试 `TestUserCacheRootWithoutEnvironment` 的 `t.Setenv` 处崩溃(见上文环境变量拦截函数),Windows 的 macOS 本机交叉编译结果与 CI 不同(见上文 C++ 运行库)。两处修复后的候选构建(run 41033635405)五个平台都通过上游测试、真实安装冒烟验证(含 `waa_backend=spidermonkey`、`search_model_aliases=false`)与插件测试。
|
|
101
135
|
- 跨机器一致性:Linux x64/arm64 与 Windows x64 的 CI 候选哈希与 macOS arm64 本机交叉编译完全一致;darwin-arm64 两次 CI 构建得到相同哈希。pin 来自第二次候选构建,随后的严格验证构建(run 41036094948)在五个平台的全新 runner 上重新构建,哈希与 pin 完全一致,冒烟验证与插件测试通过。
|
|
@@ -115,14 +149,14 @@ AI_STUDIO_TEST_ARCHIVE=/absolute/path/to/archive.tar.gz npm test
|
|
|
115
149
|
- 新版 Google 登录/生成端到端验证尚未完成。
|
|
116
150
|
- 此分支未发布后端 release 或 npm 包。本机日常后端仍使用 `0.2.16-magpie.1`,新版仅在临时数据目录运行。
|
|
117
151
|
|
|
118
|
-
发布前必须审查各平台 CI 与构建记录,再将安装包及许可证上传到本仓库 `studio-v0.
|
|
152
|
+
发布前必须审查各平台 CI 与构建记录,再将安装包及许可证上传到本仓库 `studio-v0.3.0-magpie.1` release。该 release 的安装包可公开下载后,才能发布对应 npm 版本,否则新安装会遇到 404。合并 PR 不代表已经满足发布条件;构建脚本及验证 CI 不自动发布 release 或 npm 包。
|
|
119
153
|
|
|
120
154
|
本地试用建议使用独立数据目录:
|
|
121
155
|
|
|
122
156
|
```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-
|
|
157
|
+
node scripts/studio.mjs install --data-dir /path/to/studio-030-trial --archive /absolute/path/to/archive
|
|
158
|
+
node scripts/studio.mjs start --data-dir /path/to/studio-030-trial
|
|
159
|
+
node scripts/studio.mjs stop --data-dir /path/to/studio-030-trial
|
|
126
160
|
```
|
|
127
161
|
|
|
128
162
|
使用现有账号数据测试前,先停止旧服务并备份;不要让两个进程同时写同一个数据目录。
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { normalizeBaseURL, settings, credentials, listModels, forward, UNREACHABLE_HEADER, PLUGIN_ICON } from './lib/backend.mjs';
|
|
2
|
-
import { ensureBackend, localBackend } from './lib/native.mjs';
|
|
2
|
+
import { ensureBackend, localBackend, localSetup } from './lib/native.mjs';
|
|
3
|
+
import { registerMagpieCleanup, isPluginRemovedInActiveMagpie } from './lib/cleanup.mjs';
|
|
3
4
|
import { parseCookieInput, importCookie, ensureProxy, validateProxyURL, requireLoginBackend } from './lib/setup.mjs';
|
|
4
5
|
import { usage, poolChoices, poolAccounts, accountEmail } from './lib/usage.mjs';
|
|
5
6
|
import { taskSupported, taskMethod, taskLoader, taskModels, isTaskAuth } from './lib/task.mjs';
|
|
@@ -31,14 +32,19 @@ async function signInFor(local, account) {
|
|
|
31
32
|
return {
|
|
32
33
|
type: 'success',
|
|
33
34
|
key: local.apiKey,
|
|
34
|
-
metadata: {
|
|
35
|
+
metadata: {
|
|
36
|
+
baseURL: local.baseURL, account: account.id, ...(email ? { email } : {}),
|
|
37
|
+
// The account index (/u/N) the email is for; usage takes the email only while it holds.
|
|
38
|
+
...(email && account.authuser > 0 ? { authuser: account.authuser } : {})
|
|
39
|
+
}
|
|
35
40
|
};
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
// managedBackend is the local backend this plugin set up, when baseURL points at it.
|
|
39
|
-
function managedBackend(baseURL) {
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
function managedBackend(baseURL, key) {
|
|
45
|
+
if (isPluginRemovedInActiveMagpie()) return null;
|
|
46
|
+
const local = localBackend() || (key ? localSetup() : null);
|
|
47
|
+
return local && local.baseURL === baseURL && (!key || local.apiKey === key) ? local : null;
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
// forwardManaged is forward(), but when the backend this plugin manages can't be reached it
|
|
@@ -53,7 +59,7 @@ async function forwardManaged(input, init, getAuth, opts) {
|
|
|
53
59
|
} catch {
|
|
54
60
|
return res;
|
|
55
61
|
}
|
|
56
|
-
if (!managedBackend(c.baseURL)) return res;
|
|
62
|
+
if (!managedBackend(c.baseURL, c.key)) return res;
|
|
57
63
|
try {
|
|
58
64
|
await ensureBackend({ proxy: opts.proxy });
|
|
59
65
|
} catch {
|
|
@@ -68,6 +74,7 @@ export const GeminiWebPlugin = async (_input, options = {}) => {
|
|
|
68
74
|
}
|
|
69
75
|
const { studio: _studio, ...webOptions } = options;
|
|
70
76
|
const opts = settings(webOptions);
|
|
77
|
+
registerMagpieCleanup(_input);
|
|
71
78
|
const proxyPrompt = {
|
|
72
79
|
type: 'text',
|
|
73
80
|
key: 'proxy',
|
|
@@ -222,11 +229,11 @@ export const GeminiWebPlugin = async (_input, options = {}) => {
|
|
|
222
229
|
} catch (err) {
|
|
223
230
|
return { error: err.message, windows: [], signIn: 'kept' };
|
|
224
231
|
}
|
|
225
|
-
if (!managedBackend(c.baseURL)) {
|
|
232
|
+
if (!managedBackend(c.baseURL, c.key)) {
|
|
226
233
|
return { error: '只能读取插件自己管理的本地后端的额度(连接已有后端时读不到)', windows: [], signIn: 'kept' };
|
|
227
234
|
}
|
|
228
|
-
const { account, email } = auth.metadata || {};
|
|
229
|
-
return { ...(await usage(Number.isInteger(account) ? { account, email } : {})), signIn: 'kept' };
|
|
235
|
+
const { account, email, authuser } = auth.metadata || {};
|
|
236
|
+
return { ...(await usage(Number.isInteger(account) ? { account, email, authuser } : {})), signIn: 'kept' };
|
|
230
237
|
}
|
|
231
238
|
},
|
|
232
239
|
provider: {
|
|
@@ -238,7 +245,7 @@ export const GeminiWebPlugin = async (_input, options = {}) => {
|
|
|
238
245
|
try {
|
|
239
246
|
return await listModels(c, opts);
|
|
240
247
|
} catch (err) {
|
|
241
|
-
if (!err.unreachable || !managedBackend(c.baseURL)) throw err;
|
|
248
|
+
if (!err.unreachable || !managedBackend(c.baseURL, c.key)) throw err;
|
|
242
249
|
await ensureBackend({ proxy: opts.proxy });
|
|
243
250
|
return listModels(c, opts);
|
|
244
251
|
}
|
package/lib/backend-release.json
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "4.
|
|
2
|
+
"version": "4.27.0-magpie.2",
|
|
3
3
|
"repository": "BUKOWSKIREAL/magpie-gemini-web",
|
|
4
|
-
"tag": "backend-v4.
|
|
4
|
+
"tag": "backend-v4.27.0-magpie.2",
|
|
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.2_darwin_arm64",
|
|
13
|
+
"sha256": "45c01d9a99142957eadf30b75ee17da13ea468ca9b4b0d342b9e7b2b440a9072"
|
|
14
14
|
},
|
|
15
15
|
"darwin-x64": {
|
|
16
|
-
"asset": "gemini-web2api-go_v4.
|
|
17
|
-
"sha256": "
|
|
16
|
+
"asset": "gemini-web2api-go_v4.27.0-magpie.2_darwin_amd64",
|
|
17
|
+
"sha256": "4739f96c703f08ac8c21a7b699564bb26f80298a0ea8c30b126de501fc61d451"
|
|
18
18
|
},
|
|
19
19
|
"linux-x64": {
|
|
20
|
-
"asset": "gemini-web2api-go_v4.
|
|
21
|
-
"sha256": "
|
|
20
|
+
"asset": "gemini-web2api-go_v4.27.0-magpie.2_linux_amd64",
|
|
21
|
+
"sha256": "837d5416507daf628984dd7e32aba69380f54d3385e8fd0b478af9b5a0c3dc1b"
|
|
22
22
|
},
|
|
23
23
|
"linux-arm64": {
|
|
24
|
-
"asset": "gemini-web2api-go_v4.
|
|
25
|
-
"sha256": "
|
|
24
|
+
"asset": "gemini-web2api-go_v4.27.0-magpie.2_linux_arm64",
|
|
25
|
+
"sha256": "8c070298efb4db79839b214c113cc486a4693cc3d144fc17c30daa4b96d9a99b"
|
|
26
26
|
},
|
|
27
27
|
"win32-x64": {
|
|
28
|
-
"asset": "gemini-web2api-go_v4.
|
|
29
|
-
"sha256": "
|
|
28
|
+
"asset": "gemini-web2api-go_v4.27.0-magpie.2_windows_amd64.exe",
|
|
29
|
+
"sha256": "ec9550617a73aa9e17847dd511edc9b64425fa980a5024ea385d6fd28ccb7d2d"
|
|
30
30
|
},
|
|
31
31
|
"win32-arm64": {
|
|
32
|
-
"asset": "gemini-web2api-go_v4.
|
|
33
|
-
"sha256": "
|
|
32
|
+
"asset": "gemini-web2api-go_v4.27.0-magpie.2_windows_arm64.exe",
|
|
33
|
+
"sha256": "7cb9d2a47fd2106da4db8e5e4983547b962d3e03dd3ed5f0ac529b2eab31f97a"
|
|
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');
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
process.title = 'magpie-gemini-web-cleanup';
|
|
4
|
+
|
|
5
|
+
const fs = require('node:fs');
|
|
6
|
+
|
|
7
|
+
const cfg = JSON.parse(process.env.MAGPIE_CLEANUP_CFG || '{}');
|
|
8
|
+
const {
|
|
9
|
+
magpieDir,
|
|
10
|
+
pluginRoot,
|
|
11
|
+
studioDir,
|
|
12
|
+
webDir,
|
|
13
|
+
pidFile,
|
|
14
|
+
mode = 'watch',
|
|
15
|
+
pollMs = 2000
|
|
16
|
+
} = cfg;
|
|
17
|
+
|
|
18
|
+
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
19
|
+
|
|
20
|
+
function removePidFile() {
|
|
21
|
+
if (!pidFile) return;
|
|
22
|
+
try {
|
|
23
|
+
const recorded = Number(fs.readFileSync(pidFile, 'utf8').trim());
|
|
24
|
+
if (recorded === process.pid) {
|
|
25
|
+
fs.rmSync(pidFile, { force: true });
|
|
26
|
+
}
|
|
27
|
+
} catch {}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
(async () => {
|
|
31
|
+
try {
|
|
32
|
+
// Load the cleanup module into memory immediately on startup so the watcher still has all
|
|
33
|
+
// code in memory even after `bun remove` deletes node_modules/magpie-gemini-web from disk.
|
|
34
|
+
const {
|
|
35
|
+
isPluginInMagpie,
|
|
36
|
+
hasDownloadedAssets,
|
|
37
|
+
cleanDownloadedAssets
|
|
38
|
+
} = await import('./cleanup.mjs');
|
|
39
|
+
|
|
40
|
+
if (mode === 'immediate') {
|
|
41
|
+
await cleanDownloadedAssets({ studioDir, webDir });
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
for (;;) {
|
|
46
|
+
const state = isPluginInMagpie(magpieDir, { pluginRoot });
|
|
47
|
+
if (state === false) {
|
|
48
|
+
await cleanDownloadedAssets({ studioDir, webDir });
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (!hasDownloadedAssets({ studioDir, webDir })) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
await sleep(pollMs);
|
|
55
|
+
}
|
|
56
|
+
} catch {
|
|
57
|
+
// Best-effort background cleanup
|
|
58
|
+
} finally {
|
|
59
|
+
removePidFile();
|
|
60
|
+
}
|
|
61
|
+
})();
|