diff --git a/.env.example b/.env.example index 4c1a6fa5..a0fd0995 100644 --- a/.env.example +++ b/.env.example @@ -81,12 +81,21 @@ MODEL_CHANNELS= # 模型可用的账户,每项写成 模型 ID:账户|账户,逗号分隔多项,未列出的模型可用全部账户,保存后立即生效 MODEL_ACCOUNTS= +# 不在 API 中显示的模型 ID,逗号分隔;这些模型不出现在 /v1/models,请求时返回模型已在设置中隐藏的错误,保存后立即生效 +HIDE_MODELS= + +# 被 Google 迁到任务接口的模型在这些账户上改用 GenerateContent 发送,账户 ID 逗号分隔;请求方式与官网不同,可能触发 Google 风控,保存后立即生效 +GENERATE_CONTENT_ACCOUNTS= + # 同步账户模型目录时找出 AI Studio 官网前端已配置、账户 ListModels 尚未列出的模型,经上游 CountTokens 确认可用后加入目录并可直接请求;被 ListModels 列出后使用官方条目 DISCOVER_HIDDEN_MODELS=false # 启用 Build 通道时非流式请求先使用 Build 原生单次调用,不可用时回退流式并记录原因 BUILD_NATIVE_NONSTREAM=true +# 提供 -build 对话模型;用过 -build 模型的账户曾被 Google 成批限制使用 AI Studio,关闭时这些模型不出现在 /v1/models,请求时返回已在设置中关闭的错误,保存后立即生效 +BUILD_CHAT_MODELS=false + # 非流式请求等待超过 10 秒时先返回 200,之后每 10 秒写出一个换行,经反向代理时连接不会因长时间无数据断开 NONSTREAM_KEEPALIVE=true @@ -111,6 +120,9 @@ REPLY_TOOL=false # 角色扮演场景思考防拦截:引导模型在内部思考中保持简洁抽象、不复述敏感词,并将思考强度上限收敛到低档,降低思考阶段触发上游过滤截断的概率,保存后立即生效 THINKING_GUARD=false +# REPLY_TOOL、THINKING_GUARD 与 USER_MESSAGE_REWRITE 只作用于使用这些本地 API key 的请求,逗号分隔;为空时作用于全部请求,保存后立即生效 +SILLYTAVERN_API_KEYS= + # 发送前将用户消息中的中文改写为指定文字(不改模型历史回答),并在系统指令中要求模型默认以简体中文回复:off 关闭,traditional 繁体中文,martian 火星文,保存后立即生效 USER_MESSAGE_REWRITE=off diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fceb314e..6a342b7e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -123,7 +123,7 @@ jobs: link="" if [[ "$GITHUB_REF_TYPE" == tag ]]; then number="${GITHUB_REF_NAME#v}"; link="-X github.com/Mag1cFall/AIStudio2API/internal/app.version=$GITHUB_REF_NAME"; fi mkdir -p bin - CGO_ENABLED=0 go install github.com/wailsapp/wails/v3/cmd/wails3@v3.0.0-beta.29 + CGO_ENABLED=0 go install github.com/wailsapp/wails/v3/cmd/wails3@v3.1.0 jq --arg v "$number" '.fixed.file_version = $v | .info["0000"].ProductVersion = $v' build/windows/info.json > bin/info.json wails3 generate syso -arch amd64 -icon build/windows/icon.ico -manifest build/windows/wails.exe.manifest -info bin/info.json -out cmd/aistudio2api/rsrc_windows_amd64.syso CC=x86_64-w64-mingw32-clang CXX=x86_64-w64-mingw32-clang++ GOOS=windows GOARCH=amd64 go build -mod=readonly -trimpath -tags desktop,production -ldflags="-s -w -H windowsgui -extldflags '-Wl,--gc-sections -Wl,--icf=safe' $link" -o bin/aistudio2api.exe ./cmd/aistudio2api diff --git a/README.md b/README.md index f2c4d8ef..ba5d2092 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ ## 核心能力 - **双通道**: 每个账户经 Playground 生成;Build 应用代理是旧通道,上游已对账户停用其生成(`PROXY_GENERATION_DISABLED`),默认关闭,可在 `UPSTREAM_CHANNELS` 中启用;启用后经 Build 发送的生成请求返回上游原因;免费账户的两个通道共用同一模型的每日请求次数 -- **Build 对话模型**: Build 对话面板可选的模型各提供一个 `<模型>-build`(如 `gemini-3.8-flash-build`),由 Build 写代码助手连同其系统提示词回复,支持函数调用、工具结果续接与 Google 搜索,用量计入 Build 对话额度(免费请求或 Google AI 订阅额度);每个账户使用一个 Build 应用,同一段对话在应用中续接,服务重启后照常续接。⚠️ 这类模型的每次请求都带有 Build 写代码助手自带的系统提示词注入,回答风格、格式与身份会受其影响,请按用途自行评估 +- **Build 对话模型**: 在设置“运行与通道”中打开后,Build 对话面板可选的模型各提供一个 `<模型>-build`(如 `gemini-3.8-flash-build`),由 Build 写代码助手连同其系统提示词回复,支持函数调用、工具结果续接与 Google 搜索,用量计入 Build 对话额度(免费请求或 Google AI 订阅额度);每个账户使用一个 Build 应用,同一段对话在应用中续接,服务重启后照常续接。⚠️ 这类模型的每次请求都带有 Build 写代码助手自带的系统提示词注入,回答风格、格式与身份会受其影响;用过 `-build` 模型的账户曾被 Google 成批限制使用 AI Studio - **多账户高并发**: 识别 Free、Pro、Ultra 与 Plus 权益,按实时模型目录在账户间轮询或优先复用 - **两种 WAA 后端**: 默认由服务进程内的 SpiderMonkey(Firefox 的 JavaScript 引擎)生成官方 proof,运行时不下载、不启动浏览器;设置 `WAA_BACKEND=camoufox` 后由 Camoufox 持有官方 WAA 生命周期 - **四套 API 协议**: OpenAI Chat Completions、OpenAI Responses、Anthropic Messages 与 Gemini GenerateContent;Responses 支持 `/v1/responses/compact` 与 `compaction`、`compaction_trigger` 输入项的上下文压缩,Anthropic Messages 支持 `context_management` 的工具结果与思考清理和阈值压缩 @@ -88,12 +88,12 @@ - **决策模型**: `gemini-decision-1` 经 `/v1beta/decisions` 对同一份输入一次回答多个是非、单选与评分问题,返回校准后的概率与置信度;输入可以是文本、图片、音频、视频与 PDF,只计输入 token;这个模型在 AI Studio 官网中隐藏,官网选中后只显示示例应用,本服务可以直接使用 - **YouTube 输入**: YouTube 视频 URL 作为外部视频附件读取;开启 `YOUTUBE_LINKS` 后,消息文本中的 YouTube 链接同样作为视频读取 - **视频理解设置**: Gemini 与 Interactions 支持逐视频的起止时间、0–24 FPS 范围内的正数采样率和静态/Agentic 处理;Agentic 返回服务端处理步骤并支持历史续接 -- **智能模型切换**: 从 AI Studio 实时发现模型并按 `model` 字段路由;开启 `DISCOVER_HIDDEN_MODELS` 后,AI Studio 官网尚未公开的模型在确认账户能用后也会加入模型列表 +- **智能模型切换**: 从 AI Studio 实时发现模型并按 `model` 字段路由;开启 `DISCOVER_HIDDEN_MODELS` 后,AI Studio 官网尚未公开的模型在确认账户能用后也会加入模型列表;在“模型目录”中可逐个选择模型是否在 API 中显示 - **Google 工具**: 支持 Search、Image Search、URL Context、Code Execution 和 Maps - **Files 与 Transcribe**: 支持文件上传、查询、内容读取、删除和音频转录 - **Live 与 Robotics**: 通过 WebSocket 支持文本、音频、JPEG、媒体结束、工具调用、恢复和中断 - **反指纹检测**: 为每个账户固定 Firefox 指纹与出口,官方 WAA 在 SpiderMonkey 的 Firefox 页面环境或 Camoufox 页面中运行 -- **图形界面启动器**: 通过网页管理账户、服务启停、实时日志、模型、请求、用量统计和配置,界面提供深色与浅色两种配色,以及简体中文、繁體中文、English、日本語、한국어、Français 与 Deutsch 七种语言 +- **图形界面启动器**: 通过网页管理账户、服务启停、实时日志、模型、请求、用量统计(用过多把 API key 时可按 key 拆分)、按模型与账户查看的号池额度和配置,界面提供深色与浅色两种配色,以及简体中文、繁體中文、English、日本語、한국어、Français 与 Deutsch 七种语言 - **桌面版**: Windows、macOS 与 Linux 桌面应用在窗口中显示管理页面,关闭窗口后在系统托盘继续运行 - **在线更新**: 管理端“版本”页显示最新发行版本与更新说明,桌面版与 Linux、macOS 命令行版一键下载、校验并重启到新版本,Linux deb 安装时由系统弹出管理员认证;新版本 1 分钟内没有启动时,浏览器中的管理页面提示重新打开程序与日志位置 - **模块化架构**: Go 负责协议、调度、API 与管理端,SpiderMonkey 或 Camoufox 负责 WAA 运行时,Camoufox 负责隔离登录 @@ -108,7 +108,7 @@ - **Linux 桌面版**: GTK 3 与 WebKitGTK 4.1,例如 Ubuntu 22.04、Debian 12 或更新版本;deb 安装时一并安装这些依赖与 Camoufox 运行库,AppImage 另需下一行的 Camoufox 运行库 - **Linux Release 运行**: 解压 `linux-amd64.tar.gz` 后运行 `./aistudio2api`,Camoufox 需要 Firefox 系运行库与 Xvfb,Debian/Ubuntu 执行 `sudo apt-get update && sudo apt-get satisfy -y "libgtk-3-0, libasound2t64 | libasound2, libx11-xcb1, xvfb"` - **源码运行**: - - Go 1.27.3+、Node.js 22.18+、24.11+ 或 26+,以及配套 npm + - Go 1.27.4+、Node.js 22.18+、24.11+ 或 26+,以及配套 npm - C/C++ 编译器:Windows 为 [llvm-mingw](https://github.com/mstorsjo/llvm-mingw/releases) 的 UCRT 版 clang,macOS 为 Xcode Command Line Tools,Linux 为 [Zig](https://ziglang.org/download/) 0.16 - 当前平台的 SpiderMonkey 与 libwebp 静态库,分别从 [Mag1cFall/firefox](https://github.com/Mag1cFall/firefox/releases) 与 [Mag1cFall/libwebp](https://github.com/Mag1cFall/libwebp/releases) 的 Releases 下载 - **操作系统**: Windows、macOS、Linux @@ -189,7 +189,7 @@ sudo apt install ./aistudio2api-<版本>-linux-amd64.deb #### 1. 安装依赖 -- Go 1.27.3 或更高版本 +- Go 1.27.4 或更高版本 - Node.js 22.18+、24.11+ 或 26+,以及配套 npm - C/C++ 编译器:macOS 为 Xcode Command Line Tools,Linux 为 [Zig](https://ziglang.org/download/) 0.16 @@ -422,7 +422,7 @@ agy | Gemini | `POST /v1beta/models/{model}:generateContent`、`:streamGenerateContent`、`:countTokens`;`POST`/`GET /v1beta/cachedContents`、`GET`/`PATCH`/`DELETE /v1beta/cachedContents/{id}` | | Embeddings | `POST /v1/embeddings`、`POST /v1beta/models/{model}:embedContent`、`:batchEmbedContents` | | 图片 | `POST /v1/images/generations`、`POST /v1/images/edits`、Imagen `POST /v1beta/models/{model}:predict` | -| 语音 | `POST /v1/audio/speech` | +| 语音 | `POST /v1/audio/speech`;声音 `GET`/`POST /v1beta/voices`、`GET`/`DELETE /v1beta/voices/{id}` | | 转录与翻译 | `POST /v1/audio/transcriptions`、`POST /v1/audio/translations` | | 音乐 | Gemini `generateContent` + `responseModalities: ["AUDIO"]` | | 视频 | `POST /v1/videos`、`GET /v1/videos`、`GET`/`DELETE /v1/videos/{id}`、`GET /v1/videos/{id}/content` | @@ -506,6 +506,7 @@ curl http://127.0.0.1:2048/v1beta/models/gemini-2.5-flash-preview-tts:generateCo - 可用语音由实时模型目录中的 `capability_options.voices` 返回 - `gemini-3.8-flash-tts` 等带 `speech_metadata` 能力的模型同样接受上面的 `说话人: 台词` 写法,也可以为每个文本 part 设置 `speechMetadata.speaker` 与 `speechMetadata.style`,并用 `multiSpeakerVoiceConfig.mode` 选择 `VERBATIM` 或 `CONVERSATIONAL` - OpenAI `instructions` 在这些模型上作为语音风格 +- 自定义声音(Voice Design):`POST /v1beta/voices` 以 `{"voice":{"type":"prompted","display_name":"Old Sailor","prompted":{"input":"<声音描述>"}}}` 创建,返回 `voice_...` ID 与试听音频,之后在任一协议的声音参数中填这个 ID;服务按描述挑选最接近的预置音色,生成时把描述作为风格提示。API 试用页的语音页「新建声音」提供同样的流程 ### 图片生成 (Nano Banana) @@ -655,7 +656,7 @@ AIStudio2API/ cp .env.example .env ``` -进程环境变量覆盖 `.env` 中的同名项,这些项在设置页中不可修改;在管理页面保存设置时 `.env` 写入 WAA 后端与其余和默认值不同的项;取值无效的项按默认值运行,并在管理页面顶部与日志中列出。 +进程环境变量覆盖 `.env` 中的同名项,这些项在设置页中不可修改;在管理页面保存设置时 `.env` 只写入与默认值不同的项;取值无效的项按默认值运行,并在管理页面顶部与日志中列出。 | 变量 | 默认值 | 作用 | | --- | --- | --- | @@ -688,7 +689,10 @@ cp .env.example .env | `MODEL_MAPPING` | 空 | 客户端模型名到目录模型的映射,每项写成 `别名:模型 ID`,逗号分隔多项 | | `MODEL_CHANNELS` | 空 | 限定模型只走一个通道,每项写成 `模型 ID:playground` 或 `模型 ID:build`;也可在“模型目录”的模型详情中选择,保存后立即生效 | | `MODEL_ACCOUNTS` | 空 | 模型可用的账户,每项写成 `模型 ID:账户\|账户`,未列出的模型可用全部账户;也可在“模型目录”的模型详情中勾选,保存后立即生效 | +| `HIDE_MODELS` | 空 | 不在 API 中显示的模型 ID,逗号分隔;这些模型不出现在 `/v1/models`,请求时返回模型已在设置中隐藏的错误;也可在“模型目录”中逐个切换,保存后立即生效 | +| `GENERATE_CONTENT_ACCOUNTS` | 空 | 被 Google 迁到任务接口的模型在这些账户上改用 GenerateContent 发送,账户 ID 逗号分隔;请求方式与官网不同,可能触发 Google 风控;保存后立即生效 | | `BUILD_NATIVE_NONSTREAM` | `true` | 启用 Build 通道时非流式请求优先使用 Build 原生单次调用;不可用时回退流式并记录原因 | +| `BUILD_CHAT_MODELS` | `false` | 提供 `-build` 对话模型;关闭时这些模型不出现在 `/v1/models`,请求时返回已在设置中关闭的错误;保存后立即生效 | | `NONSTREAM_KEEPALIVE` | `true` | 非流式请求等待结果超过 10 秒时先返回 200 并定时写出换行保持连接 | | `FAKE_STREAM` | `false` | 流式请求先按非流式取得完整结果再按流式格式输出,中途失败时换号重发,等待期间照常发送心跳 | | `YOUTUBE_LINKS` | `false` | 用户消息文本中的 YouTube 链接作为视频发送给模型,并从文本中移除 | @@ -700,6 +704,7 @@ cp .env.example .env | `CONTINUATION_PROMPT` | 内置英文续写句 | 改写时与末尾 assistant 消息一起写入系统指令的提示词;设为空时末尾 assistant 消息改作 user 消息发送 | | `REPLY_TOOL` | `false` | 仅限角色扮演场景:声明内部 `final` 工具让模型一次性交付完整正文以减轻流式截断,思考照常实时输出;保存后立即生效 | | `THINKING_GUARD` | `false` | 角色扮演场景思考防拦截:引导模型在内部思考中保持简洁抽象、不复述敏感词,并将思考强度上限收敛到低档,降低思考阶段触发上游过滤截断的概率;保存后立即生效 | +| `SILLYTAVERN_API_KEYS` | 空 | `REPLY_TOOL`、`THINKING_GUARD` 与 `USER_MESSAGE_REWRITE` 只作用于使用这些本地 API key 的请求,逗号分隔;为空时作用于全部请求,保存后立即生效 | | `USER_MESSAGE_REWRITE` | `off` | 发送前将用户消息中的中文改写为繁体中文或火星文(不改模型历史回答),并在系统指令中要求模型默认以简体中文回复;取值 `off`、`traditional` 或 `martian`,保存后立即生效 | | `FIRST_EVENT_HEDGE` | `off` | 原请求迟迟没有首字时用空闲账户发起一个备用请求,取值 `off`、`auto` 或等待秒数 | | `FIRST_EVENT_HEDGE_MODELS` | `gemini-4-argon` | 发起备用请求的模型 ID,逗号分隔;备用请求同样计入账户额度 | @@ -716,6 +721,7 @@ cp .env.example .env - `ACCOUNT_SWITCH_INTERVAL`:切往冷备账户时先等满间隔再启动 Worker,就绪后直接发送,不重复等待;等待期间客户端断开即结束 - `NONSTREAM_KEEPALIVE`:返回 200 后每 10 秒写出一个换行直到写出 JSON 正文,经 Cloudflare 等反向代理时连接不会因长时间无数据断开;此后才出现的错误以协议错误正文返回 - `STRIP_THOUGHT_SIGNATURES`:函数调用带 `skip_thought_signature_validator`;之前各轮的思考内容不随签名发给模型,长对话的输入 token 较少 +- `GENERATE_CONTENT_ACCOUNTS`:Google 已把部分账户的 `gemini-4` 等模型迁到任务接口,官网对这些账户改发 `CreateInteraction` 后台任务,服务默认与官网一致;设置页“运行与通道”标出被迁移的账户,尚未被迁移的账户也可以预先选中 - `DISCOVER_HIDDEN_MODELS`: - 在同步账户模型目录时探测:启动、每 24 小时与账户页“刷新全部” - 确认账户能用的模型加入目录,可直接用于各协议请求并列在 `/v1/models` 中,“模型目录”页标为“官网隐藏” @@ -728,8 +734,7 @@ cp .env.example .env - 每次尝试从取得账户起独立计时,收到首个语义事件即停止;到时取消这次尝试并换号,计入 `MAX_ACCOUNT_SWITCHES`、不冷却账户,没有可换账户时返回 504 - 与 `FIRST_EVENT_HEDGE` 同开时原请求与备用请求各自计时,建议大于对冲等待秒数;排除后台请求与 agent 后台任务,慢思考请求的首字可能需要几分钟 - `WAA_BACKEND`: - - `spidermonkey` 在服务进程内的 SpiderMonkey 中运行 WAA,不下载也不启动 Camoufox;`camoufox` 在 Camoufox 页面运行 WAA;其他取值按 `spidermonkey` - - 未设置时,启动时按 `auth/` 确定后写入 `.env`:已有账户而没有 `auth/.waa-interpreters` 时为 `camoufox`,否则为 `spidermonkey` + - `spidermonkey` 在服务进程内的 SpiderMonkey 中运行 WAA,不下载也不启动 Camoufox;`camoufox` 在 Camoufox 页面运行 WAA - `MEDIA_OUTPUT`: - `inline` 以 data URI 内联 - `url` 按内容命名保存到 `runtime/media/`,以本服务的 `/media/<文件名>` URL 引用,该路径不校验 API key;目录总量超过 1 GB 时从最久未使用的文件开始删除 diff --git a/README_en.md b/README_en.md index 902f21cd..90b7bde3 100644 --- a/README_en.md +++ b/README_en.md @@ -71,7 +71,7 @@ The three projects connect to AI Studio, the Gemini web app and Antigravity, and ## Core Capabilities - **Dual Channels**: Every account generates through the Playground; the Build app proxy is the legacy channel whose generation upstream has disabled for accounts (`PROXY_GENERATION_DISABLED`), off by default and enabled in `UPSTREAM_CHANNELS`; once enabled, generation requests sent through Build return the upstream reason; on free accounts both channels share one daily request count per model -- **Build Chat Models**: Every model selectable in the Build chat panel is also listed as `-build` (for example `gemini-3.8-flash-build`), answered by the Build code assistant with its system prompt, with function calling, tool-result continuation, and Google Search, and billed to the Build chat quota (free requests or the Google AI subscription); each account uses one Build app, and the same conversation continues in that app, including after a service restart. ⚠️ Every request to these models carries the Build code assistant's own injected system prompt, which shapes the answer's style, format, and persona; evaluate whether that fits your use +- **Build Chat Models**: Once turned on under “Runtime & channels” in Settings, every model selectable in the Build chat panel is also listed as `-build` (for example `gemini-3.8-flash-build`), answered by the Build code assistant with its system prompt, with function calling, tool-result continuation, and Google Search, and billed to the Build chat quota (free requests or the Google AI subscription); each account uses one Build app, and the same conversation continues in that app, including after a service restart. ⚠️ Every request to these models carries the Build code assistant's own injected system prompt, which shapes the answer's style, format, and persona. Accounts that used `-build` models were once restricted from AI Studio by Google in a batch - **High-Concurrency Multi-Account**: Detects Free, Pro, Ultra, and Plus benefits and routes across accounts by the live model catalog with round-robin or fill-first - **Two WAA Backends**: By default, SpiderMonkey (the Firefox JavaScript engine) generates the official proof inside the service process and no browser is downloaded or launched at runtime; with `WAA_BACKEND=camoufox`, Camoufox holds the official WAA lifecycle - **Four API Protocols**: OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, and Gemini GenerateContent; Responses supports context compaction through `/v1/responses/compact` and `compaction` and `compaction_trigger` input items, and Anthropic Messages supports `context_management` tool-result and thinking clearing and threshold compaction @@ -88,12 +88,12 @@ The three projects connect to AI Studio, the Gemini web app and Antigravity, and - **Decision Model**: `gemini-decision-1` answers many yes/no, choice, and score questions about one shared input in a single call to `/v1beta/decisions`, returning calibrated probabilities and confidence; input can be text, images, audio, video, and PDF, and only input tokens are billed; this model is hidden on the AI Studio website, where choosing it only shows sample apps, and this service can use it directly - **YouTube Input**: YouTube video URLs are read as external video attachments; with `YOUTUBE_LINKS` enabled, YouTube links in message text are read as video too - **Video Understanding Controls**: Gemini and Interactions support per-video start/end offsets, sampling rates greater than 0 and up to 24 FPS, and static/agentic processing; agentic results preserve server-side processing steps and conversation history -- **Smart Model Switching**: Discover models from AI Studio and route through the `model` field; with `DISCOVER_HIDDEN_MODELS` enabled, models that AI Studio hasn't made public yet are added to the model list once the account is confirmed to be able to use them +- **Smart Model Switching**: Discover models from AI Studio and route through the `model` field; with `DISCOVER_HIDDEN_MODELS` enabled, models that AI Studio hasn't made public yet are added to the model list once the account is confirmed to be able to use them; the Model catalog page chooses per model whether it is shown in the API - **Google Tools**: Search, Image Search, URL Context, Code Execution, and Maps - **Files and Transcribe**: File upload, metadata, content, deletion, and audio transcription - **Live and Robotics**: WebSocket text, audio, JPEG images, media end, tool calls, resumption, and interruption - **Anti-Fingerprinting**: Each account keeps a stable Firefox fingerprint and network exit, and the official WAA runs in the Firefox page environment of SpiderMonkey or in a Camoufox page -- **GUI Launcher**: Manage accounts, service controls, live logs, models, requests, usage statistics, and configuration in the web UI, with dark and light color themes and seven languages: 简体中文, 繁體中文, English, 日本語, 한국어, Français, and Deutsch +- **GUI Launcher**: Manage accounts, service controls, live logs, models, requests, usage statistics (broken down by API key once several keys are in use), account pool quota by model and by account, and configuration in the web UI, with dark and light color themes and seven languages: 简体中文, 繁體中文, English, 日本語, 한국어, Français, and Deutsch - **Desktop App**: Windows, macOS, and Linux desktop apps show the management UI in a window and keep running in the system tray after the window is closed - **Online Update**: The Version page shows the latest release and its notes; the desktop apps and the Linux and macOS command-line builds download, verify, and restart into the new version in one click, and a Linux deb install asks for administrator authentication; if the new version has not started within a minute, the admin page open in a browser says to reopen the app and where the logs are - **Modular Architecture**: Go handles protocols, scheduling, APIs, and management; SpiderMonkey or Camoufox hosts WAA, and Camoufox hosts isolated login @@ -108,7 +108,7 @@ The three projects connect to AI Studio, the Gemini web app and Antigravity, and - **Linux Desktop App**: GTK 3 and WebKitGTK 4.1, such as Ubuntu 22.04, Debian 12, or later; the deb installs these and the Camoufox libraries, while the AppImage also needs the Camoufox libraries listed on the next line - **Linux Release Runtime**: Extract `linux-amd64.tar.gz` and run `./aistudio2api`; Camoufox needs the Firefox system libraries and Xvfb, on Debian/Ubuntu run `sudo apt-get update && sudo apt-get satisfy -y "libgtk-3-0, libasound2t64 | libasound2, libx11-xcb1, xvfb"` - **Source Build**: - - Go 1.27.3+, Node.js 22.18+, 24.11+, or 26+, and its bundled npm + - Go 1.27.4+, Node.js 22.18+, 24.11+, or 26+, and its bundled npm - A C/C++ compiler: the UCRT clang from [llvm-mingw](https://github.com/mstorsjo/llvm-mingw/releases) on Windows, Xcode Command Line Tools on macOS, [Zig](https://ziglang.org/download/) 0.16 on Linux - The SpiderMonkey and libwebp static libraries for the platform, from the Releases of [Mag1cFall/firefox](https://github.com/Mag1cFall/firefox/releases) and [Mag1cFall/libwebp](https://github.com/Mag1cFall/libwebp/releases) - **Operating System**: Windows, macOS, Linux @@ -189,7 +189,7 @@ Run `setup` and other commands with the desktop executable in a terminal, such a #### 1. Install Dependencies -- Go 1.27.3 or later +- Go 1.27.4 or later - Node.js 22.18+, 24.11+, or 26+, with its bundled npm - A C/C++ compiler: Xcode Command Line Tools on macOS, [Zig](https://ziglang.org/download/) 0.16 on Linux @@ -422,7 +422,7 @@ Main endpoints: | Gemini | `POST /v1beta/models/{model}:generateContent`, `:streamGenerateContent`, `:countTokens`; `POST`/`GET /v1beta/cachedContents`, `GET`/`PATCH`/`DELETE /v1beta/cachedContents/{id}` | | Embeddings | `POST /v1/embeddings`, `POST /v1beta/models/{model}:embedContent`, `:batchEmbedContents` | | Images | `POST /v1/images/generations`, `POST /v1/images/edits`, Imagen `POST /v1beta/models/{model}:predict` | -| Speech | `POST /v1/audio/speech` | +| Speech | `POST /v1/audio/speech`; voices `GET`/`POST /v1beta/voices`, `GET`/`DELETE /v1beta/voices/{id}` | | Transcription and translation | `POST /v1/audio/transcriptions`, `POST /v1/audio/translations` | | Music | Gemini `generateContent` with `responseModalities: ["AUDIO"]` | | Video | `POST /v1/videos`, `GET /v1/videos`, `GET`/`DELETE /v1/videos/{id}`, `GET /v1/videos/{id}/content` | @@ -506,6 +506,7 @@ curl http://127.0.0.1:2048/v1beta/models/gemini-2.5-flash-preview-tts:generateCo - Available voices are returned by `capability_options.voices` in the live model catalog - Models with the `speech_metadata` capability, such as `gemini-3.8-flash-tts`, accept the same `Speaker: line` script; each text part can also set `speechMetadata.speaker` and `speechMetadata.style`, with `multiSpeakerVoiceConfig.mode` selecting `VERBATIM` or `CONVERSATIONAL` - OpenAI `instructions` become the speech style on these models +- Custom voices (Voice Design): create one with `POST /v1beta/voices` and `{"voice":{"type":"prompted","display_name":"Old Sailor","prompted":{"input":""}}}`; the response carries a `voice_...` ID and a preview clip, and the ID works in the voice field of every protocol. The service picks the closest prebuilt voice for the description and sends the description as a speaking style. "New voice" on the playground speech page runs the same flow ### Image Generation (Nano Banana) @@ -655,7 +656,7 @@ Copy and edit the environment file: cp .env.example .env ``` -Process environment variables override the same keys in `.env`, and those settings cannot be changed on the settings page. Saving settings in the console writes the WAA backend and the other values that differ from the defaults to `.env`. Settings with invalid values run with their defaults and are listed at the top of the console and in the log. +Process environment variables override the same keys in `.env`, and those settings cannot be changed on the settings page. Saving settings in the console writes only values that differ from the defaults to `.env`. Settings with invalid values run with their defaults and are listed at the top of the console and in the log. | Variable | Default | Purpose | | --- | --- | --- | @@ -688,7 +689,10 @@ Process environment variables override the same keys in `.env`, and those settin | `MODEL_MAPPING` | empty | Client model names mapped to catalog models, each item `alias:model ID`, comma separated | | `MODEL_CHANNELS` | empty | Limit a model to one channel, each item `model ID:playground` or `model ID:build`; also selectable in model details on the Model catalog page, applied on save | | `MODEL_ACCOUNTS` | empty | Accounts a model may use, each item `model ID:account\|account`; models not listed can use every account. Also selectable in model details on the Model catalog page, applied on save | +| `HIDE_MODELS` | empty | Model IDs not shown in the API, comma-separated; they are left out of `/v1/models` and requests return an error saying the model is hidden in settings. Also switchable per model on the Model catalog page, applied on save | +| `GENERATE_CONTENT_ACCOUNTS` | empty | Account IDs, comma-separated, that send models Google moved to the task API via GenerateContent instead; this differs from AI Studio and may trigger Google's risk controls; applied on save | | `BUILD_NATIVE_NONSTREAM` | `true` | With the Build channel enabled, prefer native Build unary calls for non-streaming requests; log any fallback to stream collection | +| `BUILD_CHAT_MODELS` | `false` | Offer the `-build` chat models; when off they are left out of `/v1/models` and requests return an error saying they are turned off in settings; applied on save | | `NONSTREAM_KEEPALIVE` | `true` | When a non-streaming request waits longer than 10 seconds, return 200 first and keep the connection open with periodic newlines | | `FAKE_STREAM` | `false` | Streaming requests get the full result as a non-streaming generation, retry on another account if it fails midway, then stream it in the protocol format; heartbeats continue while waiting | | `YOUTUBE_LINKS` | `false` | Send YouTube links in user message text to the model as video and remove them from the text | @@ -700,6 +704,7 @@ Process environment variables override the same keys in `.env`, and those settin | `CONTINUATION_PROMPT` | built-in English sentence | Prompt written into the system instruction together with the trailing assistant message when rewriting; when set empty, the trailing assistant message is sent as a user message | | `REPLY_TOOL` | `false` | For roleplay only: declare an internal `final` tool so the model delivers the complete reply at once to reduce mid-stream truncation while keeping thinking streamed live; applies on save | | `THINKING_GUARD` | `false` | Roleplay thinking anti-block: guide internal reasoning to stay brief and abstract without repeating sensitive terms and cap thinking effort at low, reducing upstream filter truncation during reasoning; applies on save | +| `SILLYTAVERN_API_KEYS` | empty | Local API keys, comma-separated, whose requests get `REPLY_TOOL`, `THINKING_GUARD`, and `USER_MESSAGE_REWRITE`; when empty they apply to every request; applied on save | | `USER_MESSAGE_REWRITE` | `off` | Rewrite Chinese text in user messages to Traditional Chinese or Martian Chinese before sending (leaving assistant history unchanged) and instruct the model to reply in Simplified Chinese by default; `off`, `traditional`, or `martian`; applies on save | | `FIRST_EVENT_HEDGE` | `off` | When a request has no first token for a while, send a backup request on an idle account; `off`, `auto`, or a wait in seconds | | `FIRST_EVENT_HEDGE_MODELS` | `gemini-4-argon` | Comma-separated model IDs that get backup requests; backup requests also count against account quota | @@ -716,6 +721,7 @@ Notes: - `ACCOUNT_SWITCH_INTERVAL`: when moving to a standby account, waits for the interval before starting the worker and sends immediately once ready without waiting again; stops immediately if the client disconnects - `NONSTREAM_KEEPALIVE`: after returning 200, a newline is written every 10 seconds until the JSON body, so reverse proxies such as Cloudflare keep the connection open; errors after that point come back as the protocol error body - `STRIP_THOUGHT_SIGNATURES`: function calls are sent with `skip_thought_signature_validator`; earlier turns' thinking is not passed to the model with the signatures, so long conversations use fewer input tokens +- `GENERATE_CONTENT_ACCOUNTS`: Google has moved `gemini-4` and other models of some accounts to the task API, and AI Studio sends `CreateInteraction` background tasks for them; the service does the same by default. “Runtime & channels” in Settings marks migrated accounts, and accounts not yet migrated can be selected in advance - `DISCOVER_HIDDEN_MODELS`: - Discovery runs when account model catalogs sync: at startup, every 24 hours, and on Refresh all in Accounts - Models the account is confirmed to be able to use are added to the catalog; they can be used through every protocol, appear in `/v1/models`, and are marked Hidden in AI Studio on the Model catalog page @@ -728,8 +734,7 @@ Notes: - Each attempt is timed independently from taking an account until the first semantic event arrives; on timeout it cancels the attempt and switches accounts (counts toward `MAX_ACCOUNT_SWITCHES`, does not cool the account), returning 504 if no account is left - With `FIRST_EVENT_HEDGE` enabled, the primary and backup requests keep separate timers and this should be set higher than the hedge wait; excludes background requests and background agent tasks; slow thinking requests may take several minutes before their first token - `WAA_BACKEND`: - - `spidermonkey` runs WAA in SpiderMonkey inside the service process and neither downloads nor starts Camoufox; `camoufox` runs WAA in a Camoufox page; any other value means `spidermonkey` - - When unset, startup picks it from `auth/` and writes it to `.env`: `camoufox` if `auth/` already has accounts but no `auth/.waa-interpreters`, otherwise `spidermonkey` + - `spidermonkey` runs WAA in SpiderMonkey inside the service process and neither downloads nor starts Camoufox; `camoufox` runs WAA in a Camoufox page - `MEDIA_OUTPUT`: - `inline` embeds a data URI - `url` saves the file under `runtime/media/`, named by its content, and links to it at `/media/` on this service, a path that does not check the API key; when the directory exceeds 1 GB, the least recently used files are deleted first diff --git a/docs/build.md b/docs/build.md index 6b19c5d5..ec875c0f 100644 --- a/docs/build.md +++ b/docs/build.md @@ -43,6 +43,7 @@ ListModels: gemini-3.8-flash(主能力码含 48) - 默认参数:输出上限取基础模型;可选 thinking level 为基础模型中的 high、medium、low 与 minimal(Build 设置面板的四档);思考开启,默认 level 为 high(3),基础模型不支持 high 时取最接近的可用 level,目录的默认档位为该 level - `-build` 模型生成的候选通道只有 `assistant`;该通道始终启用,`UPSTREAM_CHANNELS` 与 `BUILD_NATIVE_NONSTREAM` 只作用于其他模型 +- `BUILD_CHAT_MODELS` 为 `false`(默认)时 `/v1/models` 与 `/v1beta/models` 不列出 `-build` 条目,生成与计数请求返回 404 `Build chat model <模型> is turned off in settings`;管理端模型目录照常列出 - 账户的目录含该 `-build` 条目、且账户权益满足基础模型的 AccessModes 时,账户可以承担请求;候选顺序、热 Worker 优先与 `round-robin`、`fill-first` 策略与其他模型相同 - 同一账户同时只运行一个 `-build` 生成: - 占用时段从取得租约起,到本轮回复完整结束为止;回复没有完整结束时到取消请求结束为止 diff --git a/docs/development.md b/docs/development.md index a7d617ef..9f799813 100644 --- a/docs/development.md +++ b/docs/development.md @@ -9,7 +9,7 @@ AIStudio2API 使用 Go 直接调用 Google AI Studio 的 MakerSuite 私有协议 | 场景 | 必需组件 | 说明 | | --- | --- | --- | | Release 运行 | `aistudio2api` | 需要时在后台自动下载 Camoufox,不需要 Python、Node.js 或 Playwright | -| 源码运行 | Go 1.27.3+、Node.js 22.18+、24.11+ 或 26+、配套 npm | Node.js 只用于构建 Vue 管理端 | +| 源码运行 | Go 1.27.4+、Node.js 22.18+、24.11+ 或 26+、配套 npm | Node.js 只用于构建 Vue 管理端 | | Windows Chrome 导入 | Windows amd64、稳定版 Chrome | Go 程序直接读取本机 Profile 的 OAuth/DBSC 材料 | Windows 用户解压发布包后双击 `aistudio2api.exe`。程序启动后自动打开管理页面,生成服务初始保持停止;账户登录、日志查看和生成服务启停均在该页面完成。 @@ -336,7 +336,7 @@ Camoufox 运行中与服务的 WebDriver BiDi 连接断开时,服务最多等 ## 3. 配置、账户和持久状态 -程序从当前目录读取可选的 `.env`,进程环境变量覆盖同名配置,这些项在设置页中显示为由环境变量决定、不可修改。管理端保存设置时 `.env` 写入 WAA 后端与其余和默认值不同的项;取值无效的项按默认值运行,管理页面顶部与服务日志列出这些项与原值: +程序从当前目录读取可选的 `.env`,进程环境变量覆盖同名配置,这些项在设置页中显示为由环境变量决定、不可修改。管理端保存设置时 `.env` 只写入与默认值不同的项;取值无效的项按默认值运行,管理页面顶部与服务日志列出这些项与原值: | 变量 | 作用 | 默认值 | | --- | --- | --- | @@ -367,7 +367,10 @@ Camoufox 运行中与服务的 WebDriver BiDi 连接断开时,服务最多等 | `MODEL_MAPPING` | 模型别名映射 | 空 | | `MODEL_CHANNELS` | 按模型指定上游通道 | 空 | | `MODEL_ACCOUNTS` | 按模型限定可用账户 | 空 | +| `HIDE_MODELS` | 不在 API 中显示的模型 | 空 | +| `GENERATE_CONTENT_ACCOUNTS` | 迁移模型改走 GenerateContent 的账户 | 空 | | `BUILD_NATIVE_NONSTREAM` | Build 非流式优先原生单次调用 | `true` | +| `BUILD_CHAT_MODELS` | 提供 `-build` 对话模型 | `false` | | `NONSTREAM_KEEPALIVE` | 非流式请求保活 | `true` | | `FAKE_STREAM` | 假流式输出 | `false` | | `YOUTUBE_LINKS` | YouTube 链接作为视频发送 | `false` | @@ -407,7 +410,10 @@ Camoufox 运行中与服务的 WebDriver BiDi 连接断开时,服务最多等 - `MODEL_MAPPING`:逗号分隔,每项以最后一个 `:` 分成别名与模型 ID;保存后立即生效 - `MODEL_CHANNELS`:逗号分隔,每项以最后一个 `:` 分成模型 ID 与通道 `playground` 或 `build`;保存后立即生效 - `MODEL_ACCOUNTS`:逗号分隔,每项以最后一个 `:` 分成模型 ID 与以 `|` 分隔的账户 ID,该模型的自动选号只在这些账户中进行并与 `API_KEY_ACCOUNTS` 取交集;指定账户与绑定文件的请求不受此限制;未列出的模型可用全部账户;保存后立即生效 +- `HIDE_MODELS`:逗号分隔的模型 ID,可带 `models/` 前缀;公开目录去掉这些模型与指向它们的 `MODEL_MAPPING` 别名,生成、计数、embedding、Live、视频与转录请求解析别名与后缀后命中时返回 404;管理端目录照常列出;保存后立即生效 +- `GENERATE_CONTENT_ACCOUNTS`:逗号分隔的账户 ID;模型目录 field 79 为 kind `2` 且 background 为真(`interaction_model` 与 `interaction_task`)的模型在这些账户上改走 `GenerateContent`,其余模型与账户不变;保存后立即生效 - `BUILD_NATIVE_NONSTREAM`:启用 Build 通道时,非流式请求优先选择 Build 原生单次调用 +- `BUILD_CHAT_MODELS`:为 `false` 时公开目录不列出 `-build` 条目,`-build` 模型的请求返回 404;管理端目录照常列出;保存后立即生效 - `NONSTREAM_KEEPALIVE`:非流式请求等待结果期间每 10 秒写出一个换行 - `FAKE_STREAM`:流式请求按非流式取得完整结果后再以流式输出 - `YOUTUBE_LINKS`:用户消息文本中的 YouTube 链接作为视频外部媒体发送 @@ -420,7 +426,7 @@ Camoufox 运行中与服务的 WebDriver BiDi 连接断开时,服务最多等 - `FIRST_EVENT_HEDGE`:`off`、`auto`(各模型与通道近 24 小时原请求首字等待的 p95)或正整数秒 - `FIRST_EVENT_HEDGE_MODELS`:模型 ID,逗号分隔 - `FIRST_EVENT_TIMEOUT`:`off` 或正整数秒,每次尝试从取得账户起到首个语义事件的上限;保存后停止再启动生成服务生效 -- `WAA_BACKEND`:`spidermonkey` 或 `camoufox`,其他取值按 `spidermonkey`;未设置时,启动时按 `auth/` 确定后写入 `.env`:已有账户而没有 `.waa-interpreters` 时为 `camoufox`,否则为 `spidermonkey` +- `WAA_BACKEND`:`spidermonkey` 或 `camoufox` - `MEDIA_OUTPUT`:Chat Completions 与 Messages 正文中生成媒体的引用方式,`inline` 或 `url` - `MEDIA_BASE_URL`:`http` 或 `https`;留空时取请求的协议与 Host diff --git a/docs/images/accounts-dark.webp b/docs/images/accounts-dark.webp index 0f5b584f..b6be7dd4 100644 Binary files a/docs/images/accounts-dark.webp and b/docs/images/accounts-dark.webp differ diff --git a/docs/images/accounts-light.webp b/docs/images/accounts-light.webp index e912d9ef..690b1e95 100644 Binary files a/docs/images/accounts-light.webp and b/docs/images/accounts-light.webp differ diff --git a/docs/images/chat-dark.webp b/docs/images/chat-dark.webp index 3442ec48..7713e403 100644 Binary files a/docs/images/chat-dark.webp and b/docs/images/chat-dark.webp differ diff --git a/docs/images/chat-light.webp b/docs/images/chat-light.webp index f560df97..5794b46a 100644 Binary files a/docs/images/chat-light.webp and b/docs/images/chat-light.webp differ diff --git a/docs/images/image-dark.webp b/docs/images/image-dark.webp index 7b8bcc84..9ea6bba3 100644 Binary files a/docs/images/image-dark.webp and b/docs/images/image-dark.webp differ diff --git a/docs/images/image-light.webp b/docs/images/image-light.webp index f073989e..a3ed2b18 100644 Binary files a/docs/images/image-light.webp and b/docs/images/image-light.webp differ diff --git a/docs/images/logs-dark.webp b/docs/images/logs-dark.webp index 224565b8..401b5587 100644 Binary files a/docs/images/logs-dark.webp and b/docs/images/logs-dark.webp differ diff --git a/docs/images/logs-light.webp b/docs/images/logs-light.webp index d9b89220..66f72329 100644 Binary files a/docs/images/logs-light.webp and b/docs/images/logs-light.webp differ diff --git a/docs/images/models-dark.webp b/docs/images/models-dark.webp index 1291232a..f973e043 100644 Binary files a/docs/images/models-dark.webp and b/docs/images/models-dark.webp differ diff --git a/docs/images/models-light.webp b/docs/images/models-light.webp index 701ea62b..5c732407 100644 Binary files a/docs/images/models-light.webp and b/docs/images/models-light.webp differ diff --git a/docs/images/settings-dark.webp b/docs/images/settings-dark.webp index 11efaf96..b2b6e1dc 100644 Binary files a/docs/images/settings-dark.webp and b/docs/images/settings-dark.webp differ diff --git a/docs/images/settings-light.webp b/docs/images/settings-light.webp index 77ca9310..79744a41 100644 Binary files a/docs/images/settings-light.webp and b/docs/images/settings-light.webp differ diff --git a/docs/images/usage-dark.webp b/docs/images/usage-dark.webp index f247412a..a09b0bdb 100644 Binary files a/docs/images/usage-dark.webp and b/docs/images/usage-dark.webp differ diff --git a/docs/images/usage-light.webp b/docs/images/usage-light.webp index ba9b125f..c17003a6 100644 Binary files a/docs/images/usage-light.webp and b/docs/images/usage-light.webp differ diff --git a/docs/logging.md b/docs/logging.md index 3e4b1c34..82d4c57a 100644 --- a/docs/logging.md +++ b/docs/logging.md @@ -369,7 +369,7 @@ WARN account@example.com 账号切换 model=gemini-3.7-flash status=403 code=7 记录: -- `/v1` 与 `/v1beta` 通过 API key 校验的每个 POST 请求完成后写入一行:请求 ID、完成时间、协议、路径、模型、账户、通道、HTTP 状态、`request.state`、耗时、首个上游事件、排队时间、token 用量(含缓存命中数)、工具调用数、错误摘要,以及最终结果之前未成功的上游尝试 +- `/v1` 与 `/v1beta` 通过 API key 校验的每个 POST 请求完成后写入一行:请求 ID、完成时间、协议、路径、模型、账户、通道、所用 API key 的脱敏标识(`••••` 加 key 的末 4 个字符,不足 8 个字符的 key 只显示后一半;末几位相同的 key 记为同一个标识)、HTTP 状态、`request.state`、耗时、首个上游事件、排队时间、token 用量(含缓存命中数)、工具调用数、错误摘要,以及最终结果之前未成功的上游尝试 - 写入由后台协程批量提交,响应照常返回;等待写入的记录超过 4096 条时丢弃新记录,写入恢复后输出丢弃数 - 记录与汇总按服务器本地日整日保留 90 天 @@ -377,7 +377,7 @@ WARN account@example.com 账号切换 model=gemini-3.7-flash status=403 code=7 - 同一事务按 UTC 小时与服务器本地日累加汇总与耗时分布 - 查询时完整落在范围与单个分桶内的本地日读取日汇总,其余整小时读取小时汇总,范围边缘与跨分桶的部分读取原始记录 -- 服务器时区变化后,下次启动时从小时汇总与原始记录重建本地日汇总 +- 小时与日汇总可由原始记录重建:启动时汇总表的定义与当前版本不同,或服务器时区变化使本地日汇总的起点不再是零点,就清空对应的汇总表并从原始记录重新累加 查询与费用: @@ -385,7 +385,7 @@ WARN account@example.com 账号切换 model=gemini-3.7-flash status=403 code=7 - 看板的估算费用按 Gemini API 与 Vertex AI 公布的当前文本单价从原始记录逐条计算,缓存命中的输入按缓存单价计算 ```text -INFO service 请求账本已按服务器时区重建本地日汇总 days= +INFO service 请求账本已从请求记录重建汇总 tables= days= elapsed= WARN service 请求账本写入队列已满 dropped= ERROR service 请求账本写入失败 records= error= ERROR service 请求账本清理失败 error= diff --git a/docs/protocol.md b/docs/protocol.md index cdc23e07..0bc41cec 100644 --- a/docs/protocol.md +++ b/docs/protocol.md @@ -708,10 +708,12 @@ generation config 字段: 生成与计数请求的模型名可以带思考后缀 `<模型 ID>(<值>)`,例如 `gemini-4-argon(low)`、`gemini-2.5-pro(16384)`。值不区分大小写:`none`、`minimal`、`low`、`medium`、`high`、`xhigh`、`extra_high`、`max` 作为思考强度,非负整数作为思考预算,`auto` 与 `-1` 使用模型默认思考设置;后缀覆盖请求体中的思考强度与预算,去掉后缀的模型 ID 用于调度、请求日志与用量统计。其他值返回 400。Claude Code 1M 上下文模式加在模型名末尾的 `[1m]`(不区分大小写)在完整模型名不是 `MODEL_MAPPING` 别名时去掉,例如 `gemini-4-argon(low)[1m]` 按 `gemini-4-argon(low)` 处理。 -能力码 48 的模型在目录中另有 `<模型 ID>-build` 条目,经 Build 写代码助手生成,思考后缀写在 `-build` 之后,例如 `gemini-3.8-flash-build(low)`;条目定义、请求与流格式见 [Build 通道](build.md)。 +能力码 48 的模型在目录中另有 `<模型 ID>-build` 条目,经 Build 写代码助手生成,思考后缀写在 `-build` 之后,例如 `gemini-3.8-flash-build(low)`;`BUILD_CHAT_MODELS` 为 `true` 时公开;条目定义、请求与流格式见 [Build 通道](build.md)。 模型名等于 `MODEL_MAPPING` 中的别名(可带 `models/` 前缀)时,生成、计数、embedding、Live、视频与转录请求先换成映射的模型名,再解析思考后缀,映射目标可以带后缀,例如 `fast:gemini-4-argon(low)`;别名本身带后缀时以该后缀替换目标自带的后缀,例如 `fast(high)` 按 `gemini-4-argon(high)` 处理。同一别名写了多次时以第一项为准,映射只替换一次。`/v1/models` 与 `/v1beta/models` 在目录之后列出目标在目录中的别名,字段取自目标模型;与目录 ID 同名的别名替换该条目。 +`HIDE_MODELS` 列出的模型不出现在 `/v1/models` 与 `/v1beta/models`,目标为这些模型的别名同样不列出;生成、计数、embedding、Live、视频与转录请求的模型名换成映射目标并去掉思考后缀与 `models/` 前缀后命中隐藏模型时返回 404 `Model <模型> is hidden in settings`;`-build` 模型在 `BUILD_CHAT_MODELS` 关闭时同样不列出,请求返回 404 `Build chat model <模型> is turned off in settings`。 + response modalities: `wire` 指发送给上游的原始数组字段。 @@ -1317,7 +1319,7 @@ MIME 与内容: | TTS | modalities `[3]`,speech config | Part field 3 音频 chunk | | Lyria | modalities `[3]` | Part field 3 音频 chunk | -单声音 speech config 为 `[[[voiceName]]]`。TTS 模型的请求没有设置声音时使用官网默认声音 `Zephyr`。多说话人 speech config 为 `[null,null,[null,[[speaker,[[voiceName]]],...],mode?]]`,mode `1` 为 `VERBATIM`、`2` 为 `CONVERSATIONAL`。 +单声音 speech config 为 `[[[voiceName]]]`,VoiceConfig field 5 为 Gemini API 已存声音 `voice_...` 或声音复刻密钥 `voicekey_...`,写法为 `[[null,null,null,null,"voice_..."]]`。TTS 模型的请求没有设置声音时使用官网默认声音 `Zephyr`。多说话人 speech config 为 `[null,null,[null,[[speaker,[[voiceName]]],...],mode?]]`,mode `1` 为 `VERBATIM`、`2` 为 `CONVERSATIONAL`。 文本 Part field 41 为 SpeechMetadata `[speaker?, style?]`;能力码 85 的 TTS 模型要求多说话人请求的每个文本 Part 带 speaker,且台词不写 `## Transcript:`。相邻且 MIME 相同的音频 Part 按到达顺序拼接。图片宽高比、图片分辨率与 TTS voice 必须来自当前模型能力选项。 @@ -1421,7 +1423,7 @@ Interaction 请求的内容转换: ### 后台 Interaction 任务 -模型目录 field 79 的 kind 为 `1`(agent,如 `deep-research-preview-04-2026`、`deep-research-max-preview-04-2026`、`antigravity-preview-09-2026`)或 `2`(模型,如被迁移账户的 `gemini-4-*`)且 background 为真时,经两个 RPC 生成:`CreateInteraction` 创建任务,`GetInteractionStream` 按 interaction ID 读取任务的增量与终态。 +模型目录 field 79 的 kind 为 `1`(agent,如 `deep-research-preview-04-2026`、`deep-research-max-preview-04-2026`、`antigravity-preview-09-2026`)或 `2`(模型,如被迁移账户的 `gemini-4-*`)且 background 为真时,经两个 RPC 生成:`CreateInteraction` 创建任务,`GetInteractionStream` 按 interaction ID 读取任务的增量与终态。`GENERATE_CONTENT_ACCOUNTS` 列出的账户上,kind 为 `2` 的后台模型改经 `GenerateContent` 生成。 两个 RPC 的 WAA proof 都位于 field 5,`CreateInteraction` 的 binding 为发送的 user/model 文本与内联图片 Base64 按内容顺序以空格连接(工具步骤不参与 binding),`GetInteractionStream` 的 binding 为 interaction ID: @@ -1645,6 +1647,7 @@ setup 与每个后续客户端 wire 都在发送前把 fresh WAA proof 写入外 | 实时 WebSocket | `GET /v1/live`、`GET /v1/robotics/stream` | | Gemini Interactions | `POST /v1beta/interactions`、`GET /v1beta/interactions/{id}`、`DELETE /v1beta/interactions/{id}`、`POST /v1beta/interactions/{id}/cancel`,`/v1` 前缀相同 | | Gemini 文件 | `POST /upload/v1beta/files`、`GET /v1beta/files`、`GET /v1beta/files/{id}`、`DELETE /v1beta/files/{id}` | +| Gemini 声音 | `GET /v1beta/voices`、`POST /v1beta/voices`、`GET /v1beta/voices/{id}`、`DELETE /v1beta/voices/{id}` | 动态路由的注册形状如下,端点表中的 `{id}` 表示对应资源标识: @@ -1862,13 +1865,14 @@ GET/DELETE /v1beta/files/{file} | `from`、`to` | 必填,RFC 3339 时间 | | `tz` | IANA 时区,默认 UTC | | `bucket` | 分桶秒数 `60`、`300`、`900`、`3600`、`86400`,或 `auto` | -| `model`、`account`、`channel`、`protocol`、`state` | 维度筛选,逗号分隔多个取值 | +| `model`、`account`、`channel`、`protocol`、`state`、`api_key` | 维度筛选,逗号分隔多个取值 | | `stack` | `series` 的堆叠维度,默认 `model` | - 统计区间为 `[from, to)`,长度不超过 93 天,分桶数不超过 1500 - `tz` 决定按天分桶的自然日与分钟、小时分桶的对齐 - 同一维度的多个取值为或,不同维度之间为且 -- `stack` 取上述五个筛选维度之一 +- `stack` 取上述六个筛选维度之一 +- `api_key` 的取值是请求所用 API key 的标识:`••••` 加 key 的末 4 个字符,不足 8 个字符的 key 只显示后一半;末几位相同的 key 记为同一个标识;没有配置 key 时为空 `auto` 按范围长度选择粒度: @@ -1883,7 +1887,7 @@ GET/DELETE /v1beta/files/{file} - `previous` 是紧邻 `from` 之前的等长周期;`recent` 统计最近 5 分钟 - `succeeded` 包含 `completed`、`tool_calls`、`limited` 与 `blocked`;`rate_limited` 是 HTTP 429 的失败数 - `duration` 与 `first_event` 只统计成功请求,分位数相对误差约 0.5% -- `groups` 按 `model`、`account`、`channel`、`protocol`、`state` 与 HTTP 状态码 `status` 列出全部取值;`series` 取请求数前 8 的取值,其余合并为 `other: true` 的一组 +- `groups` 按 `model`、`account`、`channel`、`protocol`、`state`、`api_key` 与 HTTP 状态码 `status` 列出全部取值;`series` 取请求数前 8 的取值,其余合并为 `other: true` 的一组 - `options` 列出范围内出现过的维度取值,不受筛选影响 - `latest_at` 是账本中最新一条记录的完成时间 @@ -1896,6 +1900,7 @@ GET/DELETE /v1beta/files/{file} - 按提示长度分档的模型按每个请求的输入 token 选档 - 单价表只含文本生成模型,图片、音频、视频、语音与嵌入模型计为 0 - `unpriced_models` 按名称列出范围内有 token 但没有单价的模型 +- `api_key_cost` 按 `api_key` 取值列出 `cost` 的拆分 `GET /api/usage/pairs` 接受同样的 `from`、`to` 与维度筛选,返回范围内账户与模型的组合,按请求数降序、账户与模型升序排列,管理页的用量排名展开一行时以该行取值作为筛选读取。 @@ -2930,6 +2935,24 @@ delta 联合类型为 `text_delta{text}`、`citations_delta{citation}`、`thinki - tool_use 先发送空 input,再通过 `input_json_delta` 发送完整参数 JSON - 搜索块在来源汇总后以完整的 start/stop block 输出,查询计数随最终 `message_delta.usage` 返回 +### Gemini 声音 + +`/v1beta/voices` 与 Gemini API VoicesService 同形,字段为 snake_case。官网语音页的 MakerSuite `CreateVoice`、`ListVoices`、`GetVoice` 与 `DeleteVoice` 需要 Gemini API 付费层级的 API key,Google AI 方案账户不带 API key 调用时返回 400 `INVALID_ARGUMENT`;服务自己保存 prompted 声音,在预置音色上以风格提示生成语音: + +| 操作 | 行为 | +| --- | --- | +| 创建 | `voice.type` 为 `prompted`,`prompted.input` 必填,`store` 省略或为 `true` | +| 挑选音色 | `gemini-flash-lite-latest` 从 Voice Design 模型的目录音色中排出最贴近描述的 3 个互不相同的音色,同一模型与描述的创建依次取下一个,排名保留到服务重启 | +| 试听 | 以描述为 SpeechMetadata style,在该音色上朗读文本模型按人设写的一句台词,`sample_audio` 为 24 kHz WAV | +| 保存 | `runtime/voices/.json` 与 `.wav`,ID 为 `voice_` 加 16 位十六进制 | +| 列出 | 自定义声音(最新的在前)后接 Voice Design 模型的目录音色(生成服务未启动时只有自定义声音),按 `language_code`、`region_code`、`accent`、`gender`、`pitch`、`persona`、`context`、`type` 与 `search` 筛选,`page_size` 默认 50、最多 1000 | +| 读取与删除 | `GET` 返回带 `sample_audio` 的声音,声音不存在时返回 404 `NOT_FOUND` | +| 复刻 | `type` 为 `replicated` 时返回 400 `FAILED_PRECONDITION` | + +- Voice Design 模型为请求的 `voice.model`,省略时为目录中第一个带 `speech_metadata` 与 `speech_route` 能力的模型 +- 自定义声音的 `base_voice` 是生成时使用的预置音色 +- Gemini `voiceConfig.voice` 或 `prebuiltVoiceConfig.voiceName`、OpenAI Speech `voice` 与 Interactions `speech_config` 的 `voice` 引用自定义声音(可带 `voices/` 前缀)时,请求改写为它的预置音色,描述写在对应台词的 style 之前;多说话人请求只改写 speaker 与该说话人相同的台词;未保存的 `voice_...` 与 `voicekey_...` 写入 VoiceConfig field 5 发给上游 + ### Gemini Interactions `POST /v1beta/interactions` 与 `POST /v1/interactions` 接受同一创建请求,通过 `x-goog-api-key`、Bearer 或 `key` 查询参数认证。 diff --git a/go.mod b/go.mod index 590eea87..de2c169e 100644 --- a/go.mod +++ b/go.mod @@ -1,64 +1,61 @@ module github.com/Mag1cFall/AIStudio2API -go 1.27.3 +go 1.27.4 require ( github.com/HugoSmits86/nativewebp v1.3.0 - github.com/Mag1cFall/fhttp v0.6.8-firefox.2 + github.com/Mag1cFall/fhttp v0.7.3-chrome.1 github.com/Mag1cFall/go-mp3 v0.1.1 github.com/Mag1cFall/go-sentencepiece v0.7.1 - github.com/bogdanfinn/fhttp v0.6.8 - github.com/bogdanfinn/tls-client v1.15.1 - github.com/bogdanfinn/utls v1.7.7-barnius + github.com/bogdanfinn/fhttp v0.7.3 + github.com/bogdanfinn/tls-client v1.18.1 + github.com/bogdanfinn/utls v1.8.2-barnius github.com/brainplusplus/go-browserforge v0.1.0 - github.com/dlclark/regexp2/v2 v2.5.2 + github.com/dlclark/regexp2/v2 v2.13.3 github.com/go-ego/gocc v0.10.0 - github.com/godbus/dbus/v5 v5.2.2 - github.com/gofrs/flock v0.13.0 + github.com/godbus/dbus/v5 v5.2.4 + github.com/gofrs/flock v0.13.2 github.com/google/uuid v1.6.0 github.com/gorilla/websocket v1.5.3 - github.com/klauspost/compress v1.20.1 - github.com/mattn/go-sqlite3 v1.14.52 + github.com/klauspost/compress v1.20.5 + github.com/mattn/go-sqlite3 v1.14.53 github.com/mewkiz/flac v1.0.14 github.com/minio/selfupdate v0.6.0 github.com/modelcontextprotocol/go-sdk v1.8.0 - github.com/nlnwa/whatwg-url v0.6.2 + github.com/nationallibraryofnorway/whatwg-url v0.9.1 github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 - github.com/shirou/gopsutil/v4 v4.26.9 - github.com/thesyncim/gopus v0.2.3 + github.com/shirou/gopsutil/v4 v4.26.10 + github.com/thesyncim/gopus v0.2.11 github.com/tphakala/go-aac v0.7.2 github.com/vearutop/statigz v1.5.0 - github.com/wailsapp/wails/v3 v3.0.0-beta.29 + github.com/wailsapp/wails/v3 v3.1.0 github.com/zaf/g711 v1.4.0 - golang.org/x/crypto/x509roots/fallback v0.0.0-20261030153154-30a33513ff6d - golang.org/x/image v0.41.0 - golang.org/x/mod v0.42.0 - golang.org/x/net v0.60.0 - golang.org/x/sync v0.24.0 - golang.org/x/sys v0.49.0 - golang.org/x/text v0.42.0 + golang.org/x/crypto/x509roots/fallback v0.0.0-20261123192653-4dc4fb521066 + golang.org/x/image v0.48.0 + golang.org/x/mod v0.43.0 + golang.org/x/net v0.63.0 + golang.org/x/sync v0.25.0 + golang.org/x/sys v0.50.0 + golang.org/x/text v0.44.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 ) require ( aead.dev/minisign v0.2.0 // indirect - github.com/adrg/xdg v0.5.3 // indirect - github.com/andybalholm/brotli v1.2.0 // indirect + github.com/andybalholm/brotli v1.2.7 // indirect github.com/bdandy/go-errors v1.2.2 // indirect github.com/bdandy/go-socks4 v1.2.3 // indirect - github.com/bits-and-blooms/bitset v1.20.0 // indirect - github.com/bogdanfinn/quic-go-utls v1.0.9-utls // indirect - github.com/bogdanfinn/websocket v1.5.5-barnius // indirect + github.com/bogdanfinn/quic-go-utls v1.0.13-utls // indirect + github.com/bogdanfinn/websocket v1.5.9-barnius // indirect github.com/coder/websocket v1.8.14 // indirect - github.com/ebitengine/purego v0.11.1 // indirect + github.com/ebitengine/purego v0.11.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/google/jsonschema-go v0.4.3 // indirect github.com/icza/bitio v1.1.0 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect - github.com/mattn/go-colorable v0.1.14 // indirect - github.com/mattn/go-isatty v0.0.24 // indirect github.com/mewkiz/pkg v0.0.0-20250417130911-3f050ff8c56d // indirect github.com/mewpkg/term v0.0.0-20241026122259-37a80af23985 // indirect + github.com/molecule-man/go-brrr v1.2.0 // indirect github.com/power-devops/perfstat v0.0.0-20260805114148-88456608a4f6 // indirect github.com/quic-go/qpack v0.6.0 // indirect github.com/segmentio/asm v1.1.3 // indirect @@ -70,8 +67,9 @@ require ( github.com/vcaesar/cedar v0.50.1 // indirect github.com/yosida95/uritemplate/v3 v3.0.2 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect - golang.org/x/crypto v0.57.0 // indirect + golang.org/x/crypto v0.59.0 // indirect golang.org/x/oauth2 v0.35.0 // indirect + golang.org/x/term v0.48.0 // indirect golang.org/x/time v0.15.0 // indirect google.golang.org/protobuf v1.36.6 // indirect ) diff --git a/go.sum b/go.sum index 1d7fb42f..e526926e 100644 --- a/go.sum +++ b/go.sum @@ -2,32 +2,28 @@ aead.dev/minisign v0.2.0 h1:kAWrq/hBRu4AARY6AlciO83xhNnW9UaC8YipS2uhLPk= aead.dev/minisign v0.2.0/go.mod h1:zdq6LdSd9TbuSxchxwhpA9zEb9YXcVGoE8JakuiGaIQ= github.com/HugoSmits86/nativewebp v1.3.0 h1:n1egtEzSV4KwFtealr7dzdYq1wI/uj/bOQ/QcTcIyVE= github.com/HugoSmits86/nativewebp v1.3.0/go.mod h1:YNQuWenlVmSUUASVNhTDwf4d7FwYQGbGhklC8p72Vr8= -github.com/Mag1cFall/fhttp v0.6.8-firefox.2 h1:IPx4lGEqI0DYzKFxHMyetxVwsTKBWk+wC65/eG474wI= -github.com/Mag1cFall/fhttp v0.6.8-firefox.2/go.mod h1:1KQKGvAc98d+20flM1QVrKuupd7hdOw2tPPZDNLmWi4= +github.com/Mag1cFall/fhttp v0.7.3-chrome.1 h1:POdoJg7im2sh3Z3xCbS1LjAfjAc3IllxpdeMWHi/IXk= +github.com/Mag1cFall/fhttp v0.7.3-chrome.1/go.mod h1:iIc18VAMMj/anflfuD2SB3OSx9jveuAUwnnM+pMt/uk= github.com/Mag1cFall/go-mp3 v0.1.1 h1:r/wBscYGXWpGdEhCQCcrHI36EDbNx6rtio2yv/Y547Y= github.com/Mag1cFall/go-mp3 v0.1.1/go.mod h1:/vhuC+guK5mKVhCBE8ZQSocH0FmHXM244FT7239cSlY= github.com/Mag1cFall/go-sentencepiece v0.7.1 h1:Evzu4bQYge6F2tv40wMqr9MazbtbvoPbSD/eLl2gJEA= github.com/Mag1cFall/go-sentencepiece v0.7.1/go.mod h1:5xb9a9oAB7EQ/J/47DTrj+BSrGoJIcXZ9CB5y27Nehw= -github.com/adrg/xdg v0.5.3 h1:xRnxJXne7+oWDatRhR1JLnvuccuIeCoBu2rtuLqQB78= -github.com/adrg/xdg v0.5.3/go.mod h1:nlTsY+NNiCBGCK2tpm09vRqfVzrc2fLmXGpBLF0zlTQ= -github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ= -github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= +github.com/andybalholm/brotli v1.2.7 h1:UgafRPGMam5ySHfRkhthMqOFA6IFoeF3D7mWIDLjG5A= +github.com/andybalholm/brotli v1.2.7/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= github.com/bdandy/go-errors v1.2.2 h1:WdFv/oukjTJCLa79UfkGmwX7ZxONAihKu4V0mLIs11Q= github.com/bdandy/go-errors v1.2.2/go.mod h1:NkYHl4Fey9oRRdbB1CoC6e84tuqQHiqrOcZpqFEkBxM= github.com/bdandy/go-socks4 v1.2.3 h1:Q6Y2heY1GRjCtHbmlKfnwrKVU/k81LS8mRGLRlmDlic= github.com/bdandy/go-socks4 v1.2.3/go.mod h1:98kiVFgpdogR8aIGLWLvjDVZ8XcKPsSI/ypGrO+bqHI= -github.com/bits-and-blooms/bitset v1.20.0 h1:2F+rfL86jE2d/bmw7OhqUg2Sj/1rURkBn3MdfoPyRVU= -github.com/bits-and-blooms/bitset v1.20.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/bogdanfinn/fhttp v0.6.8 h1:LiQyHOY3i0QoxxNB7nq27/nGNNbtPj0fuBPozhR7Ws4= -github.com/bogdanfinn/fhttp v0.6.8/go.mod h1:A+EKDzMx2hb4IUbMx4TlkoHnaJEiLl8r/1Ss1Y+5e5M= -github.com/bogdanfinn/quic-go-utls v1.0.9-utls h1:tV6eDEiRbRCcepALSzxR94JUVD3N3ACIiRLgyc2Ep8s= -github.com/bogdanfinn/quic-go-utls v1.0.9-utls/go.mod h1:aHph9B9H9yPOt5xnhWKSOum27DJAqpiHzwX+gjvaXcg= -github.com/bogdanfinn/tls-client v1.15.1 h1:KiFAlED55DJ8Fcocn+/1nX6PrDFcttIHAf/GDkV6KN8= -github.com/bogdanfinn/tls-client v1.15.1/go.mod h1:LsU6mXVn8MOFDwTkyRfI7V1BZM1p0wf2ZfZsICW/1fM= -github.com/bogdanfinn/utls v1.7.7-barnius h1:OuJ497cc7F3yKNVHRsYPQdGggmk5x6+V5ZlrCR7fOLU= -github.com/bogdanfinn/utls v1.7.7-barnius/go.mod h1:aAK1VZQlpKZClF1WEQeq6kyclbkPq4hz6xTbB5xSlmg= -github.com/bogdanfinn/websocket v1.5.5-barnius h1:bY+qnxpai1qe7Jmjx+Sds/cmOSpuuLoR8x61rWltjOI= -github.com/bogdanfinn/websocket v1.5.5-barnius/go.mod h1:gvvEw6pTKHb7yOiFvIfAFTStQWyrm25BMVCTj5wRSsI= +github.com/bogdanfinn/fhttp v0.7.3 h1:DLiZfU9dKD+JCFDUZk8XUgbwm32DuvPLp9x2mucNPv0= +github.com/bogdanfinn/fhttp v0.7.3/go.mod h1:Pco5Ml+HnzrBRAu+6BORirlCAF9JqKmAvC0vI3JSjss= +github.com/bogdanfinn/quic-go-utls v1.0.13-utls h1:csafI+9mkfwRqwM8dXdcmC6mgwxTAj+d+PhcqLHnUWg= +github.com/bogdanfinn/quic-go-utls v1.0.13-utls/go.mod h1:w92OqFJYP900bLkAjvnnvV4M43XikIvhvsY39AxXQfM= +github.com/bogdanfinn/tls-client v1.18.1 h1:940xCSoipJG13GaGcvOMnF/f+pOCJ+3pKDwemC7Vnt8= +github.com/bogdanfinn/tls-client v1.18.1/go.mod h1:T7hIrZnYRex0YFc/CWkEvxRV28RXUQlROb2b5FgM4BU= +github.com/bogdanfinn/utls v1.8.2-barnius h1:ypYWUe4gklEgdBYP+cZAfoG/hhVUMG6ot/pmqgbc/Es= +github.com/bogdanfinn/utls v1.8.2-barnius/go.mod h1:piJQqN3RvYCC1Bvh5kqhaAhJ+DC1i7PRJDfPKiZsiF8= +github.com/bogdanfinn/websocket v1.5.9-barnius h1:KY6PMx2I3WspLKJ++wPF5TNhd/fxqu5IpYU+lfH5DbM= +github.com/bogdanfinn/websocket v1.5.9-barnius/go.mod h1:Ay6DcmnKVlpGsLhBucpap77R2e30O//zw7ggH4HIn0o= github.com/bool64/dev v0.2.39 h1:kP8DnMGlWXhGYJEZE/J0l/gVBdbuhoPGL+MJG4QbofE= github.com/bool64/dev v0.2.39/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8ACg= github.com/brainplusplus/go-browserforge v0.1.0 h1:T2UouLxqevWwiC720eldb0EzBfRPc9OQ2GTyPeUaeCY= @@ -36,25 +32,22 @@ github.com/coder/websocket v1.8.14 h1:9L0p0iKiNOibykf283eHkKUHHrpG7f65OE3BhhO7v9 github.com/coder/websocket v1.8.14/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg= github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ= github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/dlclark/regexp2/v2 v2.5.2 h1:HAsucWRhsqcDzl6Ua9aR8JwYOTzrZyPrF0/FNxJVAI0= -github.com/dlclark/regexp2/v2 v2.5.2/go.mod h1:avUrQvPaLz2DrFNHJF0taWAFFX2C1GMSSoeiqFjcBmU= -github.com/ebitengine/purego v0.11.1 h1:2zpWRSQNVKN4eKsKO9eM1ILDgWfYMY9GwqRmK6XeQ/0= -github.com/ebitengine/purego v0.11.1/go.mod h1:DCHPP08djqhNSoTfImcnHYQRZmd0qhakvrozqaEYhGQ= +github.com/dlclark/regexp2/v2 v2.13.3 h1:yaOp65mbYbiTPk4kYd3MLa35486bjjHC4PYxaojrRCY= +github.com/dlclark/regexp2/v2 v2.13.3/go.mod h1:avUrQvPaLz2DrFNHJF0taWAFFX2C1GMSSoeiqFjcBmU= +github.com/ebitengine/purego v0.11.2 h1:WWiTx8rD8zYdOwSj8O/NiNbsOvSAgJMTlyV1XlbUSeU= +github.com/ebitengine/purego v0.11.2/go.mod h1:DCHPP08djqhNSoTfImcnHYQRZmd0qhakvrozqaEYhGQ= github.com/go-ego/gocc v0.10.0 h1:PLgtMnmP1eGs1pjNxIB0kZCdgAss2/U2ZkTrUptLIeY= github.com/go-ego/gocc v0.10.0/go.mod h1:Ek/gRkY2iOZ/bNe8pxZcDFyUPSzW4bLO+bbAf73amN8= -github.com/go-json-experiment/json v0.0.0-20251027170946-4849db3c2f7e h1:Lf/gRkoycfOBPa42vU2bbgPurFong6zXeFtPoxholzU= -github.com/go-json-experiment/json v0.0.0-20251027170946-4849db3c2f7e/go.mod h1:uNVvRXArCGbZ508SxYYTC5v1JWoz2voff5pm25jU1Ok= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= -github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ= -github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c= -github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw= -github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0= +github.com/godbus/dbus/v5 v5.2.4 h1:F2gUCy++NMIxGmo9J+z5le/+ZC8W1OgeR51P4i9ZB/U= +github.com/godbus/dbus/v5 v5.2.4/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c= +github.com/gofrs/flock v0.13.2 h1:9o62TArG4T0f8L46kSf8sLtNUGvJEfiCK9md7/ilko0= +github.com/gofrs/flock v0.13.2/go.mod h1:OEjpF6MC2Plt1fLXTTgXwnZohWbs/Alxf2i1qTne/Vg= github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/jsonschema-go v0.4.3 h1:/DBOLZTfDow7pe2GmaJNhltueGTtDKICi8V8p+DQPd0= @@ -67,18 +60,12 @@ github.com/icza/bitio v1.1.0 h1:ysX4vtldjdi3Ygai5m1cWy4oLkhWTAi+SyO6HC8L9T0= github.com/icza/bitio v1.1.0/go.mod h1:0jGnlLAx8MKMr9VGnn/4YrvZiprkvBelsVIbA9Jjr9A= github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6 h1:8UsGZ2rr2ksmEru6lToqnXgA8Mz1DP11X4zSJ159C3k= github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6/go.mod h1:xQig96I1VNBDIWGCdTt54nHt6EeI639SmHycLYL7FkA= -github.com/klauspost/compress v1.20.1 h1:T7kKElXUMXrUJ2E9QhQhxFtcK5rPyLdsGZvdbLMPdiQ= -github.com/klauspost/compress v1.20.1/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= +github.com/klauspost/compress v1.20.5 h1:rJj5VjH4xQxbnLphg6eqUcDxRFCw1jpMdDY9qXlrwSs= +github.com/klauspost/compress v1.20.5/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= -github.com/matryer/is v1.4.1 h1:55ehd8zaGABKLXQUe2awZ99BD/PTc2ls+KV/dXphgEQ= -github.com/matryer/is v1.4.1/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= -github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= -github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= -github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI= -github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A= -github.com/mattn/go-sqlite3 v1.14.52 h1:wVbm2Qnf4OXkqhBTSPuCRZDRnxfbVrrmiCEroVdog8U= -github.com/mattn/go-sqlite3 v1.14.52/go.mod h1:6JTjA44L93a0QCyJef5YvlPoKXntQPjzWv5gtm9sB6w= +github.com/mattn/go-sqlite3 v1.14.53 h1:mnTM0owzUMrKuLo+0w51NUiB0ir2Fo7kFXlPt/l3BGs= +github.com/mattn/go-sqlite3 v1.14.53/go.mod h1:6JTjA44L93a0QCyJef5YvlPoKXntQPjzWv5gtm9sB6w= github.com/mewkiz/flac v1.0.14 h1:hyRGAM8NCKznoPmIi9zz2jyO+nfmxY2ErqBnHZ+gxh4= github.com/mewkiz/flac v1.0.14/go.mod h1:HfPYDA+oxjyuqMu2V+cyKcxF51KM6incpw5eZXmfA6k= github.com/mewkiz/pkg v0.0.0-20250417130911-3f050ff8c56d h1:IL2tii4jXLdhCeQN69HNzYYW1kl0meSG0wt5+sLwszU= @@ -89,8 +76,10 @@ github.com/minio/selfupdate v0.6.0 h1:i76PgT0K5xO9+hjzKcacQtO7+MjJ4JKA8Ak8XQ9DDw github.com/minio/selfupdate v0.6.0/go.mod h1:bO02GTIPCMQFTEvE5h4DjYB58bCoZ35XLeBf0buTDdM= github.com/modelcontextprotocol/go-sdk v1.8.0 h1:KIvahhYqwtbeniWVPs3TcXEA7b8jEtwfBpOTAI+Urx4= github.com/modelcontextprotocol/go-sdk v1.8.0/go.mod h1:dL7u98E/zjJTGzEq+j30jQ8K2k1mb6LeAH4inEcSGts= -github.com/nlnwa/whatwg-url v0.6.2 h1:jU61lU2ig4LANydbEJmA2nPrtCGiKdtgT0rmMd2VZ/Q= -github.com/nlnwa/whatwg-url v0.6.2/go.mod h1:x0FPXJzzOEieQtsBT/AKvbiBbQ46YlL6Xa7m02M1ECk= +github.com/molecule-man/go-brrr v1.2.0 h1:dOJU45BC3Gc2WXoxAW0rgCAgVuu2gruAOGncfieA0Jw= +github.com/molecule-man/go-brrr v1.2.0/go.mod h1:7ybW6/7gA3oKY45jOfVNjSJDtrr6ea4tzbsTkjmQDC4= +github.com/nationallibraryofnorway/whatwg-url v0.9.1 h1:kGyhz2uSi70VS1JxgSZwZjpmrV8bM5PercNlxhMlls8= +github.com/nationallibraryofnorway/whatwg-url v0.9.1/go.mod h1:3KSm5/kiby6KExnnCXZ1Vmdwc+pLZokAdtJavchDKwg= github.com/power-devops/perfstat v0.0.0-20260805114148-88456608a4f6 h1:jL3a8soXdzuTCcRnKhOmtcsVOObdDTFf4O2B403HPRU= github.com/power-devops/perfstat v0.0.0-20260805114148-88456608a4f6/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8= @@ -101,14 +90,14 @@ github.com/segmentio/asm v1.1.3 h1:WM03sfUOENvvKexOLp+pCqgb/WDjsi7EK8gIsICtzhc= github.com/segmentio/asm v1.1.3/go.mod h1:Ld3L4ZXGNcSLRg4JBsZ3//1+f/TjYl0Mzen/DQy1EJg= github.com/segmentio/encoding v0.5.4 h1:OW1VRern8Nw6ITAtwSZ7Idrl3MXCFwXHPgqESYfvNt0= github.com/segmentio/encoding v0.5.4/go.mod h1:HS1ZKa3kSN32ZHVZ7ZLPLXWvOVIiZtyJnO1gPH1sKt0= -github.com/shirou/gopsutil/v4 v4.26.9 h1:CaBo/hBFqvlJoLvAQEKdHdf5GD97/MN2ACfyv63+2Ig= -github.com/shirou/gopsutil/v4 v4.26.9/go.mod h1:nKH+8wX2zxr/mDbsR+AAy6Qd2z4ZOQ7wfQaEp+yrYmg= +github.com/shirou/gopsutil/v4 v4.26.10 h1:MJN6euesJx53MVEjscYeyRSRcrdIcy3sz5k9nosjldg= +github.com/shirou/gopsutil/v4 v4.26.10/go.mod h1:XpkIrcUMQhwte/dGxu57KtnMMFsbKelI7PP23zweKBk= github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/tam7t/hpkp v0.0.0-20160821193359-2b70b4024ed5 h1:YqAladjX7xpA6BM04leXMWAEjS0mTZ5kUU9KRBriQJc= github.com/tam7t/hpkp v0.0.0-20160821193359-2b70b4024ed5/go.mod h1:2JjD2zLQYH5HO74y5+aE3remJQvl6q4Sn6aWA2wD1Ng= -github.com/thesyncim/gopus v0.2.3 h1:dDJksDaQvDP7bg4esCPclud40UMrpc49HK/1x6jssCs= -github.com/thesyncim/gopus v0.2.3/go.mod h1:rkEZdLUnzw90ZeGzxbmadSF69u6cM+COANn6KX+ceQs= +github.com/thesyncim/gopus v0.2.11 h1:hkQdinldkEyy91pjSegSpzpSyj2meZw7/mNeuvi8XqA= +github.com/thesyncim/gopus v0.2.11/go.mod h1:8IrziSlWi6Mi3N/AyqaMJWdxs8Ph84M9/TYZuaxRge8= github.com/tklauser/go-sysconf v0.4.0 h1:7H0uAN+7RkwWRaxhYXDLqa5V3LPrJeV8wmD9dRUgPQU= github.com/tklauser/go-sysconf v0.4.0/go.mod h1:8mTNWyog7H+MpKijp4VmKJAd2bbYQ2zuUwkYRbUArPI= github.com/tklauser/numcpus v0.12.0 h1:NR85qdvHA9pFse3x3weVZ0r0ST8R6l5RHbZrlRaqob4= @@ -123,13 +112,12 @@ github.com/vcaesar/tt v0.40.0 h1:vWUNRJn13ozP3xXlAXV5q9WivaDSHRS2jQ2J2ayCvQs= github.com/vcaesar/tt v0.40.0/go.mod h1:cH2+AwGAJm19Wa6xvEa+0r+sXDJBT0QgNQey6mwqLeU= github.com/vearutop/statigz v1.5.0 h1:FuWwZiT82yBw4xbWdWIawiP2XFTyEPhIo8upRxiKLqk= github.com/vearutop/statigz v1.5.0/go.mod h1:oHmjFf3izfCO804Di1ZjB666P3fAlVzJEx2k6jNt/Gk= -github.com/wailsapp/wails/v3 v3.0.0-beta.29 h1:oJbXasfieQmMkYtqPlFSPnDe0RwpzA5BKiov8WPD5lo= -github.com/wailsapp/wails/v3 v3.0.0-beta.29/go.mod h1:5DR/EG5FHU8+BNV7tQYQ/rJMjoFsVlYpM+0gp1+gcTI= +github.com/wailsapp/wails/v3 v3.1.0 h1:ld0AXSicXiTTsIvmTq3qNn9FzCP8vIHRSJdkRLgaAo8= +github.com/wailsapp/wails/v3 v3.1.0/go.mod h1:tzDY3W1jzN3ksSqfGalTt7K3PwnGfIqtl+IgIXlXz0I= github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4= github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zaf/g711 v1.4.0 h1:XZYkjjiAg9QTBnHqEg37m2I9q3IIDv5JRYXs2N8ma7c= @@ -140,50 +128,24 @@ go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= -golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= -golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M= -golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA= -golang.org/x/crypto/x509roots/fallback v0.0.0-20261030153154-30a33513ff6d h1:5NBkmd8MXirajj6AAEpi4HFVJnVkBNPTL1ggYAKqaws= -golang.org/x/crypto/x509roots/fallback v0.0.0-20261030153154-30a33513ff6d/go.mod h1:HPze8vhfG6fO06AM+VSvxRm4E3+5Yk375mgrJ5M2z1E= -golang.org/x/image v0.41.0 h1:8wS72eGJMJaBxK6okTzd4WaXumUlTVlb753MlsSvTCo= -golang.org/x/image v0.41.0/go.mod h1:uIc348UZMSvS5Z65CVZ7iDPaNobNFEPeJ4kbqTOszmA= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg= -golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs= +golang.org/x/crypto v0.59.0 h1:xS2jhqYbzNrpvkWP2YTDf4TJwBy3ykR03i8vFDxEc7c= +golang.org/x/crypto v0.59.0/go.mod h1:veDyUwATGs3c+vN3VfTbzViMGXeTBk3WyhBOkn+F/4U= +golang.org/x/crypto/x509roots/fallback v0.0.0-20261123192653-4dc4fb521066 h1:IkSTNrk5HNulTzFHeCzJ5t3UnzLJkSIPaU7nmNI37Uk= +golang.org/x/crypto/x509roots/fallback v0.0.0-20261123192653-4dc4fb521066/go.mod h1:HPze8vhfG6fO06AM+VSvxRm4E3+5Yk375mgrJ5M2z1E= +golang.org/x/image v0.48.0 h1:1AvuPcuoOTJpA7s4VZ5umrb90T3So0rkB/bSGmxkxik= +golang.org/x/image v0.48.0/go.mod h1:mmtg64iqJKGqEgy+r13dfybl85tmxUd2lMnmaiSdWYY= +golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg= +golang.org/x/mod v0.43.0/go.mod h1:4ec1JnuyBz5+FIVhg86UsA39YG8BpnrZdJYSNHmGzHY= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211104170005-ce137452f963/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= -golang.org/x/net v0.60.0 h1:79p50tfZlm0J9YfoDsSi639qSXNGVwEzOPLCxM2FsYU= -golang.org/x/net v0.60.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= +golang.org/x/net v0.63.0 h1:HCoTmNh9EpD1PpK8gBNFY4gcTY4N+KQEO8ylfIKqFJ0= +golang.org/x/net v0.63.0/go.mod h1:15JLg3IX1bLjHK264EZQEbIpTiR/KVLuo9CTRWd0pig= golang.org/x/oauth2 v0.35.0 h1:Mv2mzuHuZuY2+bkyWXIHMfhNdJAdwW3FuWeCPYN5GVQ= golang.org/x/oauth2 v0.35.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= -golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sync v0.25.0 h1:dJnifr0nMV8/SBnBvdo4eSGGnrc3O4FFx6IqvtLcmRs= +golang.org/x/sync v0.25.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -192,50 +154,22 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210228012217-479acdf4ea46/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= -golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= +golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs= +golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= -golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= +golang.org/x/term v0.48.0 h1:G6UU1eiSB8nl3DzeUGt7Mg+2SctI8tPS6Z5/mBt6cOk= +golang.org/x/term v0.48.0/go.mod h1:BRDLHCZr2SUjIeBHHpRyQeC9xzSAVbzY2rvKgafnHf4= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= -golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= +golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo= +golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI= -golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/tools v0.52.0 h1:ryxg4U63oaUYk7uOLTF37n43f4qgtGvqV4Ioit1BaEs= +golang.org/x/tools v0.52.0/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= diff --git a/internal/aistudio/accounts.go b/internal/aistudio/accounts.go index 85555dc8..bbf31b3d 100644 --- a/internal/aistudio/accounts.go +++ b/internal/aistudio/accounts.go @@ -17,7 +17,6 @@ import ( "os/user" "path/filepath" "reflect" - "regexp" "runtime" "slices" "sort" @@ -222,15 +221,12 @@ const bidiSessionRetention = 24 * time.Hour // temporaryFileRetention 是请求创建的临时 Drive 文件自上传起的保留时长,请求结束时删除,进程在请求进行中退出时由到期回收删除 const temporaryFileRetention = 48 * time.Hour -// expiresAt 返回绑定的到期时间,零值表示不按时间到期:内联附件按最近一次引用,上传文件按上传时确定的时间,旧版本请求上传的内联附件与 Omni 输入图片按上传时间,生成视频与任务按完成时间,Live 续接凭证按发放时间 +// expiresAt 返回绑定的到期时间,零值表示不按时间到期:内联附件按最近一次引用,上传文件按上传时确定的时间,生成视频与任务按完成时间,Live 续接凭证按发放时间 func (binding ResourceBinding) expiresAt() time.Time { switch binding.Kind { case "inline-media": return binding.UsedAt.Add(inlineMediaIdle) case "drive-file": - if binding.ExpiresAt.IsZero() && binding.legacyTemporary() { - return binding.CreatedAt.Add(temporaryFileRetention) - } return binding.ExpiresAt case "video-file": return binding.CreatedAt.Add(generatedVideoRetention) @@ -250,35 +246,6 @@ func (binding ResourceBinding) driveFile() bool { return binding.Kind == "inline-media" || binding.Kind == "drive-file" || binding.Kind == "video-file" } -// legacyInlineMediaName 匹配旧版本以 drive-file 记录的请求内联附件的文件名 -var legacyInlineMediaName = regexp.MustCompile(`^inline-media-\d+$`) - -// omniInputImageName 匹配 Omni 视频任务上传的输入图片的文件名 -var omniInputImageName = regexp.MustCompile(`^` + omniVideoPrefix + `[a-z2-7]{26}-image-\d+$`) - -// legacyTemporary 表示没有到期时间的 drive-file 是旧版本请求上传的内联附件或 Omni 输入图片 -func (binding ResourceBinding) legacyTemporary() bool { - return binding.Purpose == "assistants" && - (binding.SHA256 == "" && legacyInlineMediaName.MatchString(binding.Name) || omniInputImageName.MatchString(binding.Name)) -} - -// copySourceKey 以文件名、类型、大小与用途标识一个上传文件 -type copySourceKey struct { - name string - mime string - purpose string - size int64 -} - -// legacyCopy 表示 drive-file 是旧版本请求创建的跨账户临时副本:没有到期时间、摘要与别名,sources 中有更早上传的同名、同类型、同大小、同用途的文件 -func (binding ResourceBinding) legacyCopy(sources map[copySourceKey]time.Time) bool { - if binding.Kind != "drive-file" || !binding.ExpiresAt.IsZero() || binding.SHA256 != "" || binding.Alias != "" { - return false - } - uploadedAt, exists := sources[copySourceKey{name: binding.Name, mime: binding.MIME, purpose: binding.Purpose, size: binding.Size}] - return exists && uploadedAt.Before(binding.CreatedAt) -} - // VideoResourceMetadata 保存 OpenAI 视频对象的持久字段与可下载的结果文件 type VideoResourceMetadata struct { Model string `json:"model"` @@ -414,6 +381,8 @@ type AccountStatus struct { VerificationRequired bool `json:"verification_required,omitempty"` // DeviceBoundSession 表示账户会话带 __Secure-1PSIDRTS 且缺少本地续签材料,约 2 小时内失效 DeviceBoundSession bool `json:"device_bound_session,omitempty"` + // MigratedModels 是账户目录中被迁移到任务接口(ListModels field 79 为后台任务与模型目标)的模型 ID + MigratedModels []string `json:"-"` } // AccountTransition 是账户正在进行的后台操作 @@ -461,9 +430,13 @@ type AccountSelection struct { AllowedAccountIDs []string // PreferredAccountID 是可用时先于其他账户选择的账户 PreferredAccountID string - PlaygroundOnly bool - Channel Channel - PreferredChannel Channel + // PreferredAccountIDs 是按优先级排序的偏好账户列表,非空时优先于 PreferredAccountID + PreferredAccountIDs []string + // PreferIdlePage 为 true 时偏好账户只在当前有空闲页面时优先生效,否则退回当前路由策略 + PreferIdlePage bool + PlaygroundOnly bool + Channel Channel + PreferredChannel Channel // IgnoreQuotaCooldown 为 true 时套餐限额、每日限额与权限拒绝冷却中的账户照常参与选号,拒绝记录有效期内拒绝过不大于 RequestSize 的请求的账户除外,余量多的账户优先 IgnoreQuotaCooldown bool // RequestSize 是请求输入正文的字节数,0 表示未知 @@ -636,6 +609,8 @@ type AccountPool struct { changed chan struct{} // sessionCheck 以官网页面的方式打开 AI Studio 检查账户会话,为空时认证失败直接标记需要重新登录 sessionCheck func(context.Context, *Account) error + // generateContentAccounts 是被迁移到任务接口的模型改走 GenerateContent 的账户 + generateContentAccounts map[string]bool // sessions 合并同一账户并发的会话检查 sessions singleflight.Group // fileBindMu 串行化文件绑定,使公开文件名的重名检查与绑定成为一步 @@ -827,7 +802,12 @@ func (s *AccountStore) Create(accountConfig AccountConfig, state StorageState) ( accountConfig.Label = id directory := filepath.Join(root, id) if _, err := os.Stat(directory); err == nil { - return nil, nil, fmt.Errorf("%w: %s", ErrAccountExists, id) + if !isStalePageCacheDirectory(directory) { + return nil, nil, fmt.Errorf("%w: %s", ErrAccountExists, id) + } + if err := os.RemoveAll(directory); err != nil { + return nil, nil, fmt.Errorf("删除账户目录: %w", err) + } } temporary, err := os.MkdirTemp(root, ".account-*.tmp") if err != nil { @@ -862,6 +842,29 @@ func (s *AccountStore) Create(accountConfig AccountConfig, state StorageState) ( return account, publishLease, nil } +// isStalePageCacheDirectory 判断目录是否仅包含 SpiderMonkey 页面缓存或存储残留文件且不含账户数据与子目录 +func isStalePageCacheDirectory(directory string) bool { + entries, err := os.ReadDir(directory) + if err != nil || len(entries) == 0 { + return false + } + for _, entry := range entries { + if entry.IsDir() || !isPageCacheArtifactName(entry.Name()) { + return false + } + } + return true +} + +// isPageCacheArtifactName 判断文件名是否为 SpiderMonkey 页面缓存或存储文件及其原子写临时文件 +func isPageCacheArtifactName(name string) bool { + switch name { + case pageCacheFile, pageStorageFile: + return true + } + return strings.HasSuffix(name, ".tmp") && (strings.HasPrefix(name, "."+pageCacheFile+"-") || strings.HasPrefix(name, "."+pageStorageFile+"-")) +} + // Delete 删除账户的稳定目录 func (s *AccountStore) Delete(account *Account) error { directory := account.Directory @@ -1151,6 +1154,13 @@ func (p *AccountPool) Account(accountID string) (*Account, error) { return account, nil } +// isCurrentAccount 判断 account 是否仍为池中该 ID 当前有效的账户实例 +func (p *AccountPool) isCurrentAccount(account *Account) bool { + p.mu.Lock() + defer p.mu.Unlock() + return p.byID[account.ID] == account +} + // Add 将新账户加入当前调度池 func (p *AccountPool) Add(account *Account) (resultErr error) { if account.ConfigPath != "" { @@ -3189,10 +3199,15 @@ func (p *AccountPool) Status() []AccountStatus { state = AccountCooldown } models := make([]string, 0, len(account.Models)) + var migrated []string for _, model := range account.Models { models = append(models, model.ID) + if model.Capabilities["interaction_model"] && model.Capabilities["interaction_task"] { + migrated = append(migrated, model.ID) + } } sort.Strings(models) + sort.Strings(migrated) tier := account.BenefitTier.String() message := account.stateMessage if account.runtime.CatalogFingerprint == "" { @@ -3238,6 +3253,7 @@ func (p *AccountPool) Status() []AccountStatus { HiddenModels: len(account.hiddenModels), VerificationRequired: state == AccountRestricted && verificationRestriction(account.runtime.Restricted), DeviceBoundSession: account.StorageState.DeviceBoundSession(), + MigratedModels: migrated, } if !account.LastUsed.IsZero() { status.LastUsed = timePointer(account.LastUsed) @@ -3360,9 +3376,26 @@ func (p *AccountPool) tryAcquireLocked(selection AccountSelection, now time.Time return p.quotaHeadroomLocked(candidates[left], selection, now) > p.quotaHeadroomLocked(candidates[right], selection, now) }) } - sort.SliceStable(candidates, func(left, right int) bool { - return p.accounts[candidates[left].index].ID == selection.PreferredAccountID && p.accounts[candidates[right].index].ID != selection.PreferredAccountID - }) + preferred := selection.PreferredAccountIDs + if len(preferred) == 0 && selection.PreferredAccountID != "" { + preferred = []string{selection.PreferredAccountID} + } + if len(preferred) > 0 { + rankOf := func(account *Account) int { + for index, accountID := range preferred { + if account.ID == accountID { + if selection.PreferIdlePage && !accountHasIdlePageLocked(account) { + return len(preferred) + } + return index + } + } + return len(preferred) + } + sort.SliceStable(candidates, func(left, right int) bool { + return rankOf(p.accounts[candidates[left].index]) < rankOf(p.accounts[candidates[right].index]) + }) + } for _, candidate := range candidates { account := p.accounts[candidate.index] if !selection.anyState && (!account.Config.Enabled || account.State != AccountReady) { @@ -3428,6 +3461,36 @@ func (p *AccountPool) tryAcquireLocked(selection AccountSelection, now time.Time return nil, earliest, waitable, nil } +// accountHasIdlePageLocked 无锁判断账户此刻是否有空闲页面;无常驻 WAA Worker 时按无进行中租约判断,调用方持有 pool.mu +func accountHasIdlePageLocked(account *Account) bool { + if worker := pageWorker(account.ID); worker != nil { + return worker.HasIdlePage(account.active) + } + return account.active == 0 +} + +// HasPreferredIdlePage 判断 selection 的偏好账户中是否有任一账户位于 candidates 内且当前有空闲页面 +func (p *AccountPool) HasPreferredIdlePage(selection AccountSelection, candidates []string) bool { + preferred := selection.PreferredAccountIDs + if len(preferred) == 0 && selection.PreferredAccountID != "" { + preferred = []string{selection.PreferredAccountID} + } + if len(preferred) == 0 || len(candidates) == 0 { + return false + } + p.mu.Lock() + defer p.mu.Unlock() + for _, accountID := range preferred { + if !slices.Contains(candidates, accountID) { + continue + } + if account := p.byID[accountID]; account != nil && accountHasIdlePageLocked(account) { + return true + } + } + return false +} + func (p *AccountPool) hasModelLocked(modelID string) bool { for _, account := range p.accounts { for _, model := range account.Models { @@ -3915,7 +3978,7 @@ func (p *AccountPool) SaveCatalogCache(accountID string, source json.RawMessage) if err != nil { return fmt.Errorf("编码 %s: %w", catalogCacheName, err) } - return atomicWriteFile(filePath, data, 0o600) + return atomicWriteExistingDirFile(filePath, data, 0o600) } // cachedBenefitTiers 返回已载入模型目录的账户的权益等级 diff --git a/internal/aistudio/assistant.go b/internal/aistudio/assistant.go index 15d47a25..f093d544 100644 --- a/internal/aistudio/assistant.go +++ b/internal/aistudio/assistant.go @@ -165,6 +165,11 @@ func assistantModelEntry(base modelEntry) modelEntry { }} } +// IsAssistantModelID 判断模型 ID 是否为经 Build 写代码助手回答的 -build 模型 +func IsAssistantModelID(modelID string) bool { + return strings.HasSuffix(strings.TrimPrefix(strings.TrimSpace(modelID), "models/"), assistantModelSuffix) +} + // assistantBaseModelID 返回 -build 模型对应的目录模型 ID func assistantBaseModelID(modelID string) string { return strings.TrimSuffix(strings.TrimPrefix(strings.TrimSpace(modelID), "models/"), assistantModelSuffix) diff --git a/internal/aistudio/auth.go b/internal/aistudio/auth.go index 58888e8c..96ae850c 100644 --- a/internal/aistudio/auth.go +++ b/internal/aistudio/auth.go @@ -483,14 +483,26 @@ func sameSiteText(value http.SameSite) string { } func atomicWriteFile(filePath string, data []byte, mode os.FileMode) error { + return atomicWrite(filePath, data, mode, true) +} + +// atomicWriteExistingDirFile 原子写入已有目录中的文件,父目录不存在时返回错误而不重建目录 +func atomicWriteExistingDirFile(filePath string, data []byte, mode os.FileMode) error { + return atomicWrite(filePath, data, mode, false) +} + +func atomicWrite(filePath string, data []byte, mode os.FileMode, createDir bool) error { target, err := filepath.Abs(filePath) if err != nil { return fmt.Errorf("解析文件路径: %w", err) } - if err := os.MkdirAll(filepath.Dir(target), 0o755); err != nil { - return fmt.Errorf("创建文件目录: %w", err) + dir := filepath.Dir(target) + if createDir { + if err := os.MkdirAll(dir, 0o755); err != nil { + return fmt.Errorf("创建文件目录: %w", err) + } } - temporary, err := os.CreateTemp(filepath.Dir(target), "."+filepath.Base(target)+"-*.tmp") + temporary, err := os.CreateTemp(dir, "."+filepath.Base(target)+"-*.tmp") if err != nil { return fmt.Errorf("创建临时文件: %w", err) } diff --git a/internal/aistudio/benefit.go b/internal/aistudio/benefit.go index f21b7610..48eb83aa 100644 --- a/internal/aistudio/benefit.go +++ b/internal/aistudio/benefit.go @@ -1,6 +1,7 @@ package aistudio import ( + "errors" "fmt" "net/http" "strings" @@ -158,6 +159,12 @@ func (e *ModelAccessError) ErrorCode() string { return "account_required" } +// NoMoreEligibleAccounts 判断取号错误是剩余候选都不具备调用资格:没有可用账户或剩余候选权益不足 +func NoMoreEligibleAccounts(err error) bool { + var access *ModelAccessError + return errors.Is(err, ErrNoEligibleAccount) || errors.As(err, &access) +} + func modelAllowedByTier(model Model, tier BenefitTier) bool { if len(model.AccessModes) == 0 { return true diff --git a/internal/aistudio/channel.go b/internal/aistudio/channel.go index bd7e15a8..017049a7 100644 --- a/internal/aistudio/channel.go +++ b/internal/aistudio/channel.go @@ -80,6 +80,12 @@ func ContextWithAPIKey(ctx context.Context, key string) context.Context { return context.WithValue(ctx, apiKeyContextKey{}, key) } +// APIKeyFromContext 返回请求上下文中所用的 API key,没有时为空 +func APIKeyFromContext(ctx context.Context) string { + key, _ := ctx.Value(apiKeyContextKey{}).(string) + return key +} + // accountContextKey 是请求上下文中指定账户的键 type accountContextKey struct{} @@ -113,6 +119,31 @@ func (p *AccountPool) SetAPIKeyAccounts(accounts map[string][]string) { p.notifyLocked() } +// SetGenerateContentAccounts 设置被迁移到任务接口的模型改走 GenerateContent 的账户 +func (p *AccountPool) SetGenerateContentAccounts(accountIDs []string) { + accounts := make(map[string]bool, len(accountIDs)) + for _, accountID := range accountIDs { + accounts[accountID] = true + } + p.mu.Lock() + defer p.mu.Unlock() + p.generateContentAccounts = accounts +} + +// routeFor 返回模型选路 route 在租约账户上的实际选路:账户设为改走 GenerateContent 时,被迁移到任务接口的模型(后台任务的模型目标)改走 GenerateContent +func (l *AccountLease) routeFor(route InteractionRouting) InteractionRouting { + if !route.IsModel() || !route.IsTask() { + return route + } + l.pool.mu.Lock() + generateContent := l.pool.generateContentAccounts[l.account.ID] + l.pool.mu.Unlock() + if generateContent { + return ResolveInteractionRouting(0, false) + } + return route +} + // ScopedSelection 把请求指定的账户、所用 API key 与模型绑定的账户并入选择,指定账户与绑定资源的选择不受模型绑定限制 func (p *AccountPool) ScopedSelection(ctx context.Context, selection AccountSelection) AccountSelection { if selection.AccountID == "" { diff --git a/internal/aistudio/client.go b/internal/aistudio/client.go index 1245e1f8..3e9a82e9 100644 --- a/internal/aistudio/client.go +++ b/internal/aistudio/client.go @@ -95,6 +95,49 @@ type Client struct { frontendMu sync.Mutex // frontend 是按地址解析过的官网前端主程序推荐模型 frontend map[string]frontendModels + // driveCacheMu 保护账户级 Drive access token 与应用文件夹缓存及在途去重表 + driveCacheMu sync.Mutex + driveTokens map[string]cachedDriveValue + appFolders map[string]cachedDriveValue + driveTokenFlights map[string]*driveStringFlight + appFolderFlights map[string]*driveStringFlight + // inlineUploadMu 保护同账户同新附件的在途上传去重表 + inlineUploadMu sync.Mutex + inlineUploads map[inlineUploadFlightKey]*inlineUploadFlight +} + +// cachedDriveValue 保存按账户与认证代次缓存的 Drive 令牌或应用文件夹 ID +type cachedDriveValue struct { + value string + account *Account + authGen uint64 + at time.Time +} + +// driveStringFlight 合并同账户并发的 Drive 令牌或应用文件夹查询,所有等待方取消后立即中止底层调用 +// waiters 由 Client.driveCacheMu 保护 +type driveStringFlight struct { + waiters int + cancel context.CancelFunc + done chan struct{} + value string + err error +} + +// inlineUploadFlightKey 标识同账户下同一个待上传内联附件 +type inlineUploadFlightKey struct { + accountID string + key inlineMediaKey +} + +// inlineUploadFlight 合并同账户同新附件的并发上传,所有等待方取消后才中止底层上传 +// waiters 由 Client.inlineUploadMu 保护 +type inlineUploadFlight struct { + waiters int + cancel context.CancelFunc + done chan struct{} + file FileRef + err error } // NewClient 创建协议客户端 @@ -112,6 +155,28 @@ func NewClient(options ClientOptions) *Client { turns: newModelTurnHistory(), assistants: newAssistantAppletCache(), frontend: make(map[string]frontendModels), + driveTokens: make(map[string]cachedDriveValue), + appFolders: make(map[string]cachedDriveValue), + inlineUploads: make(map[inlineUploadFlightKey]*inlineUploadFlight), + } +} + +// accountDriveInvalidator 清理传输层上按账户缓存的 Drive discovery 与指纹状态 +type accountDriveInvalidator interface { + InvalidateAccountDrive(string) +} + +// InvalidateDriveCache 清除账户缓存的 Drive access token、应用文件夹 ID 及传输层 Drive 状态 +func (c *Client) InvalidateDriveCache(accountID string) { + c.driveCacheMu.Lock() + delete(c.driveTokens, accountID) + delete(c.appFolders, accountID) + c.driveCacheMu.Unlock() + if invalidator, ok := c.transport.(accountDriveInvalidator); ok { + invalidator.InvalidateAccountDrive(accountID) + } + if invalidator, ok := c.static.(accountDriveInvalidator); ok { + invalidator.InvalidateAccountDrive(accountID) } } diff --git a/internal/aistudio/generate.go b/internal/aistudio/generate.go index 50a64ca6..ec863c2f 100644 --- a/internal/aistudio/generate.go +++ b/internal/aistudio/generate.go @@ -637,7 +637,7 @@ func applySpeechTranscript(contents []Content, model Model, config GenerationCon return contents } if model.Capabilities["speech_metadata"] { - return splitSpeakerSegments(contents, config.SpeechConfig.Speakers) + return SplitSpeakerSegments(contents, config.SpeechConfig.Speakers) } result := foldSpeechMetadata(contents) for contentIndex, content := range result { @@ -681,8 +681,8 @@ func foldSpeechMetadata(contents []Content) []Content { return result } -// splitSpeakerSegments 把 "说话人: 台词" 文本按多说话人配置拆成带 SpeechMetadata 的分段 -func splitSpeakerSegments(contents []Content, speakers []SpeakerVoiceConfig) []Content { +// SplitSpeakerSegments 把 "说话人: 台词" 文本按多说话人配置拆成带 SpeechMetadata 的分段 +func SplitSpeakerSegments(contents []Content, speakers []SpeakerVoiceConfig) []Content { if len(speakers) == 0 { return contents } @@ -798,6 +798,11 @@ func (c *Client) Generate(ctx context.Context, request GenerateRequest) (<-chan channel = ChannelBuild } route := interactionRouting(entry.model, entry.defaults, channel) + if leased { + route = lease.routeFor(route) + entry.defaults.InteractionStream, entry.defaults.InteractionTask = route.IsStream(), route.IsTask() + entry.defaults.InteractionAgent, entry.defaults.InteractionModel = route.IsAgent(), route.IsModel() + } apiKey, _ := ctx.Value(apiKeyContextKey{}).(string) assistant := entry.model.Capabilities["assistant_route"] if chineseRewriteEligible(request, entry) { @@ -916,16 +921,28 @@ func (c *Client) Generate(ctx context.Context, request GenerateRequest) (<-chan providerModel := entry.model.ID // sentOutput 表示下游已收到本次生成的事件 sentOutput := false - send := func(event Event) error { - providerModel = cmp.Or(event.ProviderModel, providerModel) - event.ProviderModel = providerModel + contractState := contract.newState(ctx) + writeEvent := func(event Event) bool { select { case events <- event: sentOutput = true - return nil + return true case <-ctx.Done(): + return false + } + } + defer func() { + if ctx.Err() == nil { + contractState.close(writeEvent) + } + }() + send := func(event Event) error { + providerModel = cmp.Or(event.ProviderModel, providerModel) + event.ProviderModel = providerModel + if !contractState.push(event, writeEvent) { return ctx.Err() } + return nil } var usage *Usage var finish *Event @@ -947,13 +964,6 @@ func (c *Client) Generate(ctx context.Context, request GenerateRequest) (<-chan } // roundParts 记录当前上游回合收到的未合并 Part,用于回复工具在 more=true 提前收尾时自动构造续接轮 var roundParts []Part - var replyStopMatcher *stopSequenceMatcher - replyStopMatched := false - replyHasFinalText := false - replyLastEndedNewline := false - if useReplyTool && len(request.Config.StopSequences) > 0 { - replyStopMatcher = newStopSequenceMatcher(request.Config.StopSequences) - } matchedStopSequence := "" emitEvent := func(event Event) error { turn.turnToken = cmp.Or(event.TurnToken, turn.turnToken) @@ -982,19 +992,6 @@ func (c *Client) Generate(ctx context.Context, request GenerateRequest) (<-chan roundParts = append(roundParts, clonePart(event.Part)) } } - if replyStopMatcher != nil && !replyStopMatched && event.Kind == EventToolCall && event.FunctionCall != nil && isReplyToolName(event.FunctionCall.Name) { - if text, _, ok := replyToolCallArgs(event.FunctionCall.Arguments); ok && text != "" { - chunk := text - if replyHasFinalText && !replyLastEndedNewline && !strings.HasPrefix(text, "\n") && !strings.HasPrefix(text, "\r") { - chunk = "\n\n" + text - } - replyHasFinalText = true - replyLastEndedNewline = strings.HasSuffix(text, "\n") || strings.HasSuffix(text, "\r") - if _, seq := replyStopMatcher.write(chunk); seq != "" { - replyStopMatched = true - } - } - } committed = committed || !event.Thought && event.payload() } if committed { @@ -1041,10 +1038,7 @@ func (c *Client) Generate(ctx context.Context, request GenerateRequest) (<-chan stopClose() _ = response.Body.Close() usage, finish, held, turn, roundUsage, output, roundParts = nil, nil, nil, modelTurn{}, nil, Output{}, nil - replyStopMatched, replyHasFinalText, replyLastEndedNewline = false, false, false - if useReplyTool && len(request.Config.StopSequences) > 0 { - replyStopMatcher = newStopSequenceMatcher(request.Config.StopSequences) - } + contractState = contract.newState(ctx) if response, decodeStream, err = sendRequest(); err != nil { if ctx.Err() == nil { _ = send(Event{Kind: EventError, Err: err}) @@ -1057,7 +1051,7 @@ func (c *Client) Generate(ctx context.Context, request GenerateRequest) (<-chan } // 模型在回复工具开启时若发出 final(more=true) 后即结束回合(期待工具返回),自动回传 functionResponse 续接剩余段落 replyContinued := false - for replyRound := 0; useReplyTool && !build && !assistant && replyRound < maxReplyToolContinuationRounds && ctx.Err() == nil && err == nil && finish != nil && finish.FinishReason == "stop" && !replyStopMatched; replyRound++ { + for replyRound := 0; useReplyTool && !build && !assistant && replyRound < maxReplyToolContinuationRounds && ctx.Err() == nil && err == nil && finish != nil && finish.FinishReason == "stop" && !contractState.stopped(); replyRound++ { results, ok := replyToolContinuationResults(roundParts) if !ok { break @@ -1203,7 +1197,7 @@ func (c *Client) Generate(ctx context.Context, request GenerateRequest) (<-chan c.turns.store(apiKey, request.turnChain.tip, turn) } }() - return contract.forward(ctx, events), nil + return events, nil } // calledFunction 表示本次生成已输出函数调用,上游的函数调用 Part 总是完整到达 diff --git a/internal/aistudio/interaction.go b/internal/aistudio/interaction.go index ff5e9a4a..6309c563 100644 --- a/internal/aistudio/interaction.go +++ b/internal/aistudio/interaction.go @@ -185,12 +185,15 @@ func encodeModelInteraction(request GenerateRequest, model Model, defaults Gener return nil, nil, fmt.Errorf("模型 %s 不接受 agent_config", request.Model) } contents := request.Contents - if request.PreviousInteractionID != "" { - // 续接上游 interaction 时与官网 oLb 一样只发送最后一个模型轮之后的新输入与工具结果 + var priorCallNames map[string]string + continued := request.PreviousInteractionID != "" + if continued { + // 续接上游 interaction 时与官网 oLb 一样只发送最后一个模型轮之后的新输入与工具结果,保留前序调用名供结果补齐 + priorCallNames = functionCallNames(request.Contents) contents = AgentInput(request.Contents, true) } nativeTools := model.Capabilities["function_declarations"] - steps, binding, hasModelTurn, err := encodeInteractionSteps(contents, nativeTools) + steps, binding, hasModelTurn, err := encodeInteractionSteps(contents, nativeTools, continued, priorCallNames) if err != nil { return nil, nil, err } @@ -339,7 +342,8 @@ func encodeAgentInteraction(request GenerateRequest, model Model) ([]any, []Cont if config := request.AgentConfig; config != nil && config.Type != kind { return nil, nil, fmt.Errorf("agent_config.type %q 与 agent %s 不匹配,应为 %q", config.Type, agent, kind) } - steps, binding, _, err := encodeInteractionSteps(AgentInput(request.Contents, request.PreviousInteractionID != ""), false) + continued := request.PreviousInteractionID != "" + steps, binding, _, err := encodeInteractionSteps(AgentInput(request.Contents, continued), false, continued, nil) if err != nil { return nil, nil, err } @@ -434,8 +438,21 @@ func interactionVideoFormat(config *VideoConfig, resolution string) ([]any, int6 return format, task, nil } +// functionCallNames 收集对话中带 ID 的函数调用名称,供带 previous_interaction_id 续接时补齐工具结果名称 +func functionCallNames(contents []Content) map[string]string { + names := make(map[string]string) + for _, content := range contents { + for _, part := range content.Parts { + if part.FunctionCall != nil && part.FunctionCall.ID != "" { + names[part.FunctionCall.ID] = part.FunctionCall.Name + } + } + } + return names +} + // encodeInteractionSteps 把规范消息编码为 Interaction input steps(field 1 user、field 2 model、nativeTools 时支持 field 4 tool_call 与 field 5 tool_result),并返回参与 WAA 绑定的内容 -func encodeInteractionSteps(contents []Content, nativeTools bool) ([]any, []Content, bool, error) { +func encodeInteractionSteps(contents []Content, nativeTools bool, continued bool, priorCallNames map[string]string) ([]any, []Content, bool, error) { if !nativeTools { var err error contents, err = transcribeFunctionParts(contents) @@ -443,16 +460,6 @@ func encodeInteractionSteps(contents []Content, nativeTools bool) ([]any, []Cont return nil, nil, false, fmt.Errorf("Interaction 模型的 %w", err) } } - callNames := make(map[string]string) - if nativeTools { - for _, content := range contents { - for _, part := range content.Parts { - if part.FunctionCall != nil && part.FunctionCall.ID != "" { - callNames[part.FunctionCall.ID] = part.FunctionCall.Name - } - } - } - } wire := make([]any, 0, len(contents)) binding := make([]Content, 0, len(contents)) hasModelTurn := false @@ -494,6 +501,9 @@ func encodeInteractionSteps(contents []Content, nativeTools bool) ([]any, []Cont return nil, nil, false, fmt.Errorf("Interaction 模型不接受 %s 消息", content.Role) } model := content.Role == RoleAssistant + if nativeTools && content.Role == RoleUser && !slices.ContainsFunc(content.Parts, func(part Part) bool { return part.FunctionResult != nil }) { + pendingCalls = nil + } bindingParts := make([]Part, 0, len(content.Parts)) if !model && len(carried) > 0 { for _, item := range carried { @@ -548,25 +558,40 @@ func encodeInteractionSteps(contents []Content, nativeTools bool) ([]any, []Cont wire = append(wire, step) hasModelTurn = true case nativeTools && part.FunctionResult != nil: - flushText() - // 结果按显式 ID、同名的待完成调用或唯一的待完成调用沿用调用的 ID - id := part.FunctionResult.ID + // 按 linkFunctionResults 规则关联待完成调用:先按 ID、再按唯一待完成调用、最后按名称;无对应调用时改写为文本转录(续接上游 interaction 且有函数名时保留为工具结果步骤) + id, name := part.FunctionResult.ID, part.FunctionResult.Name match := slices.IndexFunc(pendingCalls, func(call pendingCall) bool { - return id != "" && call.id == id || id == "" && call.name == part.FunctionResult.Name + return id != "" && call.id == id }) - if match < 0 && id == "" && len(pendingCalls) == 1 { + if match < 0 && len(pendingCalls) == 1 && (name == "" || name == pendingCalls[0].name) { match = 0 } - name := part.FunctionResult.Name + if match < 0 && name != "" { + match = slices.IndexFunc(pendingCalls, func(call pendingCall) bool { + return call.name == name + }) + } if match >= 0 { id, name = pendingCalls[match].id, cmp.Or(name, pendingCalls[match].name) pendingCalls = slices.Delete(pendingCalls, match, match+1) + } else if continued { + name = cmp.Or(name, priorCallNames[id]) + } + if match < 0 && (!continued || name == "") { + transcript, err := ToolPartTranscript(part) + if err != nil { + return nil, nil, false, fmt.Errorf("Interaction 模型的 contents[%d]: %w", index, err) + } + appendTextPart(model, []any{[]any{transcript}}) + bindingParts = append(bindingParts, Part{Text: transcript}) + continue } + flushText() if id == "" { callSeq++ id = fmt.Sprintf("call_%d", callSeq) } - step, err := encodeInteractionFunctionResult(part.FunctionResult, id, cmp.Or(name, callNames[id])) + step, err := encodeInteractionFunctionResult(part.FunctionResult, id, name) if err != nil { return nil, nil, false, fmt.Errorf("Interaction 模型的 contents[%d]: %w", index, err) } diff --git a/internal/aistudio/page_analytics.go b/internal/aistudio/page_analytics.go index 59fdb501..9b477a5d 100644 --- a/internal/aistudio/page_analytics.go +++ b/internal/aistudio/page_analytics.go @@ -329,19 +329,25 @@ func (analytics *pageAnalytics) load(ctx context.Context) { } analytics.mu.Unlock() pauseContext(ctx, 70*time.Millisecond+rand.N(150*time.Millisecond)) + var group sync.WaitGroup if tagSample() >= 1-container.Diagnostics { analytics.mu.Lock() experiments := analytics.experiments(container) analytics.mu.Unlock() - go func() { + group.Go(func() { pauseContext(ctx, 40*time.Millisecond+rand.N(10*time.Millisecond)) - analytics.diagnoseContainer(container, experiments, containerCached) - }() + if ctx.Err() != nil { + return + } + analytics.diagnoseContainer(ctx, container, experiments, containerCached) + }) } - var group sync.WaitGroup for index, tag := range analyticsTags { group.Go(func() { pauseContext(ctx, time.Duration(index)*(10*time.Millisecond+rand.N(20*time.Millisecond))) + if ctx.Err() != nil { + return + } target := tagManagerOrigin + "/gtag/js?id=" + tag.id + "&cx=c>m=4e" + container.Build cached := runtime.pageCache.notes(target).Tags != nil if runtime.fetchCached(ctx, target, subresourceHeaders(target, "*/*", "script", "")) != nil { @@ -349,6 +355,9 @@ func (analytics *pageAnalytics) load(ctx context.Context) { } script := runtime.pageCache.notes(target).Tags pauseContext(ctx, 90*time.Millisecond+rand.N(60*time.Millisecond)) + if ctx.Err() != nil { + return + } analytics.ready(tag, container, script, target, cached) }) } @@ -746,7 +755,7 @@ func (analytics *pageAnalytics) diagnose(target *analyticsTarget, fin bool) { } // diagnoseContainer 像抽中诊断的 GTM 容器一样在 gtm.init 时以图片请求发出 seq=1 的 tag 诊断:experiments 是容器上报的实验,cached 表示容器脚本取自页面缓存 -func (analytics *pageAnalytics) diagnoseContainer(container *tagScript, experiments string, cached bool) { +func (analytics *pageAnalytics) diagnoseContainer(ctx context.Context, container *tagScript, experiments string, cached bool) { address, err := url.Parse(analytics.container) if err != nil { return @@ -758,9 +767,9 @@ func (analytics *pageAnalytics) diagnoseContainer(container *tagScript, experime } params := []string{"id=" + id, "v=3", "t=t", "pid=" + strconv.FormatInt(rand.Int64N(1<<31), 10), "gtm=45He" + container.Build + "v9" + container.Version + "za200zd9" + container.Container + "xf1", "seq=1", "exp=" + experiments, "dl=" + uriComponent(strings.TrimPrefix(analytics.location, "https://")), "tdp=" + id + ";" + container.Version + ";0;0;0", "frm=0", "rtg=" + container.Container, slo, "hlo=1", "lst=2", "bt=0", "ct=3", "jsp=16~17", "z=0"} - ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + reqCtx, cancel := context.WithTimeout(ctx, time.Minute) defer cancel() - analytics.runtime.drain(analytics.runtime.do(ctx, http.MethodGet, analyticsDiagnosticsURL+"?"+strings.Join(params, "&"), nil, diagnosticsImageHeaders())) + analytics.runtime.drain(analytics.runtime.do(reqCtx, http.MethodGet, analyticsDiagnosticsURL+"?"+strings.Join(params, "&"), nil, diagnosticsImageHeaders())) } // diagnosticsImageHeaders 返回 Firefox 以图片请求发出 tag 诊断的请求头 diff --git a/internal/aistudio/page_attachments.go b/internal/aistudio/page_attachments.go index 08b5e9b8..32995091 100644 --- a/internal/aistudio/page_attachments.go +++ b/internal/aistudio/page_attachments.go @@ -1,8 +1,10 @@ package aistudio import ( + "bytes" "context" "sync" + "time" ) // pageUploader 是在服务上传附件前后发出官网页面伴随请求的账户页面 @@ -56,3 +58,85 @@ func pageLoginState(ctx context.Context, account *Account) (StorageState, error) } return LoadStorageState(account.StoragePath) } + +// pageTokenEntry 非阻塞读取页面启动时取得、仍在 pageTokenLifetime 内的 access token 及其取得时刻 +func (runtime *goWAARuntime) pageTokenEntry() (string, time.Time) { + select { + case <-runtime.tokenReady: + token := runtime.pageToken() + if token == "" { + return "", time.Time{} + } + return token, runtime.tokenAt + default: + return "", time.Time{} + } +} + +// driveDeniedFast 非阻塞判断页面启动时的 GenerateAccessToken 是否明确拒绝了 Drive 授权,known 为 false 表示尚未返回 +func (runtime *goWAARuntime) driveDeniedFast() (denied bool, known bool) { + select { + case <-runtime.tokenReady: + return runtime.accessToken == "", true + default: + return false, false + } +} + +// beforeUploadNonBlocking 不等页面启动请求返回,记录官网插入文件的界面操作 +// GetUserPreferences 尚未返回时这组操作不做,步数计入下一次取 proof 的跳过步数 +func (runtime *goWAARuntime) beforeUploadNonBlocking(ctx context.Context, rerun bool) { + if rerun && runtime.pointer != nil && !runtime.pointer.Clicked().IsZero() { + return + } + if runtime.preferencesReady == nil { + return + } + select { + case <-runtime.preferencesReady: + default: + runtime.skippedInserts.Add(2) + return + } + dialog := !runtime.mediaAcknowledged.Load() && !acknowledgedMedia(runtime.preferences) + menu, picker := insertPause(), insertPause() + var reading time.Duration + steps := 2 + if dialog { + reading, steps = insertPause(), 3 + } + finished := time.Now() + opened := finished.Add(-menu - picker - reading) + if opened.Before(runtime.elements.lastRecorded()) { + runtime.skippedInserts.Add(int64(steps)) + } else { + runtime.elements.insertClicked(opened) + runtime.elements.insertClicked(opened.Add(menu)) + if dialog { + runtime.mediaAcknowledged.Store(true) + runtime.elements.disclaimer(opened.Add(menu+picker), finished) + runtime.acknowledgeMedia(ctx, finished) + } + } +} + +// refreshAppFolderAsync 在本页面还没发过 GetAppFolder 时于后台发出一次,返回的文件夹 ID 交给 onFresh +func (runtime *goWAARuntime) refreshAppFolderAsync(ctx context.Context, onFresh func(string)) { + if runtime.client == nil || runtime.session == nil || !runtime.appFolderCalled.CompareAndSwap(false, true) { + return + } + apiKey := runtime.headers.Get("x-goog-api-key") + visitID := runtime.headers.Get("x-aistudio-visit-id") + if apiKey == "" { + return + } + runtime.startBackground(ctx, func(bg context.Context) { + body := runtime.sendPageRPCs(bg, apiKey, visitID, runtime.headers.Get("x-goog-ext-519733851-bin"), []pageRPC{{method: "GetAppFolder", body: "[]"}})[0] + if len(body) == 0 { + return + } + if fresh, err := parseFirstString(bytes.NewReader(body), "GetAppFolder", "应用文件夹 ID"); err == nil { + onFresh(fresh) + } + }) +} diff --git a/internal/aistudio/page_auxiliary.go b/internal/aistudio/page_auxiliary.go index e4dd60c9..96ef4010 100644 --- a/internal/aistudio/page_auxiliary.go +++ b/internal/aistudio/page_auxiliary.go @@ -8,6 +8,7 @@ import ( "errors" "fmt" "io" + "maps" "math/rand/v2" "net/http" "os" @@ -158,6 +159,8 @@ func (runtime *goWAARuntime) cookieBarReady() chan struct{} { func (runtime *goWAARuntime) loadPageScripts(ctx context.Context) { ready := runtime.cookieBarReady() configStarted := false + var group sync.WaitGroup + defer group.Wait() defer func() { if !configStarted { close(ready) @@ -180,11 +183,11 @@ func (runtime *goWAARuntime) loadPageScripts(ctx context.Context) { _, clientCached := runtime.pageCache.lookup(client, start) cached := client != "" && loaderCached && clientCached if cached { - go func() { + group.Go(func() { if wait(time.Duration(180+rand.IntN(500)) * time.Millisecond) { runtime.loadAvatar(ctx) } - }() + }) } if !wait(770 * time.Millisecond) { return @@ -198,19 +201,19 @@ func (runtime *goWAARuntime) loadPageScripts(ctx context.Context) { prefetch.Set("Sec-Fetch-Site", fetchSite(gapiLoaderScript)) prefetch.Set("Priority", "u=6") loaded := make(chan error, 1) - go func() { loaded <- runtime.fetchCached(ctx, gapiLoaderScript, prefetch) }() - go func() { + group.Go(func() { loaded <- runtime.fetchCached(ctx, gapiLoaderScript, prefetch) }) + group.Go(func() { _ = runtime.fetchCached(ctx, feedbackScript, subresourceHeaders(feedbackScript, "*/*", "script", "")) - }() + }) configStarted = true - go func() { + group.Go(func() { target := cookieBarConfigURL(runtime.cookieBarLanguage) err := runtime.fetchCached(ctx, target, corsHeaders(target)) close(ready) - if err == nil { + if err == nil && ctx.Err() == nil { runtime.analytics.load(ctx) } - }() + }) if <-loaded != nil || cached || !wait(1410*time.Millisecond) { return } @@ -325,12 +328,16 @@ func (runtime *goWAARuntime) loadRenderedResources(ctx context.Context, document priority = "u=5, i" } for _, image := range images { - go func() { _ = runtime.fetchCached(ctx, image, subresourceHeaders(image, imageAccept, "image", priority)) }() + target := image + runtime.startBackground(ctx, func(bg context.Context) { + _ = runtime.fetchCached(bg, target, subresourceHeaders(target, imageAccept, "image", priority)) + }) } for _, font := range fonts { if font[0] == "" { continue } + target := font[0] headers := http.Header{} headers.Set("Accept", fontAccept) headers.Set("Accept-Encoding", "identity") @@ -338,8 +345,10 @@ func (runtime *goWAARuntime) loadRenderedResources(ctx context.Context, document headers.Set("Referer", font[1]) headers.Set("Sec-Fetch-Dest", "font") headers.Set("Sec-Fetch-Mode", "cors") - headers.Set("Sec-Fetch-Site", fetchSite(font[0])) - go func() { _ = runtime.fetchCached(ctx, font[0], headers) }() + headers.Set("Sec-Fetch-Site", fetchSite(target)) + runtime.startBackground(ctx, func(bg context.Context) { + _ = runtime.fetchCached(bg, target, headers) + }) } } @@ -357,6 +366,7 @@ func (runtime *goWAARuntime) fontURL(document pageDocument, family string) strin // pageStorage 是 SpiderMonkey 页面写入、随账户保存的 localStorage 项 type pageStorage struct { + mu sync.Mutex path string items map[string]string } @@ -377,14 +387,23 @@ func loadPageStorage(storageStatePath string) (*pageStorage, error) { return storage, nil } -// set 写入一项并保存到账户目录 +// snapshot 返回当前 localStorage 项的浅拷贝 +func (storage *pageStorage) snapshot() map[string]string { + storage.mu.Lock() + defer storage.mu.Unlock() + return maps.Clone(storage.items) +} + +// set 写入一项并保存到已有账户目录,目录已删除时不重建 func (storage *pageStorage) set(name, value string) error { + storage.mu.Lock() + defer storage.mu.Unlock() storage.items[name] = value data, err := json.Marshal(storage.items) if err != nil { return err } - return atomicWriteFile(storage.path, data, 0o600) + return atomicWriteExistingDirFile(storage.path, data, 0o600) } // cookieBarRecord 是 Cookie 提示条在 localStorage 中记录的一次选择 @@ -398,7 +417,9 @@ type cookieBarRecord struct { // dismissOverlays 在页面启动完成后与 Camoufox 后端一样关闭启动弹层:Google AI 方案账户尚未看过欢迎对话框时点击 Continue,等本次启动的 2a.json 结束后若需要显示 Cookie 提示条且尚未记录选择则点击 No thanks;失败不影响页面也不写入用户日志 func (runtime *goWAARuntime) dismissOverlays(ctx context.Context) { - <-runtime.startupDone + if !closedBefore(ctx, runtime.startupDone) { + return + } tier, _ := decodeBenefitTier(runtime.pageCatalog.Tier) if tier.HeaderValue() != "" && !welcomeSeen(runtime.preferences) { body := `[[null,null,null,null,null,null,null,null,null,null,null,1],[["has_seen_g1_welcome_dialog"]]]` @@ -477,7 +498,10 @@ func (runtime *goWAARuntime) loadGDPCredits(ctx context.Context, apiKey string, runtime.sendPageRPCs(ctx, apiKey, visitID, extension, []pageRPC{gdpImpression("AccountSwitcherRedeemCreditsButton")}) }) group.Go(func() { - time.Sleep(gdpTourDelay) + pauseContext(ctx, gdpTourDelay) + if ctx.Err() != nil { + return + } runtime.sendPageRPCs(ctx, apiKey, visitID, extension, []pageRPC{gdpImpression("RedeemCreditsTourActionButton")}) }) } @@ -537,28 +561,38 @@ func pauseContext(ctx context.Context, duration time.Duration) { // requestStartup 按 offsets 在 pageStarted 之后分组发出 pageStartupRPCs,同组请求同时发出;GetUserPreferences 返回后关闭 preferencesReady,第二个 GenerateAccessToken 返回后关闭 tokenReady,全部返回后关闭 startupDone func (runtime *goWAARuntime) requestStartup(ctx context.Context, apiKey string, visitID string, pageStarted time.Time, offsets [5]time.Duration) { runtime.startupDone, runtime.preferencesReady, runtime.tokenReady = make(chan struct{}), make(chan struct{}), make(chan struct{}) - var group sync.WaitGroup - for index, slot := range []int{0, 2, 3} { - for position := range pageStartupRPCs[index] { - group.Go(func() { - time.Sleep(time.Until(pageStarted.Add(offsets[slot]))) - body := runtime.sendPageRPCs(ctx, apiKey, visitID, "", pageStartupRPCs[index][position:position+1])[0] - switch { - case index == 0 && position == 0: - runtime.preferences = body - close(runtime.preferencesReady) - case index == 1: - runtime.accessToken, _ = parseFirstString(bytes.NewReader(body), "GenerateAccessToken", "bearer token") - runtime.tokenAt = time.Now() - close(runtime.tokenReady) - } - }) + started := runtime.startBackground(ctx, func(bg context.Context) { + var group sync.WaitGroup + for index, slot := range []int{0, 2, 3} { + for position := range pageStartupRPCs[index] { + group.Go(func() { + pauseContext(bg, time.Until(pageStarted.Add(offsets[slot]))) + var body []byte + if bg.Err() == nil { + body = runtime.sendPageRPCs(bg, apiKey, visitID, "", pageStartupRPCs[index][position:position+1])[0] + } + switch { + case index == 0 && position == 0: + runtime.preferences = body + close(runtime.preferencesReady) + case index == 1: + if len(body) > 0 { + runtime.accessToken, _ = parseFirstString(bytes.NewReader(body), "GenerateAccessToken", "bearer token") + runtime.tokenAt = time.Now() + } + close(runtime.tokenReady) + } + }) + } } - } - go func() { group.Wait() close(runtime.startupDone) - }() + }) + if !started { + close(runtime.preferencesReady) + close(runtime.tokenReady) + close(runtime.startupDone) + } } // closedBefore 等待 ready 关闭,ctx 先结束时返回 false @@ -640,9 +674,9 @@ func (runtime *goWAARuntime) acknowledgeMedia(ctx context.Context, confirmed tim } headers.Set("Priority", "u=0") body, _ := json.Marshal(disclaimerBody(mediaDisclaimer, confirmed)) - go func() { - runtime.drain(runtime.do(context.WithoutCancel(ctx), http.MethodPost, makerSuiteRPCURL+"UpdateUserPreferences", body, headers)) - }() + runtime.startBackground(ctx, func(bg context.Context) { + runtime.drain(runtime.do(bg, http.MethodPost, makerSuiteRPCURL+"UpdateUserPreferences", body, headers)) + }) } // uploaded 在服务上传完附件后像官网输入框显示附件一样立即经 drive.count 由页面为每个附件同时发出只含该文件的 CountTokens,不等响应,记下读取附件的 drive @@ -668,24 +702,31 @@ func (runtime *goWAARuntime) inlined(ctx context.Context, rerun bool, files []in } } -// countChip 在后台经 count 发出输入框中一个附件的 CountTokens,官网附件统计 token 期间 Run 照常可点,请求结束不取消它,统计出的 token 数计入带这个附件的回答结束 +// countChip 在后台经 count 发出输入框中一个附件的 CountTokens,官网附件统计 token 期间 Run 照常可点,请求结束不取消它,页面关闭时取消,统计出的 token 数计入带这个附件的回答结束 func (runtime *goWAARuntime) countChip(ctx context.Context, body []byte, count func(context.Context, []byte) ([]byte, error)) { counted := runtime.elements.chipCounting() - go func() { + started := runtime.startBackground(ctx, func(bg context.Context) { tokens := 0 - if response, err := count(context.WithoutCancel(ctx), body); err == nil { + if response, err := count(bg, body); err == nil { usage, _ := ParseTokenCount(bytes.NewReader(response)) tokens = int(usage.InputTokens) } counted(tokens) - }() + }) + if !started { + counted(0) + } } // readAttached 在页面发出 GenerateContent 后像对话中新一轮显示附件一样,0.7–0.9 秒后经上传时记下的 pageDrive 读取最后一个 user 轮次中输入框里的各附件 func (runtime *goWAARuntime) readAttached(ctx context.Context, body []byte) { for _, id := range camoufoxnative.GenerateFiles(body) { if drive, ok := runtime.attachedFiles.LoadAndDelete(id); ok { - time.AfterFunc(700*time.Millisecond+rand.N(200*time.Millisecond), func() { drive.(pageDrive).read(context.WithoutCancel(ctx), id) }) + fileID := id + target := drive.(pageDrive) + runtime.afterBackground(ctx, 700*time.Millisecond+rand.N(200*time.Millisecond), func(bg context.Context) { + target.read(bg, fileID) + }) } } } diff --git a/internal/aistudio/page_resources.go b/internal/aistudio/page_resources.go index b0e6754d..6b87683d 100644 --- a/internal/aistudio/page_resources.go +++ b/internal/aistudio/page_resources.go @@ -273,9 +273,10 @@ func (runtime *goWAARuntime) loadPageIcons(ctx context.Context, document pageDoc if icon == "" { continue } - go func() { - _ = runtime.fetchCached(context.WithoutCancel(ctx), icon, subresourceHeaders(icon, imageAccept, "image", "u=6")) - }() + target := icon + runtime.startBackground(ctx, func(bg context.Context) { + _ = runtime.fetchCached(bg, target, subresourceHeaders(target, imageAccept, "image", "u=6")) + }) } } @@ -318,6 +319,9 @@ func (runtime *goWAARuntime) fetchCached(ctx context.Context, target string, hea return err } } + if ctx.Err() != nil { + return ctx.Err() + } return runtime.pageCache.store(target, response, time.Now(), notes) } @@ -554,7 +558,7 @@ func (cache *pageCache) store(target string, response *http.Response, received t if err != nil { return err } - return atomicWriteFile(cache.path, data, 0o600) + return atomicWriteExistingDirFile(cache.path, data, 0o600) } // cacheMaxAge 返回 Cache-Control 的 max-age,no-cache、no-store 或没有 max-age 时不可直接使用缓存 diff --git a/internal/aistudio/page_tabs.go b/internal/aistudio/page_tabs.go index 7ea7ea51..48d5c0fb 100644 --- a/internal/aistudio/page_tabs.go +++ b/internal/aistudio/page_tabs.go @@ -5,6 +5,7 @@ import ( "errors" "log/slog" "slices" + "strings" "sync" "time" ) @@ -25,6 +26,45 @@ type pageTab struct { // pageModelKey 标记请求的模型,按需新开的页面以它载入新对话页 type pageModelKey struct{} +// ContextWithPageModel 返回携带规范化请求模型的上下文,按需新开标签页时直接以该模型载入 +func ContextWithPageModel(ctx context.Context, modelID string) context.Context { + modelID = strings.TrimPrefix(strings.TrimSpace(modelID), "models/") + if modelID == "" { + return ctx + } + return context.WithValue(ctx, pageModelKey{}, modelID) +} + +// HasIdlePage 无锁判断账户此刻是否有未被占用且未在重置的空闲页面 +func (worker *NativeWorker) HasIdlePage(activeLeases int) bool { + if worker.camoufox != nil { + return worker.camoufox.ReadyPages() > activeLeases + } + ready := int(worker.readyPages.Load()) + if ready < 0 { + return false + } + if ready == 0 { + ready = 1 + } + return ready > activeLeases +} + +// syncReadyPages 按当前未退役页面数更新 readyPages,调用方持有 tabsMu +func (worker *NativeWorker) syncReadyPages() { + if phase := worker.State().Phase; phase == WorkerClosing || phase == WorkerClosed { + worker.readyPages.Store(-1) + return + } + ready := 0 + for _, tab := range worker.tabs { + if !tab.retired { + ready++ + } + } + worker.readyPages.Store(int32(ready)) +} + // extraPage 是账户并发时按需打开的另一个官网页面,operationMu 串行化该页面的界面操作 type extraPage struct { runtime workerRuntime @@ -60,6 +100,41 @@ func leaseActive(lease *AccountLease) bool { return !lease.released } +// assignTabLocked 将空闲页面分给 lease 并登记归还与预开逻辑,调用方持有 tabsMu +func (worker *NativeWorker) assignTabLocked(ctx context.Context, lease *AccountLease, tab *pageTab) { + if tab.holder == lease { + return + } + tab.holder, tab.used = lease, nil + lease.AfterRelease(func() { + worker.tabsMu.Lock() + tab.freed = time.Now() + worker.notifyTabs() + worker.tabsMu.Unlock() + }) + worker.openSpare(ctx, lease) +} + +// popOnPageLocked 取出并清除 lease 登记的页面就绪回调,调用方持有 tabsMu +func (worker *NativeWorker) popOnPageLocked(lease *AccountLease) []func(context.Context, workerRuntime) { + callbacks := worker.onPage[lease] + if len(callbacks) > 0 { + delete(worker.onPage, lease) + } + return callbacks +} + +// runOnPage 在不持有 tabsMu 时按登记顺序在 tab 的页面上执行回调 +func (worker *NativeWorker) runOnPage(ctx context.Context, tab *pageTab, callbacks []func(context.Context, workerRuntime)) { + if len(callbacks) == 0 { + return + } + page := worker.tabPage(tab) + for _, run := range callbacks { + run(ctx, page) + } +} + // usePage 返回 ctx 中请求使用的页面 // 同一租约始终使用同一页面;有空闲页面时用空出最早的一个,账户并发时由 openSpare 在后台预先打开下一个页面 // 都在使用中时在后台再载入一个页面,已有页面空出与新页面载入完成先到哪个用哪个,新开失败且没有页面空出时返回失败原因 @@ -70,31 +145,28 @@ func (worker *NativeWorker) usePage(ctx context.Context) (*pageTab, error) { return &pageTab{}, nil } worker.tabsMu.Lock() - defer worker.tabsMu.Unlock() if len(worker.tabs) == 0 { worker.tabs = []*pageTab{{}} + worker.syncReadyPages() } waited := false for { tab := worker.pageFor(lease) if tab != nil { - if tab.holder != lease { - tab.holder, tab.used = lease, nil - lease.AfterRelease(func() { - worker.tabsMu.Lock() - tab.freed = time.Now() - worker.notifyTabs() - worker.tabsMu.Unlock() - }) - worker.openSpare(ctx, lease) - } + worker.assignTabLocked(ctx, lease, tab) + callbacks := worker.popOnPageLocked(lease) + worker.tabsMu.Unlock() + worker.runOnPage(ctx, tab, callbacks) return tab, nil } if phase := worker.State().Phase; phase == WorkerClosing || phase == WorkerClosed { + worker.tabsMu.Unlock() return nil, errors.New("WAA runtime 已关闭") } if waited && !worker.spare && worker.openErr != nil { - return nil, worker.openErr + err := worker.openErr + worker.tabsMu.Unlock() + return nil, err } if !worker.spare { worker.openPage(ctx, false) @@ -107,7 +179,6 @@ func (worker *NativeWorker) usePage(ctx context.Context) (*pageTab, error) { select { case <-changed: case <-ctx.Done(): - worker.tabsMu.Lock() return nil, ctx.Err() } worker.tabsMu.Lock() @@ -115,6 +186,97 @@ func (worker *NativeWorker) usePage(ctx context.Context) (*pageTab, error) { } } +// tryUsePage 非阻塞尝试取得当前请求的页面;有空闲页面时立即分配并返回 true,全部在用时启动后台新开页面并立即返回 false +func (worker *NativeWorker) tryUsePage(ctx context.Context) (*pageTab, bool) { + lease, ok := AccountLeaseFromContext(ctx) + if _, opens := worker.current().(tabOpener); !ok || !opens { + return &pageTab{}, true + } + worker.tabsMu.Lock() + if len(worker.tabs) == 0 { + worker.tabs = []*pageTab{{}} + worker.syncReadyPages() + } + if tab := worker.pageFor(lease); tab != nil { + worker.assignTabLocked(ctx, lease, tab) + callbacks := worker.popOnPageLocked(lease) + worker.tabsMu.Unlock() + worker.runOnPage(ctx, tab, callbacks) + return tab, true + } + if phase := worker.State().Phase; phase != WorkerClosing && phase != WorkerClosed && !worker.spare { + worker.openPage(ctx, false) + } + worker.tabsMu.Unlock() + return nil, false +} + +// ensurePage 在全部页面都在使用中时立即启动后台新开页面,不占有页面也不等待 +func (worker *NativeWorker) ensurePage(ctx context.Context) { + lease, ok := AccountLeaseFromContext(ctx) + if _, opens := worker.current().(tabOpener); !ok || !opens { + return + } + worker.tabsMu.Lock() + defer worker.tabsMu.Unlock() + if len(worker.tabs) == 0 { + worker.tabs = []*pageTab{{}} + worker.syncReadyPages() + } + if worker.pageFor(lease) != nil { + return + } + if phase := worker.State().Phase; phase != WorkerClosing && phase != WorkerClosed && !worker.spare { + worker.openPage(ctx, false) + } +} + +// deferOnPage 登记租约取得实际页面后在 RunProof 之前执行的回调;租约已持有页面时立即执行,未取得页面便归还租约时自动清理 +func (worker *NativeWorker) deferOnPage(ctx context.Context, lease *AccountLease, run func(context.Context, workerRuntime)) { + worker.tabsMu.Lock() + for _, tab := range worker.tabs { + if tab.holder == lease { + worker.tabsMu.Unlock() + run(ctx, worker.tabPage(tab)) + return + } + } + if worker.onPage == nil { + worker.onPage = make(map[*AccountLease][]func(context.Context, workerRuntime)) + } + first := len(worker.onPage[lease]) == 0 + worker.onPage[lease] = append(worker.onPage[lease], run) + worker.tabsMu.Unlock() + if first { + lease.AfterRelease(func() { + worker.tabsMu.Lock() + delete(worker.onPage, lease) + worker.tabsMu.Unlock() + }) + } +} + +// pageForRPC 非阻塞返回发送页面伴随 RPC 使用的页面:租约已持有页面时返回该页面,否则直接返回当前主页面,不等待也不新开页面 +func (worker *NativeWorker) pageForRPC(ctx context.Context) workerRuntime { + lease, ok := AccountLeaseFromContext(ctx) + if !ok { + return worker.current() + } + worker.tabsMu.Lock() + var held *pageTab + for _, tab := range worker.tabs { + if tab.holder == lease { + held = tab + break + } + } + worker.tabsMu.Unlock() + if held != nil { + return worker.tabPage(held) + } + return worker.current() +} + // notifyTabs 唤醒等待页面空出或新开结束的请求;调用方持有 tabsMu func (worker *NativeWorker) notifyTabs() { if worker.tabsChanged != nil { @@ -181,6 +343,7 @@ func (worker *NativeWorker) openPage(ctx context.Context, spare bool) { worker.spare, worker.openErr = false, err if err == nil { worker.tabs = append(worker.tabs, &pageTab{extra: &extraPage{runtime: opened}, freed: time.Now()}) + worker.syncReadyPages() } worker.notifyTabs() }() @@ -247,6 +410,7 @@ func (worker *NativeWorker) retirePages(previous workerRuntime) error { worker.tabs = append([]*pageTab{{freed: time.Now()}}, worker.tabs...) worker.notifyTabs() } + worker.syncReadyPages() worker.tabsMu.Unlock() if !pinned { closing = append(closing, previous) @@ -264,6 +428,7 @@ func (worker *NativeWorker) dropTab(tab *pageTab) { index := slices.Index(worker.tabs, tab) if index >= 0 { worker.tabs = slices.Delete(worker.tabs, index, index+1) + worker.syncReadyPages() } worker.tabsMu.Unlock() if index >= 0 { @@ -298,5 +463,6 @@ func (worker *NativeWorker) closeExtraPages() error { err = errors.Join(err, tabRuntime(tab).Close()) } worker.tabs = tabs + worker.syncReadyPages() return err } diff --git a/internal/aistudio/reply_tool.go b/internal/aistudio/reply_tool.go index a6d5c9fb..177f0c2e 100644 --- a/internal/aistudio/reply_tool.go +++ b/internal/aistudio/reply_tool.go @@ -81,6 +81,24 @@ func reportReplyToolBypassed(ctx context.Context) { } } +// ReplyToolActive 判断请求在租约账户与当前通道上实际是否启用回复工具,与 Generate 共用同一资格判定 +func (l *AccountLease) ReplyToolActive(request GenerateRequest, modelID string) bool { + if !request.ReplyTool { + return false + } + model, ok := l.Model(modelID) + if !ok { + return false + } + route := l.InteractionRoute(modelID) + if route.IsInteraction() { + return false + } + defaults := modelGenerationDefaults(model) + defaults.InteractionStream, defaults.InteractionTask = route.IsStream(), route.IsTask() + return replyToolEligible(request, modelEntry{model: model, defaults: defaults}, l.Channel() == ChannelBuild, model.Capabilities["assistant_route"]) +} + // replyToolEligible 判断本次生成是否启用回复工具:仅限 Playground 通道的文本生成,排除结构化输出、强制或禁止工具调用、非文本模型与同名函数 func replyToolEligible(request GenerateRequest, entry modelEntry, build bool, assistant bool) bool { if !request.ReplyTool || build || assistant || entry.defaults.InteractionStream || entry.defaults.InteractionTask { diff --git a/internal/aistudio/runtime_go.go b/internal/aistudio/runtime_go.go index 44e29ae7..cb079947 100644 --- a/internal/aistudio/runtime_go.go +++ b/internal/aistudio/runtime_go.go @@ -137,13 +137,76 @@ type goWAARuntime struct { preferences []byte accessToken string tokenAt time.Time - // mediaAcknowledged 表示页面已确认首次上传素材提示,skippedInserts 是空闲不够而没有做、尚未计入取 proof 跳过步数的插入附件操作步数 + // mediaAcknowledged 表示页面已确认首次上传素材提示,appFolderCalled 表示本页已按官网 shareReplay(1) 发出过 GetAppFolder,skippedInserts 是空闲不够而没有做、尚未计入取 proof 跳过步数的插入附件操作步数 mediaAcknowledged atomic.Bool + appFolderCalled atomic.Bool skippedInserts atomic.Int64 // attachedFiles 是页面上传后显示在输入框中、尚未随 GenerateContent 发出的附件,键为 Drive 文件 ID,值为读取它的 pageDrive attachedFiles sync.Map // surveys 是页面在回答结束后请求 HaTS 问卷的状态 surveys pageSurveys + // bgMu 保护页面后台任务的取消上下文、关闭状态与登记计数,Close 时取消并等待所有后台页面活动结束 + bgMu sync.Mutex + bgCtx context.Context + bgCancel context.CancelFunc + bgClosed bool + bgGroup sync.WaitGroup +} + +// startBackground 在页面生命周期内启动后台任务,继承 parent 中的值但不随 parent 取消,页面已关闭时不启动并返回 false,Close 时取消并等待结束 +func (runtime *goWAARuntime) startBackground(parent context.Context, run func(context.Context)) bool { + runtime.bgMu.Lock() + if runtime.bgClosed { + runtime.bgMu.Unlock() + return false + } + if runtime.bgCtx == nil { + runtime.bgCtx, runtime.bgCancel = context.WithCancel(context.Background()) + } + pageCtx := runtime.bgCtx + runtime.bgGroup.Add(1) + runtime.bgMu.Unlock() + go func() { + defer runtime.bgGroup.Done() + ctx := pageCtx + if parent != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithCancel(context.WithoutCancel(parent)) + stop := context.AfterFunc(pageCtx, cancel) + defer func() { + stop() + cancel() + }() + } + run(ctx) + }() + return true +} + +// afterBackground 在页面生命周期内延迟 delay 后执行后台任务,页面关闭时立即取消并不执行 +func (runtime *goWAARuntime) afterBackground(parent context.Context, delay time.Duration, run func(context.Context)) { + runtime.startBackground(parent, func(bg context.Context) { + timer := time.NewTimer(delay) + defer timer.Stop() + select { + case <-bg.Done(): + return + case <-timer.C: + run(bg) + } + }) +} + +// closeBackground 标记页面后台已关闭、取消后台上下文并等待已启动的后台任务结束 +func (runtime *goWAARuntime) closeBackground() { + runtime.bgMu.Lock() + runtime.bgClosed = true + cancel := runtime.bgCancel + runtime.bgMu.Unlock() + if cancel != nil { + cancel() + } + runtime.bgGroup.Wait() } // vmRefreshTimeout 是后台重建 VM 的期限 @@ -375,6 +438,7 @@ func (runtime *goWAARuntime) open(ctx context.Context, fingerprint map[string]an defer func() { if err != nil { runtime.closeTelemetry() + runtime.closeBackground() } }() options := runtime.options @@ -395,7 +459,7 @@ func (runtime *goWAARuntime) open(ctx context.Context, fingerprint map[string]an if runtime.storage, err = loadPageStorage(options.StorageStatePath); err != nil { return err } - maps.Copy(runtime.profile.LocalStorage, runtime.storage.items) + maps.Copy(runtime.profile.LocalStorage, runtime.storage.snapshot()) appVersion, _ := fingerprint["navigator.appVersion"].(string) platform, _ := fingerprint["navigator.platform"].(string) runtime.clientDetails = clientDetails(appVersion, platform, runtime.userAgent) @@ -420,7 +484,7 @@ func (runtime *goWAARuntime) open(ctx context.Context, fingerprint map[string]an return err } documentTiming(runtime.profile.Navigation, time.Since(runtime.profile.NavigationStart)) - go runtime.loadPageScripts(context.WithoutCancel(ctx)) + runtime.startBackground(ctx, runtime.loadPageScripts) runtime.vitals = newPageVitals(runtime.sendClearcut, runtime.telemetry, runtime.uiLocale, runtime.location(), runtime.profile.NavigationStart, runtime.profile.Navigation, page.Path) if runtime.windowID == "" { runtime.windowID = pageWindowID() @@ -429,21 +493,23 @@ func (runtime *goWAARuntime) open(ctx context.Context, fingerprint map[string]an runtime.elements.viewport, _ = numberValue(runtime.profile.Window["innerHeight"]) runtime.elements.width, _ = numberValue(runtime.profile.Window["innerWidth"]) runtime.elements.render = func(part pageRenderPart, images []string) { - runtime.loadRenderedResources(context.WithoutCancel(ctx), document, part, images) + runtime.loadRenderedResources(ctx, document, part, images) } runtime.elements.load(runtime.profile.NavigationStart.Add(time.Duration(navigationInt(runtime.profile.Navigation, "domInteractive")) * time.Millisecond)) dependency, module, err := starterModuleURLs(document) if err != nil { return err } - go runtime.loadStarters(context.WithoutCancel(ctx), dependency, module) + runtime.startBackground(ctx, func(bg context.Context) { + runtime.loadStarters(bg, dependency, module) + }) if runtime.scriptReport.policy != "" { if runtime.scriptReport.loader, err = runtime.pageCache.loader(runtime.scriptReport.bundle); err != nil { return err } } runtime.loadPageIcons(ctx, document) - go runtime.authWarmup(context.WithoutCancel(ctx)) + runtime.startBackground(ctx, runtime.authWarmup) visitID, err := newVisitID() if err != nil { return err @@ -480,7 +546,9 @@ func (runtime *goWAARuntime) open(ctx context.Context, fingerprint map[string]an tierDone := make(chan []byte, 1) go func() { tier := runtime.sendPageRPCs(ctx, apiKey, visitID, "", pageCatalogStartupRPCs[:1])[0] - go runtime.requestGDPProfile(context.WithoutCancel(ctx), apiKey, visitID, tier, loggedExtension) + runtime.startBackground(ctx, func(bg context.Context) { + runtime.requestGDPProfile(bg, apiKey, visitID, tier, loggedExtension) + }) tierDone <- tier }() models := runtime.sendPageRPCs(ctx, apiKey, visitID, "", pageCatalogStartupRPCs[1:])[0] @@ -488,7 +556,7 @@ func (runtime *goWAARuntime) open(ctx context.Context, fingerprint map[string]an catalogAt = time.Now() catalogDone <- bodies }() - runtime.requestStartup(context.WithoutCancel(ctx), apiKey, visitID, pageStarted, offsets) + runtime.requestStartup(ctx, apiKey, visitID, pageStarted, offsets) type startedVM struct { vm *waa.Runtime err error @@ -532,10 +600,12 @@ func (runtime *goWAARuntime) open(ctx context.Context, fingerprint map[string]an runtime.headers.Set("x-goog-ext-519733851-bin", extension) } reportGoStartup(options, camoufoxnative.StartupBootstrappingWAA) - go func() { - <-runtime.startupDone - runtime.sendFollowupRPCs(context.WithoutCancel(ctx), apiKey, visitID, extension) - }() + runtime.startBackground(ctx, func(bg context.Context) { + if !closedBefore(bg, runtime.startupDone) { + return + } + runtime.sendFollowupRPCs(bg, apiKey, visitID, extension) + }) started := <-vmDone if started.err != nil { return started.err @@ -546,7 +616,7 @@ func (runtime *goWAARuntime) open(ctx context.Context, fingerprint map[string]an return err } runtime.vm = vm - go runtime.dismissOverlays(context.WithoutCancel(ctx)) + runtime.startBackground(ctx, runtime.dismissOverlays) runtime.scheduleRefresh() runtime.scheduleIncidents(pageStarted.Add(incidentsPollInterval), apiKey, visitID, extension) return nil @@ -562,7 +632,9 @@ func (runtime *goWAARuntime) scheduleIncidents(at time.Time, apiKey string, visi } runtime.scheduleIncidents(at.Add(incidentsPollInterval), apiKey, visitID, extension) runtime.vmMu.Unlock() - runtime.sendPageRPCs(context.Background(), apiKey, visitID, extension, []pageRPC{incidentsRPC}) + runtime.startBackground(nil, func(bg context.Context) { + runtime.sendPageRPCs(bg, apiKey, visitID, extension, []pageRPC{incidentsRPC}) + }) }) } @@ -881,7 +953,7 @@ func (runtime *goWAARuntime) loggingContextHeader(ctx context.Context, apiKey st return "", nil, err } headers.Set("X-AIStudio-Visit-Id", visitID) - response, err := runtime.do(ctx, http.MethodPost, loggingContextURL, loggingContextRequest(runtime.storage.items, runtime.pageFlags.loggingContextMaxAge, time.Now()), headers) + response, err := runtime.do(ctx, http.MethodPost, loggingContextURL, loggingContextRequest(runtime.storage.snapshot(), runtime.pageFlags.loggingContextMaxAge, time.Now()), headers) if err != nil { return "", nil, fmt.Errorf("读取官网日志上下文: %w", err) } @@ -1499,8 +1571,8 @@ func (runtime *goWAARuntime) SendProtected(ctx context.Context, rawURL string, h if counting { companion := request.Clone() companion.Del("Priority") - time.AfterFunc(followUp.Delay, func() { - counted := runtime.drain(runtime.do(context.WithoutCancel(ctx), http.MethodPost, followUp.URL, followUp.Body, companion)) + runtime.afterBackground(ctx, followUp.Delay, func(bg context.Context) { + counted := runtime.drain(runtime.do(bg, http.MethodPost, followUp.URL, followUp.Body, companion)) if turn != nil { count, _ := ParseTokenCount(bytes.NewReader(counted)) turn.count(time.Now(), int(count.InputTokens)) @@ -1686,10 +1758,9 @@ func (runtime *goWAARuntime) MergeSetCookieHeaders(_ context.Context, headers [] return runtime.session.state.MergeSetCookieHeaders(headers, requestURL, time.Now()) } -// Close 结束 VM 生命周期 +// Close 结束 VM 生命周期、停止遥测并取消等待所有页面后台任务退出 func (runtime *goWAARuntime) Close() error { runtime.vmMu.Lock() - defer runtime.vmMu.Unlock() runtime.closed = true if runtime.refreshTimer != nil { runtime.refreshTimer.Stop() @@ -1700,11 +1771,14 @@ func (runtime *goWAARuntime) Close() error { if runtime.incidentsTimer != nil { runtime.incidentsTimer.Stop() } - if runtime.vm != nil { - runtime.closeVM(runtime.vm) - runtime.vm = nil - } + vm := runtime.vm + runtime.vm = nil + runtime.vmMu.Unlock() runtime.surveys.close() runtime.closeTelemetry() + runtime.closeBackground() + if vm != nil { + runtime.closeVM(vm) + } return nil } diff --git a/internal/aistudio/runtime_native.go b/internal/aistudio/runtime_native.go index a9d4702b..0daaeb3a 100644 --- a/internal/aistudio/runtime_native.go +++ b/internal/aistudio/runtime_native.go @@ -15,6 +15,7 @@ import ( "slices" "strings" "sync" + "sync/atomic" "time" "github.com/Mag1cFall/AIStudio2API/internal/camoufoxnative" @@ -25,15 +26,21 @@ import ( type NativeWorker struct { accountID string // runtimeMu 保护 runtime,重新载入页面后切换为新页面的 runtime - runtimeMu sync.RWMutex - runtime workerRuntime + runtimeMu sync.RWMutex + runtime workerRuntime + // camoufox 指向 Camoufox 后端 Worker,供无锁读取可用标签页数 + camoufox *camoufoxnative.Worker reloadMu sync.Mutex operationMu sync.Mutex stateMu sync.RWMutex state WorkerState - // tabsMu 保护 tabs 与各页面的 holder、used、retired;tabs 是账户的各页面,第一个是主页面,其余是账户并发时按需打开的页面与重新载入前仍有请求在用、等其租约归还后关闭的页面 + // tabsMu 保护 tabs、onPage 与各页面的 holder、used、retired;tabs 是账户的各页面,第一个是主页面,其余是账户并发时按需打开的页面与重新载入前仍有请求在用、等其租约归还后关闭的页面 tabsMu sync.Mutex tabs []*pageTab + // onPage 保存等待页面就绪的租约回调,租约取得页面时执行并移除,租约归还时清理 + onPage map[*AccountLease][]func(context.Context, workerRuntime) + // readyPages 是 SpiderMonkey 后端当前未退役的可用页面数(0 表示仅主页面,-1 表示已关闭),供选号路径无锁读取 + readyPages atomic.Int32 // openingMu 串行化按需新开页面,关闭页面时先等进行中的新开结束;spare 表示后台正在打开一个页面,openErr 是最近一次后台新开失败的原因,tabsChanged 在有页面空出、新开结束或 Worker 关闭时关闭并换新,都由 tabsMu 保护 openingMu sync.Mutex spare bool @@ -99,6 +106,7 @@ func NewNativeWorker(ctx context.Context, accountID string, options camoufoxnati worker := &NativeWorker{ accountID: accountID, runtime: camoufoxRuntime{runtime}, + camoufox: runtime, state: WorkerState{ AccountID: accountID, Phase: WorkerReady, @@ -466,11 +474,7 @@ func (worker *NativeWorker) SendPageRPC(ctx context.Context, signer *Signer, rpc if err != nil { return nil, err } - tab, err := worker.usePage(ctx) - if err != nil { - return nil, err - } - runtime := worker.tabPage(tab) + runtime := worker.pageForRPC(ctx) headers, err := runtime.ProtocolHeaders(ctx) if err != nil { return nil, err @@ -552,6 +556,7 @@ func (worker *NativeWorker) Close() error { defer worker.operationMu.Unlock() pageWorkers.CompareAndDelete(worker.accountID, worker) worker.setPhase(WorkerClosing) + worker.readyPages.Store(-1) err := errors.Join(worker.closeExtraPages(), worker.current().Close()) if err == nil { worker.setPhase(WorkerClosed) diff --git a/internal/aistudio/service.go b/internal/aistudio/service.go index 2a7bf475..b89da782 100644 --- a/internal/aistudio/service.go +++ b/internal/aistudio/service.go @@ -33,20 +33,8 @@ type RequestOptions struct { type PooledService struct { pool *AccountPool client *Client - // options 为运行时热替换的原子请求行为快照;为空时回退读取下方兼容字段 + // options 为运行时热替换的原子请求行为快照 options atomic.Pointer[RequestOptions] - // BuildNativeNonstream 让非流式请求优先使用具备资格的 Build 通道 - BuildNativeNonstream bool - // YouTubeLinks 把 user 文本中的 YouTube 链接作为视频外部媒体发送 - YouTubeLinks bool - // DiscoverHiddenModels 让同步账户目录时探测官网前端已配置、ListModels 尚未列出的模型 - DiscoverHiddenModels bool - // StripThoughtSignatures 发送前去掉对话历史中的思考签名 - StripThoughtSignatures bool - // ContinuationRewrite 改写不接受以 model 轮结尾请求的模型的末尾 assistant 轮 - ContinuationRewrite bool - // ContinuationPrompt 是改写末尾 assistant 轮时写入系统指令的续写提示词,为空时末尾 assistant 正文作为最后一轮 user - ContinuationPrompt string // omniVideos 记录本进程中尚无结果文件的 Omni 视频任务:值为 nil 时仍在生成,为 error 时生成失败 omniVideos sync.Map // inlineMediaMu 保护 inlineMediaUses @@ -61,19 +49,12 @@ func (s *PooledService) SetRequestOptions(opts RequestOptions) { s.options.Store(©Opts) } -// requestOptions 返回当前生效的行为选项快照 +// requestOptions 返回当前生效的行为选项快照,未设置时为零值 func (s *PooledService) requestOptions() RequestOptions { if opts := s.options.Load(); opts != nil { return *opts } - return RequestOptions{ - BuildNativeNonstream: s.BuildNativeNonstream, - YouTubeLinks: s.YouTubeLinks, - DiscoverHiddenModels: s.DiscoverHiddenModels, - StripThoughtSignatures: s.StripThoughtSignatures, - ContinuationRewrite: s.ContinuationRewrite, - ContinuationPrompt: s.ContinuationPrompt, - } + return RequestOptions{} } // ClearHiddenModels 从内存目录与磁盘目录缓存中移除全部官网隐藏模型,返回发生变化的账户数 @@ -721,7 +702,7 @@ func (l *AccountLease) InteractionRoute(modelID string) InteractionRouting { if !ok { return ResolveInteractionRouting(0, false) } - return interactionRouting(model, GenerationDefaults{}, l.Channel()) + return l.routeFor(interactionRouting(model, GenerationDefaults{}, l.Channel())) } // DefinitiveAuthenticationFailure 判断上游是否明确要求重新认证 diff --git a/internal/aistudio/tool_contract.go b/internal/aistudio/tool_contract.go index 1d2d1672..d84fd590 100644 --- a/internal/aistudio/tool_contract.go +++ b/internal/aistudio/tool_contract.go @@ -214,218 +214,248 @@ func validationSchema(value any) any { return schema } -// forward 在完整工具事件发送给客户端前核对显式约束并转换回复工具输出 -func (contract *toolContract) forward(ctx context.Context, source <-chan Event) <-chan Event { +// toolContractState 保存单个生成流的工具约束校验、回复工具 final 解包分段与停止序列状态 +type toolContractState struct { + ctx context.Context + contract *toolContract + calls int + serverSideUsed bool + failed bool + usedReplyTool bool + hasFinalText bool + lastFinalEndedNewline bool + sawPlainText bool + bypassReported bool + matchedStop string + pendingCalls []Event + lastTextEvent Event + matcher *stopSequenceMatcher +} + +// newState 为单次生成流构造校验与回复工具解包状态,contract 为 nil 时返回 nil +func (contract *toolContract) newState(ctx context.Context) *toolContractState { if contract == nil { - return source + return nil } - destination := make(chan Event, 8) - go func() { - defer close(destination) - calls := 0 - serverSideUsed := false - failed := false - usedReplyTool := false - hasFinalText := false - lastFinalEndedNewline := false - sawPlainText := false - bypassReported := false - matchedStop := "" - var pendingCalls []Event - var lastTextEvent Event - var matcher *stopSequenceMatcher - if contract.replyTool && len(contract.stopSequences) > 0 { - matcher = newStopSequenceMatcher(contract.stopSequences) + state := &toolContractState{ctx: ctx, contract: contract} + if contract.replyTool && len(contract.stopSequences) > 0 { + state.matcher = newStopSequenceMatcher(contract.stopSequences) + } + return state +} + +// stopped 表示该流已因约束失败或命中停止序列停止接收后续正文与续接 +func (state *toolContractState) stopped() bool { + return state != nil && (state.failed || state.matchedStop != "") +} + +func (state *toolContractState) flushTextTail(send func(Event) bool) bool { + if state.matcher == nil || state.matchedStop != "" { + return true + } + pending := state.matcher.flush() + if pending == "" { + return true + } + textEvent := Event{ + Kind: EventText, + Part: Part{Text: pending}, + ProviderModel: state.lastTextEvent.ProviderModel, + TurnToken: state.lastTextEvent.TurnToken, + DebugInfo: state.lastTextEvent.DebugInfo, + ResponseID: state.lastTextEvent.ResponseID, + FrameUsage: state.lastTextEvent.FrameUsage, + FinishFrame: state.lastTextEvent.FinishFrame, + } + return send(textEvent) +} + +func (state *toolContractState) flushPendingCalls(send func(Event) bool) bool { + if !state.flushTextTail(send) { + return false + } + if state.matchedStop != "" { + state.pendingCalls = nil + return true + } + for _, pending := range state.pendingCalls { + if !send(pending) { + return false } - send := func(event Event) bool { - select { - case destination <- event: - return true - case <-ctx.Done(): - return false - } + } + state.pendingCalls = nil + return true +} + +func (state *toolContractState) reportBypass() { + if state.contract.replyTool && !state.usedReplyTool && state.sawPlainText && !state.bypassReported { + state.bypassReported = true + reportReplyToolBypassed(state.ctx) + } +} + +// push 校验并转发单个事件,将回复工具 final 分段拼接为正文并应用停止序列,下游停止接收时返回 false +func (state *toolContractState) push(event Event, send func(Event) bool) bool { + if state == nil { + return send(event) + } + if state.failed { + return true + } + if state.matchedStop != "" { + state.pendingCalls = nil + switch event.Kind { + case EventUsage: + return send(event) + case EventFinish: + state.reportBypass() + event.FinishReason = "stop_sequence" + event.StopSequence = state.matchedStop + return send(event) } - flushTextTail := func() bool { - if matcher == nil || matchedStop != "" { - return true + return true + } + if state.contract.replyTool && event.Kind == EventToolCall && event.FunctionCall != nil && isReplyToolName(event.FunctionCall.Name) { + text, ok := replyToolText(event.FunctionCall.Arguments) + if !ok { + state.failed = true + state.reportBypass() + return send(Event{Kind: EventError, Err: fmt.Errorf("上游 function %q 参数违反 strict Schema: %w", replyToolName, errors.New("reply tool final arguments must include string content"))}) + } + state.usedReplyTool = true + reportReplyToolCall(state.ctx) + state.lastTextEvent = event + rawText := text + if rawText != "" { + if state.hasFinalText && !state.lastFinalEndedNewline && !strings.HasPrefix(rawText, "\n") && !strings.HasPrefix(rawText, "\r") { + text = "\n\n" + rawText } - pending := matcher.flush() - if pending == "" { - return true + state.hasFinalText = true + state.lastFinalEndedNewline = strings.HasSuffix(rawText, "\n") || strings.HasSuffix(rawText, "\r") + } + if state.matcher != nil { + var sequence string + text, sequence = state.matcher.write(text) + if sequence != "" { + state.matchedStop = sequence } + } + if text != "" { textEvent := Event{ Kind: EventText, - Part: Part{Text: pending}, - ProviderModel: lastTextEvent.ProviderModel, - TurnToken: lastTextEvent.TurnToken, - DebugInfo: lastTextEvent.DebugInfo, - ResponseID: lastTextEvent.ResponseID, - FrameUsage: lastTextEvent.FrameUsage, - FinishFrame: lastTextEvent.FinishFrame, + Part: Part{Text: text}, + ProviderModel: event.ProviderModel, + TurnToken: event.TurnToken, + DebugInfo: event.DebugInfo, + ResponseID: event.ResponseID, + FrameUsage: event.FrameUsage, + FinishFrame: event.FinishFrame, } return send(textEvent) } - flushPendingCalls := func() bool { - if !flushTextTail() { - return false + return true + } + if state.contract.replyTool && event.Kind == EventText && event.Text != "" { + state.sawPlainText = true + state.lastTextEvent = event + if state.matcher != nil { + text, sequence := state.matcher.write(event.Text) + if sequence != "" { + state.matchedStop = sequence } - if matchedStop != "" { - pendingCalls = nil + if text == "" { return true } - for _, pending := range pendingCalls { - if !send(pending) { - return false - } - } - pendingCalls = nil - return true - } - reportBypass := func() { - if contract.replyTool && !usedReplyTool && sawPlainText && !bypassReported { - bypassReported = true - reportReplyToolBypassed(ctx) - } + event.Text = text } - for event := range source { - if failed { - continue - } - if matchedStop != "" { - pendingCalls = nil - switch event.Kind { - case EventUsage: - if !send(event) { - return - } - case EventFinish: - reportBypass() - event.FinishReason = "stop_sequence" - event.StopSequence = matchedStop - if !send(event) { - return - } - } - continue - } - if contract.replyTool && event.Kind == EventToolCall && event.FunctionCall != nil && isReplyToolName(event.FunctionCall.Name) { - text, ok := replyToolText(event.FunctionCall.Arguments) - if !ok { - failed = true - reportBypass() - if !send(Event{Kind: EventError, Err: fmt.Errorf("上游 function %q 参数违反 strict Schema: %w", replyToolName, errors.New("reply tool final arguments must include string content"))}) { - return - } - continue - } - usedReplyTool = true - reportReplyToolCall(ctx) - lastTextEvent = event - rawText := text - if rawText != "" { - if hasFinalText && !lastFinalEndedNewline && !strings.HasPrefix(rawText, "\n") && !strings.HasPrefix(rawText, "\r") { - text = "\n\n" + rawText - } - hasFinalText = true - lastFinalEndedNewline = strings.HasSuffix(rawText, "\n") || strings.HasSuffix(rawText, "\r") - } - if matcher != nil { - var sequence string - text, sequence = matcher.write(text) - if sequence != "" { - matchedStop = sequence - } - } - if text != "" { - textEvent := Event{ - Kind: EventText, - Part: Part{Text: text}, - ProviderModel: event.ProviderModel, - TurnToken: event.TurnToken, - DebugInfo: event.DebugInfo, - ResponseID: event.ResponseID, - FrameUsage: event.FrameUsage, - FinishFrame: event.FinishFrame, - } - if !send(textEvent) { - return - } - } - continue - } - if contract.replyTool && event.Kind == EventText && event.Text != "" { - sawPlainText = true - lastTextEvent = event - if matcher != nil { - text, sequence := matcher.write(event.Text) - if sequence != "" { - matchedStop = sequence - } - if text == "" { - continue - } - event.Text = text - } - } - var err error - if event.Kind == EventGrounding || event.Kind == EventExecutableCode || event.Kind == EventCodeExecutionResult || event.Kind == EventServerToolCall { - serverSideUsed = true - } - if event.Kind == EventToolCall && event.FunctionCall != nil { - calls++ - call := event.FunctionCall - switch { - case contract.names != nil && !contract.names[call.Name]: - err = fmt.Errorf("上游返回了未选择的函数 %q", call.Name) - case contract.parallel != nil && !*contract.parallel && calls > 1: - err = fmt.Errorf("上游违反单次工具调用约束") - default: - if schema := contract.schemas[call.Name]; schema != nil { - value, decodeErr := jsonschema.UnmarshalJSON(bytes.NewReader(call.Arguments)) - if decodeErr != nil { - err = decodeErr - } else { - err = schema.Validate(value) - } - if err != nil { - err = fmt.Errorf("上游 function %q 参数违反 strict Schema: %w", call.Name, err) - } - } - } - } - if event.Kind == EventFinish && contract.required && calls == 0 && !(contract.serverSide && serverSideUsed) { - err = fmt.Errorf("上游未返回 required tool call") - } - if err != nil { - event = Event{Kind: EventError, Err: err} - failed = true - } - if contract.replyTool && !failed && event.Kind == EventToolCall && event.FunctionCall != nil { - pendingCalls = append(pendingCalls, event) - continue - } - if contract.replyTool && (event.Kind == EventUsage || event.Kind == EventFinish) { - if !flushPendingCalls() { - return + } + var err error + if event.Kind == EventGrounding || event.Kind == EventExecutableCode || event.Kind == EventCodeExecutionResult || event.Kind == EventServerToolCall { + state.serverSideUsed = true + } + if event.Kind == EventToolCall && event.FunctionCall != nil { + state.calls++ + call := event.FunctionCall + switch { + case state.contract.names != nil && !state.contract.names[call.Name]: + err = fmt.Errorf("上游返回了未选择的函数 %q", call.Name) + case state.contract.parallel != nil && !*state.contract.parallel && state.calls > 1: + err = fmt.Errorf("上游违反单次工具调用约束") + default: + if schema := state.contract.schemas[call.Name]; schema != nil { + value, decodeErr := jsonschema.UnmarshalJSON(bytes.NewReader(call.Arguments)) + if decodeErr != nil { + err = decodeErr + } else { + err = schema.Validate(value) } - } else if contract.replyTool && !failed && event.Kind != EventText && event.Kind != EventError { - if !flushTextTail() { - return + if err != nil { + err = fmt.Errorf("上游 function %q 参数违反 strict Schema: %w", call.Name, err) } } - if contract.replyTool && (event.Kind == EventFinish || event.Kind == EventError) { - reportBypass() - } - if !send(event) { - return + } + } + if event.Kind == EventFinish && state.contract.required && state.calls == 0 && !(state.contract.serverSide && state.serverSideUsed) { + err = fmt.Errorf("上游未返回 required tool call") + } + if err != nil { + event = Event{Kind: EventError, Err: err} + state.failed = true + } + if state.contract.replyTool && !state.failed && event.Kind == EventToolCall && event.FunctionCall != nil { + state.pendingCalls = append(state.pendingCalls, event) + return true + } + if state.contract.replyTool && (event.Kind == EventUsage || event.Kind == EventFinish) { + if !state.flushPendingCalls(send) { + return false + } + } else if state.contract.replyTool && !state.failed && event.Kind != EventText && event.Kind != EventError { + if !state.flushTextTail(send) { + return false + } + } + if state.contract.replyTool && (event.Kind == EventFinish || event.Kind == EventError) { + state.reportBypass() + } + return send(event) +} + +// close 在事件流结束时补发暂存文本与挂起的客户端工具调用并报告绕过 +func (state *toolContractState) close(send func(Event) bool) bool { + if state == nil || state.failed { + return true + } + if !state.flushPendingCalls(send) { + return false + } + state.reportBypass() + return true +} + +// forward 在完整工具事件发送给客户端前核对显式约束并转换回复工具输出 +func (contract *toolContract) forward(ctx context.Context, source <-chan Event) <-chan Event { + if contract == nil { + return source + } + destination := make(chan Event, 8) + go func() { + defer close(destination) + state := contract.newState(ctx) + send := func(event Event) bool { + select { + case destination <- event: + return true + case <-ctx.Done(): + return false } } - if !failed { - if !flushPendingCalls() { + for event := range source { + if !state.push(event, send) { return } - reportBypass() } + state.close(send) }() return destination } diff --git a/internal/aistudio/transcription_service.go b/internal/aistudio/transcription_service.go index 8543b75e..5cb0aac4 100644 --- a/internal/aistudio/transcription_service.go +++ b/internal/aistudio/transcription_service.go @@ -93,7 +93,7 @@ func (s *PooledService) Transcribe(ctx context.Context, request TranscriptionReq recoveryAccountID = "" lease, owned, err := acquireQueuedLease(ctx, s.pool, selection) if err != nil { - if requestErr != nil && errors.Is(err, ErrNoEligibleAccount) { + if requestErr != nil && NoMoreEligibleAccounts(err) { break } return result, err diff --git a/internal/aistudio/transport_browser.go b/internal/aistudio/transport_browser.go index fed51514..49e6dffd 100644 --- a/internal/aistudio/transport_browser.go +++ b/internal/aistudio/transport_browser.go @@ -19,10 +19,12 @@ import ( "github.com/Mag1cFall/AIStudio2API/internal/proxydial" fhttp "github.com/Mag1cFall/fhttp" "github.com/Mag1cFall/fhttp/http2" + fhttptrace "github.com/Mag1cFall/fhttp/httptrace" "github.com/bogdanfinn/tls-client/profiles" tls "github.com/bogdanfinn/utls" "github.com/bogdanfinn/utls/dicttls" "golang.org/x/net/proxy" + "golang.org/x/sync/singleflight" ) const ( @@ -226,6 +228,14 @@ type browserRoundTripper struct { mu sync.Mutex // preflights 按 preflightKey 记录 CORS 预检缓存 preflights map[string]preflightGrant + // gapiPreflights 仅对 gapiHosts 合并并发的 CORS 预检,使用独立超时上下文防取消传播 + gapiPreflights singleflight.Group +} + +// prewarmDual 同时在后台预拨目标主机的匿名连接(供 CORS OPTIONS)与凭据连接(供后续请求) +func (transport *browserRoundTripper) prewarmDual(address string) { + transport.pool.speculate(address, requestClass{anonymous: true}) + transport.pool.speculate(address, requestClass{anonymous: false}) } // preflightGrant 是一个 URL 的 CORS 预检缓存:预检响应允许的方法与请求头(小写)各自的到期时刻,与 Firefox nsPreflightCache 相同 @@ -402,9 +412,12 @@ func (pool *firefoxConnPool) get(ctx context.Context, address string) (*http2.Cl class := requestClassOf(ctx) key := poolKey(address, class) inverted := poolKey(address, requestClass{anonymous: !class.anonymous}) + host, _, _ := net.SplitHostPort(address) + reuseInflight := gapiHosts[host] pool.mu.Lock() conn := pool.availableLocked(key, inverted) - for conn == nil && len(pool.conns[key])+pool.dialing[key] >= firefoxMaxPersistentConns { + for conn == nil && (len(pool.conns[key])+pool.dialing[key] >= firefoxMaxPersistentConns || + reuseInflight && len(pool.conns[key]) == 0 && pool.dialing[key] > 0) { added := pool.added pool.mu.Unlock() select { @@ -638,12 +651,41 @@ func dialBrowserTLS(ctx context.Context, dialer proxy.ContextDialer, sessions *f return connection, nil } +type requestWroteHeadersKey struct{} +type beforeActualRequestKey struct{} + +// withRequestWroteHeaders 在主请求(不含 CORS 预检)的 HTTP/2 请求头写入连接后回调 onWrote +func withRequestWroteHeaders(ctx context.Context, onWrote func()) context.Context { + if onWrote == nil { + return ctx + } + return context.WithValue(ctx, requestWroteHeadersKey{}, onWrote) +} + +// withBeforeActualRequest 在主请求的 CORS 预检完成之后、发出主请求之前调用 wait +func withBeforeActualRequest(ctx context.Context, wait func(context.Context)) context.Context { + if wait == nil { + return ctx + } + return context.WithValue(ctx, beforeActualRequestKey{}, wait) +} + // RoundTrip 按缓存先发 CORS 预检再发送请求,context 标为匿名类别的请求经不带凭据的连接发送,请求在收到响应头前失败时清除它的预检缓存 func (transport *browserRoundTripper) RoundTrip(request *stdhttp.Request) (*stdhttp.Response, error) { err := transport.ensurePreflight(request) + if err == nil { + if wait, ok := request.Context().Value(beforeActualRequestKey{}).(func(context.Context)); ok { + wait(request.Context()) + err = request.Context().Err() + } + } var upstream *fhttp.Request if err == nil { - upstream, err = fhttp.NewRequestWithContext(request.Context(), request.Method, request.URL.String(), request.Body) + upstreamCtx := request.Context() + if onWrote, ok := upstreamCtx.Value(requestWroteHeadersKey{}).(func()); ok { + upstreamCtx = fhttptrace.WithClientTrace(upstreamCtx, &fhttptrace.ClientTrace{WroteHeaders: onWrote}) + } + upstream, err = fhttp.NewRequestWithContext(upstreamCtx, request.Method, request.URL.String(), request.Body) } if err != nil { if request.Body != nil { @@ -662,9 +704,11 @@ func (transport *browserRoundTripper) RoundTrip(request *stdhttp.Request) (*stdh upstream.Header[fhttp.HeaderOrderKey] = orderedHeaderNames(upstream.Header, request.URL.Host) response, err := transport.roundTrip(upstream, requestClassOf(request.Context()).anonymous) if err != nil { - transport.mu.Lock() - delete(transport.preflights, preflightKey(request)) - transport.mu.Unlock() + if !gapiHosts[request.URL.Hostname()] || request.Context().Err() == nil { + transport.mu.Lock() + delete(transport.preflights, preflightKey(request)) + transport.mu.Unlock() + } return nil, err } responseTrailer := standardHeader(response.Trailer) @@ -768,7 +812,6 @@ func (transport *browserRoundTripper) ensurePreflight(request *stdhttp.Request) if len(unsafe) == 0 && (request.Method == stdhttp.MethodGet || request.Method == stdhttp.MethodHead || request.Method == stdhttp.MethodPost) { return nil } - target := request.URL.String() class := requestClassOf(request.Context()) key := preflightKey(request) transport.mu.Lock() @@ -777,6 +820,32 @@ func (transport *browserRoundTripper) ensurePreflight(request *stdhttp.Request) if cached { return nil } + if !gapiHosts[request.URL.Hostname()] { + return transport.sendPreflight(request.Context(), request, key, class, unsafe) + } + flightKey := key + "|" + request.Method + "|" + strings.Join(unsafe, ",") + ch := transport.gapiPreflights.DoChan(flightKey, func() (any, error) { + transport.mu.Lock() + hit := transport.preflights[key].allows(request.Method, unsafe, time.Now()) + transport.mu.Unlock() + if hit { + return nil, nil + } + pfCtx, cancel := context.WithTimeout(context.WithoutCancel(request.Context()), 30*time.Second) + defer cancel() + return nil, transport.sendPreflight(pfCtx, request, key, class, unsafe) + }) + select { + case result := <-ch: + return result.Err + case <-request.Context().Done(): + return fmt.Errorf("CORS 预检: %w", request.Context().Err()) + } +} + +// sendPreflight 发出单次 CORS 预检请求并将允许的方法与请求头写入预检缓存 +func (transport *browserRoundTripper) sendPreflight(ctx context.Context, request *stdhttp.Request, key string, class requestClass, unsafe []string) error { + target := request.URL.String() if !class.anonymous { port := request.URL.Port() if port == "" { @@ -784,7 +853,7 @@ func (transport *browserRoundTripper) ensurePreflight(request *stdhttp.Request) } transport.pool.speculate(net.JoinHostPort(request.URL.Hostname(), port), class) } - preflight, err := fhttp.NewRequestWithContext(request.Context(), stdhttp.MethodOptions, target, nil) + preflight, err := fhttp.NewRequestWithContext(ctx, stdhttp.MethodOptions, target, nil) if err != nil { return err } diff --git a/internal/aistudio/transport_http.go b/internal/aistudio/transport_http.go index aaaa0ebb..3be83668 100644 --- a/internal/aistudio/transport_http.go +++ b/internal/aistudio/transport_http.go @@ -17,8 +17,6 @@ import ( "sync" "sync/atomic" "time" - - "golang.org/x/sync/singleflight" ) const publicDiscoveryUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:158.0) Gecko/20100101 Firefox/158.0" @@ -62,17 +60,49 @@ type MakerSuiteHTTPTransport struct { clientsMu sync.Mutex clients map[string]*http.Client accountClients map[string]accountHTTPClient - // driveMu 保护 driveDiscovered + // driveMu 保护 driveDiscovered 与 driveStarting driveMu sync.Mutex - // driveDiscovered 记录已按官网页面读取 Drive discovery 文档的账户 - driveDiscovered map[string]bool - // driveDiscovery 按账户合并同时进行的 Drive discovery 读取 - driveDiscovery singleflight.Group + // driveDiscovered 记录已按官网页面读取 Drive discovery 文档的账户指针,账户删除重导后自动失效 + driveDiscovered map[string]*Account + // driveStarting 记录正在后台发起 Drive discovery 的账户,通道在 GET discovery 写入网络后关闭 + driveStarting map[string]chan struct{} + // gapiFpMu 保护按账户缓存的 gapi 指纹字段(appVersion 与 platform) + gapiFpMu sync.Mutex + gapiFp map[string]cachedGapiFingerprint +} + +// gapiFingerprint 缓存从账户指纹文件读取的 X-ClientDetails 不变字段 +type gapiFingerprint struct { + appVersion string + platform string +} + +// cachedGapiFingerprint 绑定账户指针与路径/区域键缓存 gapi 指纹,删除重导同名账户时不带出旧指纹 +type cachedGapiFingerprint struct { + account *Account + key string + fp gapiFingerprint } type accountLeaseContextKey struct{} +type flightAccountContextKey struct{} type accountSelectionObserverContextKey struct{} +// contextWithFlightAccount 剥离单个请求的账户租约并注入共享内部调用使用的只读账户指针,避免取消方扣住并发槽位 +func contextWithFlightAccount(ctx context.Context, account *Account) context.Context { + stripped := contextWithoutAccountLease{Context: ctx} + if account == nil { + return stripped + } + return context.WithValue(stripped, flightAccountContextKey{}, account) +} + +// flightAccountFromContext 返回共享内部调用上下文中绑定的只读账户指针 +func flightAccountFromContext(ctx context.Context) (*Account, bool) { + account, ok := ctx.Value(flightAccountContextKey{}).(*Account) + return account, ok +} + // residentCatalogContextKey 是 context 中要求账户目录读取在常驻 Worker 的页面上进行的键 type residentCatalogContextKey struct{} @@ -122,7 +152,9 @@ func NewMakerSuiteHTTPTransport(options HTTPTransportOptions) (*MakerSuiteHTTPTr now: time.Now, clients: make(map[string]*http.Client), accountClients: make(map[string]accountHTTPClient), - driveDiscovered: make(map[string]bool), + driveDiscovered: make(map[string]*Account), + driveStarting: make(map[string]chan struct{}), + gapiFp: make(map[string]cachedGapiFingerprint), } if err := transport.SetGlobalProxy(options.GlobalProxy); err != nil { return nil, err @@ -316,9 +348,18 @@ func (t *MakerSuiteHTTPTransport) UploadAssistantFile(ctx context.Context, accou // Do 发送普通 MakerSuite RPC 并让响应 body 持有租约,账户有 WAA Worker 时 pageIssuedRPCs 中的方法与 issuedByPage 上下文中的请求由页面发出 func (t *MakerSuiteHTTPTransport) Do(ctx context.Context, rpc RPCRequest) (*RPCResponse, error) { - lease, owned, err := resolveAccountLease(ctx, t.pool, AccountSelection{AccountID: rpc.AccountID}) - if err != nil { - return nil, err + var lease *AccountLease + var owned bool + var account *Account + if flightAccount, ok := flightAccountFromContext(ctx); ok && flightAccount.ID == rpc.AccountID && t.pool.isCurrentAccount(flightAccount) { + account = flightAccount + } else { + var err error + lease, owned, err = resolveAccountLease(ctx, t.pool, AccountSelection{AccountID: rpc.AccountID}) + if err != nil { + return nil, err + } + account = lease.Account() } releaseOnError := func(requestErr error) error { if !owned { @@ -326,7 +367,6 @@ func (t *MakerSuiteHTTPTransport) Do(ctx context.Context, rpc RPCRequest) (*RPCR } return errors.Join(requestErr, lease.Release()) } - account := lease.Account() finish := func() error { if owned { return lease.Release() @@ -341,7 +381,13 @@ func (t *MakerSuiteHTTPTransport) Do(ctx context.Context, rpc RPCRequest) (*RPCR response.Body = &leaseResponseBody{body: response.Body, finish: finish} return response, nil } - _, headers, err := prepareProtocolHeaders(ctx, lease, rpc, t.signer, t.headers, t.now(), true) + var headers http.Header + var err error + if lease != nil { + _, headers, err = prepareProtocolHeaders(ctx, lease, rpc, t.signer, t.headers, t.now(), true) + } else { + _, headers, err = prepareProtocolHeadersForAccount(ctx, t.pool, account, rpc, t.signer, t.headers, t.now(), true) + } if err != nil { return nil, releaseOnError(err) } @@ -359,9 +405,15 @@ func (t *MakerSuiteHTTPTransport) Do(ctx context.Context, rpc RPCRequest) (*RPCR return nil, releaseOnError(fmt.Errorf("执行 MakerSuite %s 请求: %w", rpc.Method, err)) } if setCookies := response.Header.Values("Set-Cookie"); len(setCookies) > 0 { - if err := lease.MergeSetCookieHeaders(setCookies, rpc.URL, t.now()); err != nil { + var mergeErr error + if lease != nil { + mergeErr = lease.MergeSetCookieHeaders(setCookies, rpc.URL, t.now()) + } else { + mergeErr = t.pool.mergeSetCookieHeaders(account, setCookies, rpc.URL, t.now()) + } + if mergeErr != nil { _ = response.Body.Close() - return nil, releaseOnError(fmt.Errorf("合并 MakerSuite %s 响应 Cookie: %w", rpc.Method, err)) + return nil, releaseOnError(fmt.Errorf("合并 MakerSuite %s 响应 Cookie: %w", rpc.Method, mergeErr)) } } body := &leaseResponseBody{body: response.Body, finish: finish} @@ -426,11 +478,52 @@ func (t *MakerSuiteHTTPTransport) clientForAccount(account *Account) (*http.Clie t.accountClients[account.ID] = accountHTTPClient{proxyURL: proxyURL, client: client} t.clientsMu.Unlock() if previous != nil { + t.driveMu.Lock() + delete(t.driveDiscovered, account.ID) + t.driveMu.Unlock() previous.CloseIdleConnections() } return client, nil } +// InvalidateAccountDrive 清除指定账户缓存的 Drive discovery 标记与 gapi 指纹字段 +func (t *MakerSuiteHTTPTransport) InvalidateAccountDrive(accountID string) { + t.driveMu.Lock() + delete(t.driveDiscovered, accountID) + t.driveMu.Unlock() + t.gapiFpMu.Lock() + delete(t.gapiFp, accountID) + t.gapiFpMu.Unlock() +} + +// PrewarmDriveUpload 在后台同时预拨 content.googleapis.com 与 clients6.google.com 的匿名连接(供预检)与凭据连接(供上传与 discovery),隐藏首次冷上传的 TLS 握手耗时 +func (t *MakerSuiteHTTPTransport) PrewarmDriveUpload(ctx context.Context, accountID string) { + var account *Account + if lease, ok := AccountLeaseFromContext(ctx); ok && lease.Account() != nil && lease.Account().ID == accountID { + account = lease.Account() + } else if flightAccount, ok := flightAccountFromContext(ctx); ok && flightAccount.ID == accountID { + account = flightAccount + } else { + account, _ = t.pool.Account(accountID) + } + if account == nil { + return + } + client, err := t.clientForAccount(account) + if err != nil { + return + } + if rt, ok := client.Transport.(*browserRoundTripper); ok { + rt.prewarmDual("content.googleapis.com:443") + t.driveMu.Lock() + discovered := t.driveDiscovered[account.ID] == account + t.driveMu.Unlock() + if !discovered { + rt.prewarmDual("clients6.google.com:443") + } + } +} + // clientForProxy 返回按代理共用的无凭据客户端,供不带账户 Cookie 与授权头的公开静态资源请求使用 func (t *MakerSuiteHTTPTransport) clientForProxy(proxyURL string) (*http.Client, error) { t.clientsMu.Lock() @@ -459,7 +552,36 @@ func prepareProtocolHeaders( if err != nil { return StorageState{}, nil, fmt.Errorf("读取账户 storage state: %w", err) } - account := lease.Account() + return buildProtocolHeaders(ctx, lease.Account(), state, rpc, signer, provider, now, includeCookie) +} + +func prepareProtocolHeadersForAccount( + ctx context.Context, + pool *AccountPool, + account *Account, + rpc RPCRequest, + signer *Signer, + provider ProtocolHeaderProvider, + now time.Time, + includeCookie bool, +) (StorageState, http.Header, error) { + state, err := pool.reloadStorageState(account) + if err != nil { + return StorageState{}, nil, fmt.Errorf("读取账户 storage state: %w", err) + } + return buildProtocolHeaders(ctx, account, state, rpc, signer, provider, now, includeCookie) +} + +func buildProtocolHeaders( + ctx context.Context, + account *Account, + state StorageState, + rpc RPCRequest, + signer *Signer, + provider ProtocolHeaderProvider, + now time.Time, + includeCookie bool, +) (StorageState, http.Header, error) { publicHeaders, err := provider.ProtocolHeaders(ctx, account.ID) if err != nil { return StorageState{}, nil, fmt.Errorf("读取账户动态公共头: %w", err) diff --git a/internal/aistudio/upload.go b/internal/aistudio/upload.go index 902c1d4c..d3f4d8c1 100644 --- a/internal/aistudio/upload.go +++ b/internal/aistudio/upload.go @@ -14,6 +14,7 @@ import ( "log/slog" "mime" "net/http" + "net/http/httptrace" "net/url" "slices" "sort" @@ -234,15 +235,40 @@ func (copies *TemporaryFileCopies) cleanup(parent context.Context) error { if copies.release != nil { copies.release() } + var lazyToken string + var lazyTokenErr error + if slices.ContainsFunc(copies.copies, func(copy temporaryDriveCopy) bool { return copy.token == "" }) { + account, authGen := copies.lease.Account(), copies.lease.AuthGeneration() + lazyToken = copies.client.cachedDriveTokenFor(account.ID, account, authGen) + if lazyToken == "" { + var at time.Time + if lazyToken, at = pageCachedDriveToken(account.ID); lazyToken != "" { + copies.client.storeDriveTokenFor(account.ID, account, authGen, lazyToken, at) + } + } + if lazyToken == "" { + tokenCtx, cancel := context.WithTimeout(ContextWithAccountLease(parent, copies.lease), driveCleanupTimeout) + lazyToken, lazyTokenErr = copies.client.fetchDriveTokenFor(tokenCtx, account.ID, account, authGen) + cancel() + } + } errs := make([]error, len(copies.copies)) var group sync.WaitGroup for index, copy := range copies.copies { + token := copy.token + if token == "" { + if lazyTokenErr != nil { + errs[index] = lazyTokenErr + continue + } + token = lazyToken + } group.Go(func() { cleanupCtx, cancel := context.WithTimeout(parent, driveCleanupTimeout) defer cancel() cleanupCtx = ContextWithAccountLease(cleanupCtx, copies.lease) deleteErr := copies.client.deleteDriveFile( - cleanupCtx, copies.lease.Account().ID, copy.token, copy.id, + cleanupCtx, copies.lease.Account().ID, token, copy.id, ) if driveFileNotFound(deleteErr, "DriveDelete") { deleteErr = nil @@ -347,6 +373,294 @@ type DriveFileChecker interface { DriveFileExists(context.Context, string, string, string) (bool, error) } +// driveUploadPrewarmer 在查令牌与文件夹的同时预拨 Drive 上传主机与 discovery 主机连接 +type driveUploadPrewarmer interface { + PrewarmDriveUpload(context.Context, string) +} + +// driveDiscoveryStarter 在后台启动账户首次 Drive discovery +type driveDiscoveryStarter interface { + StartDriveDiscoveryAsync(context.Context, *Account) +} + +// prewarmDriveUpload 预拨账户 Drive 上传主机与 discovery 主机的连接,传输层不支持时不做 +func (c *Client) prewarmDriveUpload(ctx context.Context, accountID string) { + if prewarmer, ok := c.transport.(driveUploadPrewarmer); ok { + prewarmer.PrewarmDriveUpload(ctx, accountID) + } else if prewarmer, ok := c.static.(driveUploadPrewarmer); ok { + prewarmer.PrewarmDriveUpload(ctx, accountID) + } +} + +// startDriveDiscoveryAsync 在后台启动账户首次 Drive discovery,传输层不支持时不做 +func (c *Client) startDriveDiscoveryAsync(ctx context.Context, account *Account) { + if starter, ok := c.transport.(driveDiscoveryStarter); ok { + starter.StartDriveDiscoveryAsync(ctx, account) + } else if starter, ok := c.static.(driveDiscoveryStarter); ok { + starter.StartDriveDiscoveryAsync(ctx, account) + } +} + +// InlineMediaTiming 记录一次内联附件处理的分项耗时与命中数量 +type InlineMediaTiming struct { + TokenFolder time.Duration + Upload time.Duration + Reused int + Uploaded int +} + +type inlineMediaTimingKey struct{} + +// ContextWithInlineMediaTiming 返回注入内联附件分项耗时记录器的上下文 +func ContextWithInlineMediaTiming(ctx context.Context, timing *InlineMediaTiming) context.Context { + return context.WithValue(ctx, inlineMediaTimingKey{}, timing) +} + +// inlineMediaTimingFrom 返回 ctx 中的内联附件分项耗时记录器,没有时为 nil +func inlineMediaTimingFrom(ctx context.Context) *InlineMediaTiming { + timing, _ := ctx.Value(inlineMediaTimingKey{}).(*InlineMediaTiming) + return timing +} + +// driveLookupFlightTimeout 是账户级令牌或应用文件夹共享查询与后台 discovery 的上限 +const driveLookupFlightTimeout = 30 * time.Second + +// driveCacheMatchesAccount 判断缓存项属于 account 的认证代次 authGen,account 为 nil 时不比较 +func driveCacheMatchesAccount(entry cachedDriveValue, account *Account, authGen uint64) bool { + if account == nil { + return true + } + return entry.account == account && entry.authGen == authGen +} + +// cachedDriveTokenFor 按账户指针与认证代次返回账户级缓存中仍在有效期的 Drive access token +func (c *Client) cachedDriveTokenFor(accountID string, account *Account, authGen uint64) string { + c.driveCacheMu.Lock() + defer c.driveCacheMu.Unlock() + entry, ok := c.driveTokens[accountID] + if !ok || entry.value == "" || !driveCacheMatchesAccount(entry, account, authGen) || time.Since(entry.at) > pageTokenLifetime { + return "" + } + return entry.value +} + +// storeDriveTokenFor 按账户指针与认证代次写入 Drive access token 缓存,at 为零值时按当前时刻记,同一账户已有更新代次的项时不覆盖 +func (c *Client) storeDriveTokenFor(accountID string, account *Account, authGen uint64, token string, at time.Time) { + if token == "" { + return + } + if at.IsZero() { + at = time.Now() + } + entry := cachedDriveValue{value: token, account: account, authGen: authGen, at: at} + c.driveCacheMu.Lock() + if c.driveTokens == nil { + c.driveTokens = make(map[string]cachedDriveValue) + } + if prev, ok := c.driveTokens[accountID]; ok && account != nil && prev.account == account && prev.authGen > authGen { + c.driveCacheMu.Unlock() + return + } + c.driveTokens[accountID] = entry + c.driveCacheMu.Unlock() +} + +// invalidateDriveToken 在账户缓存中的 token 等于 oldToken 时删除它,oldToken 为空时无条件删除 +func (c *Client) invalidateDriveToken(accountID, oldToken string) { + c.driveCacheMu.Lock() + if entry, ok := c.driveTokens[accountID]; ok && (oldToken == "" || entry.value == oldToken) { + delete(c.driveTokens, accountID) + } + c.driveCacheMu.Unlock() +} + +// doDriveStringFlight 合并同账户并发的 Drive 令牌或应用文件夹查询,run 不持有任何请求的租约,全部等待方取消时中止 +func (c *Client) doDriveStringFlight( + ctx context.Context, + table *map[string]*driveStringFlight, + accountID string, + account *Account, + run func(context.Context) (string, error), +) (string, error) { + c.driveCacheMu.Lock() + if *table == nil { + *table = make(map[string]*driveStringFlight) + } + flight := (*table)[accountID] + if flight != nil { + flight.waiters++ + c.driveCacheMu.Unlock() + } else { + baseCtx := context.WithoutCancel(ctx) + if account != nil { + baseCtx = contextWithFlightAccount(baseCtx, account) + } + flightCtx, cancel := context.WithTimeout(baseCtx, driveLookupFlightTimeout) + flight = &driveStringFlight{waiters: 1, cancel: cancel, done: make(chan struct{})} + (*table)[accountID] = flight + c.driveCacheMu.Unlock() + go func() { + defer func() { + cancel() + c.driveCacheMu.Lock() + if (*table)[accountID] == flight { + delete(*table, accountID) + } + c.driveCacheMu.Unlock() + close(flight.done) + }() + flight.value, flight.err = run(flightCtx) + }() + } + select { + case <-flight.done: + return flight.value, flight.err + case <-ctx.Done(): + c.driveCacheMu.Lock() + flight.waiters-- + stop := flight.waiters == 0 + if stop && (*table)[accountID] == flight { + delete(*table, accountID) + } + c.driveCacheMu.Unlock() + if stop { + flight.cancel() + } + return "", ctx.Err() + } +} + +// fetchDriveTokenFor 按账户指针与认证代次读取或申请账户 Drive access token 并写入缓存 +func (c *Client) fetchDriveTokenFor(ctx context.Context, accountID string, account *Account, authGen uint64) (string, error) { + if cached := c.cachedDriveTokenFor(accountID, account, authGen); cached != "" { + return cached, nil + } + return c.doDriveStringFlight(ctx, &c.driveTokenFlights, accountID, account, func(fetchCtx context.Context) (string, error) { + if cached := c.cachedDriveTokenFor(accountID, account, authGen); cached != "" { + return cached, nil + } + token, err := c.GenerateAccessToken(fetchCtx, accountID) + if err != nil { + return "", err + } + c.storeDriveTokenFor(accountID, account, authGen, token, time.Now()) + return token, nil + }) +} + +// cachedAppFolderFor 按账户指针与认证代次返回账户级缓存中的应用文件夹 ID +func (c *Client) cachedAppFolderFor(accountID string, account *Account, authGen uint64) string { + c.driveCacheMu.Lock() + defer c.driveCacheMu.Unlock() + entry, ok := c.appFolders[accountID] + if !ok || entry.value == "" || !driveCacheMatchesAccount(entry, account, authGen) { + return "" + } + return entry.value +} + +// storeAppFolderFor 按账户指针与认证代次写入应用文件夹 ID 缓存,同一账户已有更新代次的项时不覆盖 +func (c *Client) storeAppFolderFor(accountID string, account *Account, authGen uint64, folder string) { + if folder == "" { + return + } + entry := cachedDriveValue{value: folder, account: account, authGen: authGen, at: time.Now()} + c.driveCacheMu.Lock() + if c.appFolders == nil { + c.appFolders = make(map[string]cachedDriveValue) + } + if prev, ok := c.appFolders[accountID]; ok && account != nil && prev.account == account && prev.authGen > authGen { + c.driveCacheMu.Unlock() + return + } + c.appFolders[accountID] = entry + c.driveCacheMu.Unlock() +} + +// invalidateAppFolder 在账户缓存中的应用文件夹等于 oldFolder 时删除它,oldFolder 为空时无条件删除 +func (c *Client) invalidateAppFolder(accountID, oldFolder string) { + c.driveCacheMu.Lock() + if entry, ok := c.appFolders[accountID]; ok && (oldFolder == "" || entry.value == oldFolder) { + delete(c.appFolders, accountID) + } + c.driveCacheMu.Unlock() +} + +// fetchAppFolderFor 按账户指针与认证代次读取或申请账户应用文件夹 ID,onSent 在 GetAppFolder 发出后回调 +func (c *Client) fetchAppFolderFor(ctx context.Context, accountID string, account *Account, authGen uint64, onSent func()) (string, error) { + if cached := c.cachedAppFolderFor(accountID, account, authGen); cached != "" { + return cached, nil + } + return c.doDriveStringFlight(ctx, &c.appFolderFlights, accountID, account, func(fetchCtx context.Context) (string, error) { + if cached := c.cachedAppFolderFor(accountID, account, authGen); cached != "" { + return cached, nil + } + if onSent != nil { + var once sync.Once + fire := func() { once.Do(onSent) } + fetchCtx = withRequestWroteHeaders(fetchCtx, fire) + defer fire() + } + folder, err := c.appFolder(fetchCtx, accountID) + if err != nil { + return "", err + } + c.storeAppFolderFor(accountID, account, authGen, folder) + return folder, nil + }) +} + +// doInlineUpload 合并同账户同一个待上传内联附件的并发上传,run 不持有任何请求的租约,全部等待方取消时中止 +func (c *Client) doInlineUpload(ctx context.Context, accountID string, account *Account, key inlineMediaKey, run func(context.Context) (FileRef, error)) (FileRef, error) { + flightKey := inlineUploadFlightKey{accountID: accountID, key: key} + c.inlineUploadMu.Lock() + if c.inlineUploads == nil { + c.inlineUploads = make(map[inlineUploadFlightKey]*inlineUploadFlight) + } + flight := c.inlineUploads[flightKey] + if flight != nil { + flight.waiters++ + c.inlineUploadMu.Unlock() + } else { + baseCtx := context.WithoutCancel(ctx) + if account != nil { + baseCtx = contextWithFlightAccount(baseCtx, account) + } + flightCtx, cancel := context.WithCancel(baseCtx) + flight = &inlineUploadFlight{waiters: 1, cancel: cancel, done: make(chan struct{})} + c.inlineUploads[flightKey] = flight + c.inlineUploadMu.Unlock() + go func() { + defer func() { + cancel() + c.inlineUploadMu.Lock() + if c.inlineUploads[flightKey] == flight { + delete(c.inlineUploads, flightKey) + } + c.inlineUploadMu.Unlock() + close(flight.done) + }() + flight.file, flight.err = run(flightCtx) + }() + } + select { + case <-flight.done: + return flight.file, flight.err + case <-ctx.Done(): + c.inlineUploadMu.Lock() + flight.waiters-- + stop := flight.waiters == 0 + if stop && c.inlineUploads[flightKey] == flight { + delete(c.inlineUploads, flightKey) + } + c.inlineUploadMu.Unlock() + if stop { + flight.cancel() + } + return FileRef{}, ctx.Err() + } +} + // GenerateAccessToken 获取网页账户授权的短期 bearer token func (c *Client) GenerateAccessToken(ctx context.Context, accountID string) (string, error) { response, err := c.do(ctx, "GenerateAccessToken", accountID, "", []byte(`["users/me"]`), false) @@ -744,7 +1058,18 @@ func driveStorageQuotaExceeded(err error) bool { rpcError.StatusCode == http.StatusForbidden && strings.Contains(rpcError.Message, `"storageQuotaExceeded"`) } +// pageCachedDriveToken 读取账户当前常驻 WAA 页面中仍在有效期的 Drive access token +func pageCachedDriveToken(accountID string) (string, time.Time) { + if worker := pageWorker(accountID); worker != nil { + if page, ok := worker.current().(*goWAARuntime); ok { + return page.pageTokenEntry() + } + } + return "", time.Time{} +} + // CopyFileReferencesToLease 将文件引用复制到目标账户并返回改写内容 +// 每个来源账户只取一次租约,不同文件最多 inlineMediaUploadConcurrency 个同时复制 func (s *PooledService) CopyFileReferencesToLease( ctx context.Context, target *AccountLease, @@ -754,15 +1079,31 @@ func (s *PooledService) CopyFileReferencesToLease( copies := &TemporaryFileCopies{ client: s.client, lease: target, sources: make(map[string]struct{}), } - relocated := make(map[string]FileRef) targetID := target.Account().ID + type partIndex struct { + content int + part int + } + type copyJob struct { + fileID string + owner string + metadata FileMetadata + parts []partIndex + } + jobIndex := make(map[string]int) + ownerFirstFile := make(map[string]string) + jobs := make([]copyJob, 0) for contentIndex := range rewritten { - for partIndex := range rewritten[contentIndex].Parts { - part := &rewritten[contentIndex].Parts[partIndex] + for partIndexVal := range rewritten[contentIndex].Parts { + part := &rewritten[contentIndex].Parts[partIndexVal] if part.File == nil { continue } fileID := strings.TrimSpace(part.File.ID) + if existing, ok := jobIndex[fileID]; ok { + jobs[existing].parts = append(jobs[existing].parts, partIndex{content: contentIndex, part: partIndexVal}) + continue + } owner, metadata, err := s.pool.fileReferenceMetadata(ctx, fileID, targetID) if err != nil { return nil, nil, errors.Join(err, copies.Cleanup()) @@ -771,60 +1112,424 @@ func (s *PooledService) CopyFileReferencesToLease( continue } copies.sources[owner] = struct{}{} - if relocatedFile, exists := relocated[fileID]; exists { - part.File = &relocatedFile - continue + if _, ok := ownerFirstFile[owner]; !ok { + ownerFirstFile[owner] = fileID + } + jobIndex[fileID] = len(jobs) + jobs = append(jobs, copyJob{ + fileID: fileID, + owner: owner, + metadata: metadata, + parts: []partIndex{{content: contentIndex, part: partIndexVal}}, + }) + } + } + if len(jobs) == 0 { + return rewritten, copies, nil + } + + sourceOwners := make([]string, 0, len(copies.sources)) + for owner := range copies.sources { + sourceOwners = append(sourceOwners, owner) + } + sort.Strings(sourceOwners) + type sourceState struct { + lease *AccountLease + account *Account + authGen uint64 + tokenMu sync.Mutex + token string + tokenFromCache bool + authFailed bool + succeeded bool + } + sources := make(map[string]*sourceState, len(sourceOwners)) + releaseSources := func() error { + var releaseErr error + for _, owner := range sourceOwners { + if st := sources[owner]; st != nil && st.lease != nil { + releaseErr = errors.Join(releaseErr, st.lease.Release()) + st.lease = nil + } + } + return releaseErr + } + sourceBaseCtx := contextWithoutAccountLease{Context: ctx} + for _, owner := range sourceOwners { + lease, err := s.pool.AcquireFor(sourceBaseCtx, AccountSelection{ResourceID: ownerFirstFile[owner]}) + if err != nil { + return nil, nil, errors.Join(err, releaseSources(), copies.Cleanup()) + } + sources[owner] = &sourceState{ + lease: lease, + account: lease.Account(), + authGen: lease.AuthGeneration(), + } + } + + targetCtx := ContextWithAccountLease(ctx, target) + targetAccount := target.Account() + targetAuthGen := target.AuthGeneration() + s.client.prewarmDriveUpload(targetCtx, targetID) + startDiscovery := func() { s.client.startDriveDiscoveryAsync(targetCtx, targetAccount) } + + targetToken := s.client.cachedDriveTokenFor(targetID, targetAccount, targetAuthGen) + if targetToken == "" { + if tok, at := pageCachedDriveToken(targetID); tok != "" { + s.client.storeDriveTokenFor(targetID, targetAccount, targetAuthGen, tok, at) + targetToken = tok + } + } + targetTokenFromCache := targetToken != "" + targetFolder := s.client.cachedAppFolderFor(targetID, targetAccount, targetAuthGen) + targetFolderFromCache := targetFolder != "" + if targetFolderFromCache { + startDiscovery() + } + + lookupCtx, cancelLookup := context.WithCancel(ctx) + var lookupErrMu sync.Mutex + var targetLookupErr error + var sourceLookupErr error + var lookupWG sync.WaitGroup + if targetToken == "" { + lookupWG.Go(func() { + tok, err := s.client.fetchDriveTokenFor(ContextWithAccountLease(lookupCtx, target), targetID, targetAccount, targetAuthGen) + if err != nil { + lookupErrMu.Lock() + if targetLookupErr == nil { + targetLookupErr = err + } + lookupErrMu.Unlock() + cancelLookup() + return } - media, err := s.DownloadFile(contextWithoutAccountLease{Context: ctx}, fileID) + targetToken = tok + }) + } + if targetFolder == "" { + lookupWG.Go(func() { + folder, err := s.client.fetchAppFolderFor(ContextWithAccountLease(lookupCtx, target), targetID, targetAccount, targetAuthGen, startDiscovery) if err != nil { - return nil, nil, errors.Join(err, copies.Cleanup()) + lookupErrMu.Lock() + if targetLookupErr == nil { + targetLookupErr = err + } + lookupErrMu.Unlock() + cancelLookup() + return + } + targetFolder = folder + if worker := pageWorker(targetID); worker != nil { + if cur, ok := worker.current().(*goWAARuntime); ok { + cur.appFolderCalled.Store(true) + } + } + }) + } + for _, owner := range sourceOwners { + st := sources[owner] + tok := s.client.cachedDriveTokenFor(owner, st.account, st.authGen) + if tok == "" { + if pageTok, at := pageCachedDriveToken(owner); pageTok != "" { + s.client.storeDriveTokenFor(owner, st.account, st.authGen, pageTok, at) + tok = pageTok + } + } + if tok != "" { + st.token = tok + st.tokenFromCache = true + continue + } + lookupWG.Go(func() { + srcCtx := ContextWithAccountLease(lookupCtx, st.lease) + fetched, err := s.client.fetchDriveTokenFor(srcCtx, owner, st.account, st.authGen) + if err != nil { + if DefinitiveAuthenticationFailure(err) { + s.client.InvalidateDriveCache(owner) + err = errors.Join(err, st.lease.ConfirmAuthenticationFailure(ctx, err)) + } + lookupErrMu.Lock() + if sourceLookupErr == nil { + sourceLookupErr = err + } + lookupErrMu.Unlock() + cancelLookup() + return + } + st.token = fetched + }) + } + lookupWG.Wait() + cancelLookup() + + if sourceLookupErr != nil && errors.Is(targetLookupErr, context.Canceled) && ctx.Err() == nil { + targetLookupErr = nil + } + if targetLookupErr != nil { + if DefinitiveAuthenticationFailure(targetLookupErr) { + s.client.InvalidateDriveCache(targetID) + targetLookupErr = errors.Join(targetLookupErr, target.ConfirmAuthenticationFailure(targetCtx, targetLookupErr)) + } + return nil, nil, errors.Join(targetLookupErr, releaseSources(), copies.Cleanup()) + } + if sourceLookupErr != nil { + return nil, nil, errors.Join(sourceLookupErr, releaseSources(), copies.Cleanup()) + } + + var targetMu sync.Mutex + currentTargetToken := targetToken + currentTargetFolder := targetFolder + drive := s.client.transport.(DriveTransport) + + type copyResult struct { + index int + file FileRef + token string + err error + targetOp bool + } + copyCtx, cancelCopies := context.WithCancel(ctx) + results := make([]copyResult, len(jobs)) + resultCh := make(chan copyResult, len(jobs)) + sem := make(chan struct{}, min(len(jobs), inlineMediaUploadConcurrency)) + + openSource := func(opCtx context.Context, st *sourceState, fileID string) (MediaStream, error) { + st.tokenMu.Lock() + tok := st.token + fromCache := st.tokenFromCache + st.tokenMu.Unlock() + if fresh := s.client.cachedDriveTokenFor(st.account.ID, st.account, st.authGen); fresh != "" { + tok = fresh + } + srcCtx := ContextWithAccountLease(opCtx, st.lease) + media, err := drive.DownloadDrive(srcCtx, st.account.ID, tok, fileID) + if err != nil && fromCache { + var rpcErr *RPCError + if errors.As(err, &rpcErr) && rpcErr.Method == "DriveDownload" && rpcErr.StatusCode == http.StatusUnauthorized { + s.client.invalidateDriveToken(st.account.ID, tok) + refreshed, refreshErr := s.client.fetchDriveTokenFor(srcCtx, st.account.ID, st.account, st.authGen) + if refreshErr != nil { + err = refreshErr + } else if refreshed != "" { + st.tokenMu.Lock() + st.token = refreshed + st.tokenMu.Unlock() + media, err = drive.DownloadDrive(srcCtx, st.account.ID, refreshed, fileID) + } + } + } + if err != nil { + if driveFileNotFound(err, "DriveDownload") { + unbindErr := s.pool.unbindResourceContext(ctx, fileID) + if errors.Is(unbindErr, ErrResourceNotFound) { + unbindErr = nil + } + return MediaStream{}, errors.Join(&fileReferenceNotFoundError{fileID: fileID}, unbindErr) + } + if DefinitiveAuthenticationFailure(err) { + s.client.InvalidateDriveCache(st.account.ID) + st.tokenMu.Lock() + already := st.authFailed + st.authFailed = true + st.tokenMu.Unlock() + if !already { + err = errors.Join(err, st.lease.ConfirmAuthenticationFailure(ctx, err)) + } } - targetCtx := ContextWithAccountLease(ctx, target) - copy, token, uploadErr := s.client.uploadFile(targetCtx, UploadRequest{ + return MediaStream{}, err + } + st.tokenMu.Lock() + st.succeeded = true + st.tokenMu.Unlock() + return media, nil + } + + for index, job := range jobs { + go func(index int, job copyJob) { + select { + case sem <- struct{}{}: + case <-copyCtx.Done(): + resultCh <- copyResult{index: index, err: copyCtx.Err()} + return + } + defer func() { <-sem }() + st := sources[job.owner] + media, err := openSource(copyCtx, st, job.fileID) + if err != nil { + resultCh <- copyResult{index: index, err: err} + return + } + targetOpCtx := ContextWithAccountLease(copyCtx, target) + targetMu.Lock() + useToken, useFolder := currentTargetToken, currentTargetFolder + targetMu.Unlock() + if fresh := s.client.cachedDriveTokenFor(targetID, targetAccount, targetAuthGen); fresh != "" { + useToken = fresh + } + if fresh := s.client.cachedAppFolderFor(targetID, targetAccount, targetAuthGen); fresh != "" { + useFolder = fresh + } + req := UploadRequest{ AccountID: targetID, - Name: metadata.Name, - MIME: metadata.MIME, - Size: metadata.Size, + Name: job.metadata.Name, + MIME: job.metadata.MIME, + Size: job.metadata.Size, Reader: media.Body, - }) - closeErr := media.Body.Close() - if copy.ID != "" { - copies.copies = append(copies.copies, temporaryDriveCopy{id: copy.ID, token: token}) + Folder: useFolder, } - if uploadErr == nil && closeErr == nil { - createdAt := time.Now().UTC() - uploadErr = target.BindFileResource(targetCtx, copy, FileMetadata{ - Size: metadata.Size, Purpose: metadata.Purpose, CreatedAt: createdAt, ExpiresAt: createdAt.Add(temporaryFileRetention), - }) - if uploadErr == nil { - copies.copies[len(copies.copies)-1].bound = true + copied, uploadErr := drive.UploadDrive(targetOpCtx, targetID, useToken, req) + closeErr := media.Body.Close() + usedToken := useToken + if uploadErr != nil { + switch driveUploadHTTPStatus(uploadErr) { + case http.StatusUnauthorized: + if targetTokenFromCache { + s.client.invalidateDriveToken(targetID, useToken) + refreshed, refreshErr := s.client.fetchDriveTokenFor(targetOpCtx, targetID, targetAccount, targetAuthGen) + if refreshErr != nil { + uploadErr = refreshErr + } else if refreshed != "" { + targetMu.Lock() + currentTargetToken = refreshed + useFolder = currentTargetFolder + targetMu.Unlock() + if freshFolder := s.client.cachedAppFolderFor(targetID, targetAccount, targetAuthGen); freshFolder != "" { + useFolder = freshFolder + } + retryMedia, retryErr := openSource(copyCtx, st, job.fileID) + if retryErr != nil { + resultCh <- copyResult{index: index, err: retryErr} + return + } + req.Reader = retryMedia.Body + req.Folder = useFolder + usedToken = refreshed + copied, uploadErr = drive.UploadDrive(targetOpCtx, targetID, refreshed, req) + closeErr = retryMedia.Body.Close() + } + } + case http.StatusNotFound: + if targetFolderFromCache { + s.client.invalidateAppFolder(targetID, useFolder) + refreshed, refreshErr := s.client.fetchAppFolderFor(targetOpCtx, targetID, targetAccount, targetAuthGen, nil) + if refreshErr != nil { + uploadErr = refreshErr + } else if refreshed != "" { + targetMu.Lock() + currentTargetFolder = refreshed + useToken = currentTargetToken + targetMu.Unlock() + if freshToken := s.client.cachedDriveTokenFor(targetID, targetAccount, targetAuthGen); freshToken != "" { + useToken = freshToken + } + retryMedia, retryErr := openSource(copyCtx, st, job.fileID) + if retryErr != nil { + resultCh <- copyResult{index: index, err: retryErr} + return + } + req.Reader = retryMedia.Body + req.Folder = refreshed + usedToken = useToken + copied, uploadErr = drive.UploadDrive(targetOpCtx, targetID, useToken, req) + closeErr = retryMedia.Body.Close() + } + } } } - if uploadErr != nil || closeErr != nil { - if DefinitiveAuthenticationFailure(uploadErr) { - uploadErr = errors.Join(uploadErr, target.ConfirmAuthenticationFailure(targetCtx, uploadErr)) - } - return nil, nil, errors.Join(uploadErr, closeErr, copies.Cleanup()) + resultCh <- copyResult{index: index, file: copied, token: usedToken, err: errors.Join(uploadErr, closeErr), targetOp: true} + }(index, job) + } + cause := -1 + for range jobs { + res := <-resultCh + results[res.index] = res + if res.err != nil { + if cause < 0 { + cause = res.index } - if stateErr := errors.Join( - target.MarkAuthenticationValid(), - s.pool.ClearCooldownIfGeneration( - targetID, "", target.ModelAccessGeneration(), target.CheckedAt(), - ), - ); stateErr != nil { - return nil, nil, errors.Join(stateErr, copies.Cleanup()) + cancelCopies() + } + } + cancelCopies() + + var sourceStateErr error + for _, owner := range sourceOwners { + st := sources[owner] + if st.succeeded && !st.authFailed { + sourceStateErr = errors.Join( + sourceStateErr, + st.lease.MarkAuthenticationValid(), + s.pool.ClearCooldownIfGeneration(owner, "", st.lease.ModelAccessGeneration(), st.lease.CheckedAt()), + ) + } + } + sourceStateErr = errors.Join(sourceStateErr, releaseSources()) + + var firstErr error + var firstTargetErr error + for index, res := range results { + copyIdx := -1 + if res.file.ID != "" { + copyIdx = len(copies.copies) + copies.copies = append(copies.copies, temporaryDriveCopy{id: res.file.ID, token: res.token}) + } + if res.err != nil { + if firstErr == nil { + firstErr = res.err } - relocatedFile := FileRef{ID: copy.ID, Name: part.File.Name, MIME: part.File.MIME} + if res.targetOp && firstTargetErr == nil { + firstTargetErr = res.err + } + continue + } + if firstErr != nil { + continue + } + job := jobs[index] + createdAt := time.Now().UTC() + if bindErr := target.BindFileResource(targetCtx, res.file, FileMetadata{ + Size: job.metadata.Size, Purpose: job.metadata.Purpose, CreatedAt: createdAt, ExpiresAt: createdAt.Add(temporaryFileRetention), + }); bindErr != nil { + firstErr = bindErr + firstTargetErr = bindErr + continue + } + if copyIdx >= 0 { + copies.copies[copyIdx].bound = true + } + for _, pos := range job.parts { + part := &rewritten[pos.content].Parts[pos.part] + relocatedFile := FileRef{ID: res.file.ID, Name: part.File.Name, MIME: part.File.MIME} if strings.TrimSpace(relocatedFile.Name) == "" { - relocatedFile.Name = metadata.Name + relocatedFile.Name = job.metadata.Name } if strings.TrimSpace(relocatedFile.MIME) == "" { - relocatedFile.MIME = metadata.MIME + relocatedFile.MIME = job.metadata.MIME } - relocated[fileID] = relocatedFile part.File = &relocatedFile } } + if cause >= 0 { + firstErr = results[cause].err + if results[cause].targetOp { + firstTargetErr = firstErr + } + } + if firstErr != nil { + if DefinitiveAuthenticationFailure(firstTargetErr) { + s.client.InvalidateDriveCache(targetID) + firstErr = errors.Join(firstErr, target.ConfirmAuthenticationFailure(targetCtx, firstTargetErr)) + } + return nil, nil, errors.Join(firstErr, sourceStateErr, copies.Cleanup()) + } + if stateErr := errors.Join( + sourceStateErr, + target.MarkAuthenticationValid(), + s.pool.ClearCooldownIfGeneration(targetID, "", target.ModelAccessGeneration(), target.CheckedAt()), + ); stateErr != nil { + return nil, nil, errors.Join(stateErr, copies.Cleanup()) + } return rewritten, copies, nil } @@ -844,38 +1549,87 @@ func inlineMediaKeyOf(part Part) inlineMediaKey { return inlineMediaKey{mime: part.InlineData.MIME, sha256: base64.StdEncoding.EncodeToString(digest[:]), name: part.DisplayName} } -// InlineMediaAccount 返回已上传 contents 中最多未过期内联附件的可用账户,没有符合条件的账户时返回空串 -func (p *AccountPool) InlineMediaAccount(contents []Content) string { - keys := make(map[inlineMediaKey]bool) +// InlineMediaAccounts 按命中未过期内联附件的总字节数降序(次按附件数降序)返回候选账户列表;allowed 非空时只考虑其中的账户 +func (p *AccountPool) InlineMediaAccounts(contents []Content, allowed []string) []string { + keys := make(map[inlineMediaKey]int64) for _, content := range contents { for _, part := range content.Parts { if part.InlineData != nil { - keys[inlineMediaKeyOf(part)] = true + key := inlineMediaKeyOf(part) + if _, seen := keys[key]; !seen { + keys[key] = int64(len(part.InlineData.Data)) + } } } } if len(keys) == 0 { - return "" + return nil + } + var allowedSet map[string]struct{} + if len(allowed) > 0 { + allowedSet = make(map[string]struct{}, len(allowed)) + for _, accountID := range allowed { + allowedSet[accountID] = struct{}{} + } + } + type candidate struct { + id string + bytes int64 + hits int } p.mu.Lock() defer p.mu.Unlock() now := time.Now().UTC() - best, bestHits := "", 0 + matched := make([]candidate, 0, len(p.accounts)) for _, account := range p.accounts { if !account.Config.Enabled || account.State != AccountReady { continue } + if allowedSet != nil { + if _, ok := allowedSet[account.ID]; !ok { + continue + } + } + var hitBytes int64 hits := 0 + var seen map[inlineMediaKey]struct{} for _, binding := range account.runtime.Resources { - if binding.Kind == "inline-media" && binding.expiresAt().After(now) && keys[inlineMediaKey{mime: binding.MIME, sha256: binding.SHA256, name: binding.DisplayName}] { - hits++ + if binding.Kind != "inline-media" || !binding.expiresAt().After(now) { + continue + } + key := inlineMediaKey{mime: binding.MIME, sha256: binding.SHA256, name: binding.DisplayName} + size, want := keys[key] + if !want { + continue } + if seen == nil { + seen = make(map[inlineMediaKey]struct{}, len(keys)) + } + if _, dup := seen[key]; dup { + continue + } + seen[key] = struct{}{} + hitBytes += size + hits++ } - if hits > bestHits { - best, bestHits = account.ID, hits + if hits > 0 { + matched = append(matched, candidate{id: account.ID, bytes: hitBytes, hits: hits}) + } + } + if len(matched) == 0 { + return nil + } + sort.SliceStable(matched, func(left, right int) bool { + if matched[left].bytes != matched[right].bytes { + return matched[left].bytes > matched[right].bytes } + return matched[left].hits > matched[right].hits + }) + result := make([]string, len(matched)) + for index, item := range matched { + result[index] = item.id } - return best + return result } // claimInlineMedia 在当前账户已上传且未到期的内联附件中查找 keys 并刷新命中项的使用时间,返回命中的文件与已到期待删除的附件 @@ -928,7 +1682,6 @@ func (l *AccountLease) claimExpiredResources(ctx context.Context, busy func(stri } l.account.storageMu.Lock() defer l.account.storageMu.Unlock() - sources := l.pool.copySources(l.account.ID) var expired []string _, err := l.pool.updateRuntimeContext(ctx, l.account.ID, func(_ *Account, runtimeState *accountRuntimeState) (bool, func(*Account), error) { expired = nil @@ -936,9 +1689,6 @@ func (l *AccountLease) claimExpiredResources(ctx context.Context, busy func(stri now := time.Now().UTC() for id, binding := range runtimeState.Resources { at := binding.expiresAt() - if binding.legacyCopy(sources) { - at = binding.CreatedAt.Add(temporaryFileRetention) - } if at.IsZero() || at.After(now) || binding.Kind == "inline-media" && busy(id) { continue } @@ -954,28 +1704,6 @@ func (l *AccountLease) claimExpiredResources(ctx context.Context, busy func(stri return expired, err } -// copySources 返回 accountID 以外的账户中带摘要的上传文件按 copySourceKey 索引的最早上传时间 -func (p *AccountPool) copySources(accountID string) map[copySourceKey]time.Time { - p.mu.Lock() - defer p.mu.Unlock() - sources := make(map[copySourceKey]time.Time) - for _, account := range p.accounts { - if account.ID == accountID { - continue - } - for _, binding := range account.runtime.Resources { - if binding.Kind != "drive-file" || binding.SHA256 == "" { - continue - } - key := copySourceKey{name: binding.Name, mime: binding.MIME, purpose: binding.Purpose, size: binding.Size} - if uploadedAt, exists := sources[key]; !exists || binding.CreatedAt.Before(uploadedAt) { - sources[key] = binding.CreatedAt - } - } - } - return sources -} - // ReclaimExpiredResources 删除各账户已到期的资源,没有空闲槽位的账户跳过本轮 func (s *PooledService) ReclaimExpiredResources(ctx context.Context) error { var reclaimErr error @@ -1007,18 +1735,16 @@ func (s *PooledService) reclaimExpiredResources(ctx context.Context, accountID s return errors.Join(copies.cleanup(leaseCtx), lease.Release()) } -// bindInlineMedia 记录上传到当前账户的内联附件 -func (l *AccountLease) bindInlineMedia(ctx context.Context, file FileRef, key inlineMediaKey, size int64) error { - l.operation.Lock() - defer l.operation.Unlock() - if l.released { - return fmt.Errorf("账户租约已释放") - } - l.account.storageMu.Lock() - defer l.account.storageMu.Unlock() - accountID := l.account.ID - _, err := l.pool.updateRuntimeContext(ctx, accountID, func(_ *Account, runtimeState *accountRuntimeState) (bool, func(*Account), error) { - if owner, exists := l.pool.resources[file.ID]; exists && owner != accountID { +// bindInlineMediaAccount 把上传到 account 的内联附件记录到账户资源,account 已不是池中当前实例时返回 ErrAccountNotFound +func (p *AccountPool) bindInlineMediaAccount(ctx context.Context, account *Account, file FileRef, key inlineMediaKey, size int64) error { + account.storageMu.Lock() + defer account.storageMu.Unlock() + accountID := account.ID + _, err := p.updateRuntimeContext(ctx, accountID, func(current *Account, runtimeState *accountRuntimeState) (bool, func(*Account), error) { + if current != account { + return false, nil, fmt.Errorf("%w: %s", ErrAccountNotFound, accountID) + } + if owner, exists := p.resources[file.ID]; exists && owner != accountID { return false, nil, fmt.Errorf("资源 %s 已绑定账户 %s", file.ID, owner) } now := time.Now().UTC() @@ -1030,6 +1756,18 @@ func (l *AccountLease) bindInlineMedia(ctx context.Context, file FileRef, key in return err } +// inlineMediaUploadConcurrency 是单次请求并发上传 Drive 内联附件的上限,对齐官网多图现场峰值并发 12 +const inlineMediaUploadConcurrency = 12 + +// driveUploadHTTPStatus 返回 DriveUpload 错误的 HTTP 状态码,非 DriveUpload 错误时返回 0 +func driveUploadHTTPStatus(err error) int { + var rpcError *RPCError + if errors.As(err, &rpcError) && rpcError.Method == "DriveUpload" { + return rpcError.StatusCode + } + return 0 +} + // useInlineMedia 记录进行中的请求引用了 ids,返回释放这些引用的函数 func (s *PooledService) useInlineMedia(ids []string) func() { s.inlineMediaMu.Lock() @@ -1132,70 +1870,204 @@ func (s *PooledService) UploadInlineMediaToLease( _, claimed := files[job.key] return claimed }) + timing := inlineMediaTimingFrom(ctx) + if timing != nil { + timing.Reused = len(files) + } + replaceUploaded := func() { + for key, indexes := range parts { + file, uploaded := files[key] + if !uploaded { + continue + } + for _, index := range indexes { + part := &rewritten[index.content].Parts[index.part] + part.InlineData = nil + part.File = &file + } + } + } + if len(pending) == 0 { + for _, id := range expired { + temporary.copies = append(temporary.copies, temporaryDriveCopy{id: id, bound: true}) + } + if worker := pageWorker(targetID); worker != nil { + worker.ensurePage(targetCtx) + } + temporary.release = s.useInlineMedia(used) + replaceUploaded() + return rewritten, temporary, nil + } var token, folder string + var tokenAt time.Time var folderErr error last := len(rewritten) - 1 staged := slices.DeleteFunc(slices.Clone(pending), func(job uploadJob) bool { return rewritten[last].Role != RoleUser || !slices.ContainsFunc(parts[job.key], func(index partIndex) bool { return index.content == last }) }) + runs, _ := s.client.protected.(PageRunsProtectedTransport) + rerun := runs != nil && runs.RanBefore(targetID, contents) + worker := pageWorker(targetID) var uploader pageUploader - if worker := pageWorker(targetID); worker != nil { - tab, pageErr := worker.usePage(targetCtx) - if pageErr != nil { - return nil, nil, errors.Join(pageErr, temporary.Cleanup()) + var pageRuntime *goWAARuntime + deferredPage := false + if worker != nil { + if tab, ok := worker.tryUsePage(targetCtx); ok { + page := worker.tabPage(tab) + uploader, _ = page.(pageUploader) + pageRuntime, _ = page.(*goWAARuntime) + } else { + deferredPage = true } - uploader, _ = worker.tabPage(tab).(pageUploader) - } - rerun := false - if uploader != nil && len(staged) > 0 { - runs, _ := s.client.protected.(PageRunsProtectedTransport) - rerun = runs != nil && runs.RanBefore(targetID, contents) - token = uploader.beforeUpload(targetCtx, rerun) } - if uploader != nil && (len(pending) > 0 || len(expired) > 0) && uploader.driveDenied(targetCtx) { - temporary.release = s.useInlineMedia(used) + makeInlineFiles := func() []inlineFile { inline := make([]inlineFile, 0, len(staged)) for _, job := range staged { inline = append(inline, inlineFile{name: job.name, blob: job.blob}) } - uploader.inlined(targetCtx, rerun, inline, func(ctx context.Context, body []byte) ([]byte, error) { - return s.client.readRPC(issuedByPage(ctx), "CountTokens", targetID, body) - }) - return rewritten, temporary, nil + return inline + } + countTokens := func(ctx context.Context, body []byte) ([]byte, error) { + return s.client.readRPC(issuedByPage(ctx), "CountTokens", targetID, body) + } + // inlineOnPage 在附件内联时由页面发出 inlined 的伴随 CountTokens:已占用页面时立即发,账户页面全忙时在租约取得页面后发 + inlineOnPage := func() { + switch { + case uploader != nil: + uploader.inlined(targetCtx, rerun, makeInlineFiles(), countTokens) + case deferredPage && len(staged) > 0: + inline := makeInlineFiles() + worker.deferOnPage(targetCtx, target, func(pageCtx context.Context, page workerRuntime) { + if rt, ok := page.(*goWAARuntime); ok { + rt.beforeUploadNonBlocking(pageCtx, rerun) + rt.inlined(pageCtx, rerun, inline, countTokens) + } else if up, ok := page.(pageUploader); ok { + up.beforeUpload(pageCtx, rerun) + up.inlined(pageCtx, rerun, inline, countTokens) + } + }) + } } - if len(pending) > 0 || len(expired) > 0 { + switch { + case uploader != nil && pageRuntime == nil: + if len(staged) > 0 { + token = uploader.beforeUpload(targetCtx, rerun) + } + if uploader.driveDenied(targetCtx) { + temporary.release = s.useInlineMedia(used) + inlineOnPage() + return rewritten, temporary, nil + } + case pageRuntime != nil: + if len(staged) > 0 { + pageRuntime.beforeUploadNonBlocking(targetCtx, rerun) + } + denied, known := pageRuntime.driveDeniedFast() + if !known { + if current, ok := worker.current().(*goWAARuntime); ok { + denied, known = current.driveDeniedFast() + } + } + if known && denied { + temporary.release = s.useInlineMedia(used) + inlineOnPage() + return rewritten, temporary, nil + } + token, tokenAt = pageRuntime.pageTokenEntry() + if token == "" { + if current, ok := worker.current().(*goWAARuntime); ok { + token, tokenAt = current.pageTokenEntry() + } + } + case deferredPage: + if current, ok := worker.current().(*goWAARuntime); ok { + if denied, known := current.driveDeniedFast(); known && denied { + temporary.release = s.useInlineMedia(used) + inlineOnPage() + return rewritten, temporary, nil + } + token, tokenAt = current.pageTokenEntry() + } + } + targetAccount := target.Account() + targetAuthGen := target.AuthGeneration() + if token != "" { + s.client.storeDriveTokenFor(targetID, targetAccount, targetAuthGen, token, tokenAt) + } else { + token = s.client.cachedDriveTokenFor(targetID, targetAccount, targetAuthGen) + } + tokenFromCache := token != "" + folder = s.client.cachedAppFolderFor(targetID, targetAccount, targetAuthGen) + folderFromCache := folder != "" + s.client.prewarmDriveUpload(targetCtx, targetID) + lookupStart := time.Now() + startDiscovery := func() { s.client.startDriveDiscoveryAsync(targetCtx, targetAccount) } + if folderFromCache { + if pageRuntime != nil { + pageRuntime.refreshAppFolderAsync(targetCtx, func(fresh string) { + s.client.storeAppFolderFor(targetID, targetAccount, targetAuthGen, fresh) + }) + } + startDiscovery() + } + if folder == "" || token == "" { + lookupCtx, cancelLookup := context.WithCancel(targetCtx) var lookup sync.WaitGroup - if len(pending) > 0 { - lookup.Go(func() { folder, folderErr = s.client.appFolder(targetCtx, targetID) }) + if folder == "" { + lookup.Go(func() { + folder, folderErr = s.client.fetchAppFolderFor(lookupCtx, targetID, targetAccount, targetAuthGen, startDiscovery) + if folderErr != nil { + cancelLookup() + } else if worker != nil { + if current, ok := worker.current().(*goWAARuntime); ok { + current.appFolderCalled.Store(true) + } + } + }) } if token == "" { - token, err = s.client.GenerateAccessToken(targetCtx, targetID) + token, err = s.client.fetchDriveTokenFor(lookupCtx, targetID, targetAccount, targetAuthGen) + if err != nil { + cancelLookup() + } } lookup.Wait() - if err != nil { + cancelLookup() + if timing != nil { + timing.TokenFolder = time.Since(lookupStart) + } + if driveAuthorizationMissing(err) || driveAuthorizationMissing(folderErr) { temporary.release = s.useInlineMedia(used) - if driveAuthorizationMissing(err) { - return rewritten, temporary, nil + if token == "" { + inlineOnPage() } + return rewritten, temporary, nil + } + if err != nil && errors.Is(err, context.Canceled) && targetCtx.Err() == nil && folderErr != nil { + err = nil + } + if err != nil { + temporary.release = s.useInlineMedia(used) if DefinitiveAuthenticationFailure(err) { + s.client.InvalidateDriveCache(targetID) err = errors.Join(err, target.ConfirmAuthenticationFailure(targetCtx, err)) } return nil, nil, errors.Join(err, temporary.Cleanup()) } - if driveAuthorizationMissing(folderErr) { - temporary.release = s.useInlineMedia(used) - return rewritten, temporary, nil - } - } - for _, id := range expired { - temporary.copies = append(temporary.copies, temporaryDriveCopy{id: id, token: token, bound: true}) + } else if timing != nil { + timing.TokenFolder = time.Since(lookupStart) } uploadErr := folderErr + var tokenMu sync.Mutex + currentToken := token + currentFolder := folder + uploadStart := time.Now() + uploadedCount := 0 if len(pending) > 0 && folderErr == nil { drive := s.client.transport.(DriveTransport) uploadCtx, cancelUploads := context.WithCancel(targetCtx) resultChannel := make(chan uploadResult, len(pending)) - sem := make(chan struct{}, min(len(pending), 4)) + sem := make(chan struct{}, min(len(pending), inlineMediaUploadConcurrency)) for index, job := range pending { go func(index int, job uploadJob) { select { @@ -1205,13 +2077,94 @@ func (s *PooledService) UploadInlineMediaToLease( return } defer func() { <-sem }() - file, err := drive.UploadDrive(uploadCtx, targetID, token, UploadRequest{ - AccountID: targetID, - Name: job.name, - MIME: job.blob.MIME, - Size: int64(len(job.blob.Data)), - Reader: bytes.NewReader(job.blob.Data), - Folder: folder, + file, err := s.client.doInlineUpload(uploadCtx, targetID, targetAccount, job.key, func(flightCtx context.Context) (FileRef, error) { + tokenMu.Lock() + useToken, useFolder := currentToken, currentFolder + tokenMu.Unlock() + if fresh := s.client.cachedDriveTokenFor(targetID, targetAccount, targetAuthGen); fresh != "" { + useToken = fresh + } + if fresh := s.client.cachedAppFolderFor(targetID, targetAccount, targetAuthGen); fresh != "" { + useFolder = fresh + } + req := UploadRequest{ + AccountID: targetID, + Name: job.name, + MIME: job.blob.MIME, + Size: int64(len(job.blob.Data)), + Reader: bytes.NewReader(job.blob.Data), + Folder: useFolder, + } + uploaded, err := drive.UploadDrive(flightCtx, targetID, useToken, req) + usedToken := useToken + if err != nil { + switch driveUploadHTTPStatus(err) { + case http.StatusUnauthorized: + if tokenFromCache { + s.client.invalidateDriveToken(targetID, useToken) + refreshed, refreshErr := s.client.fetchDriveTokenFor(flightCtx, targetID, targetAccount, targetAuthGen) + if refreshErr != nil { + return FileRef{}, refreshErr + } + if refreshed != "" { + tokenMu.Lock() + currentToken = refreshed + useFolder = currentFolder + tokenMu.Unlock() + if freshFolder := s.client.cachedAppFolderFor(targetID, targetAccount, targetAuthGen); freshFolder != "" { + useFolder = freshFolder + } + req.Reader = bytes.NewReader(job.blob.Data) + req.Folder = useFolder + usedToken = refreshed + uploaded, err = drive.UploadDrive(flightCtx, targetID, refreshed, req) + } + } + case http.StatusNotFound: + if folderFromCache { + s.client.invalidateAppFolder(targetID, useFolder) + refreshed, refreshErr := s.client.fetchAppFolderFor(flightCtx, targetID, targetAccount, targetAuthGen, nil) + if refreshErr != nil { + return FileRef{}, refreshErr + } + if refreshed != "" { + tokenMu.Lock() + currentFolder = refreshed + useToken = currentToken + tokenMu.Unlock() + if freshToken := s.client.cachedDriveTokenFor(targetID, targetAccount, targetAuthGen); freshToken != "" { + useToken = freshToken + } + req.Reader = bytes.NewReader(job.blob.Data) + req.Folder = refreshed + usedToken = useToken + uploaded, err = drive.UploadDrive(flightCtx, targetID, useToken, req) + } + } + } + } + if err != nil { + return FileRef{}, err + } + cleanupOrphan := func() { + if uploaded.ID == "" { + return + } + cleanupCtx, cancel := context.WithTimeout(contextWithFlightAccount(context.WithoutCancel(flightCtx), targetAccount), driveCleanupTimeout) + defer cancel() + if delErr := s.client.deleteDriveFile(cleanupCtx, targetID, usedToken, uploaded.ID); delErr != nil && !driveFileNotFound(delErr, "DriveDelete") { + slog.Warn("回收未绑定内联附件失败", "account", targetID, "file", uploaded.ID, "error", delErr) + } + } + if flightCtx.Err() != nil { + cleanupOrphan() + return FileRef{}, flightCtx.Err() + } + if bindErr := s.pool.bindInlineMediaAccount(context.WithoutCancel(flightCtx), targetAccount, uploaded, job.key, int64(len(job.blob.Data))); bindErr != nil { + cleanupOrphan() + return FileRef{}, bindErr + } + return uploaded, nil }) resultChannel <- uploadResult{index: index, file: file, err: err} }(index, job) @@ -1232,49 +2185,89 @@ func (s *PooledService) UploadInlineMediaToLease( continue } job := pending[index] - if bindErr := target.bindInlineMedia(targetCtx, result.file, job.key, int64(len(job.blob.Data))); bindErr != nil { - temporary.copies = append(temporary.copies, temporaryDriveCopy{id: result.file.ID, token: token}) - failures.Add("", bindErr) - continue - } files[job.key] = result.file used = append(used, result.file.ID) + uploadedCount++ } uploadErr = failures.Join(nil) } + if timing != nil { + timing.Upload = time.Since(uploadStart) + timing.Uploaded = uploadedCount + } + tokenMu.Lock() + finalToken := currentToken + tokenMu.Unlock() + if fresh := s.client.cachedDriveTokenFor(targetID, targetAccount, targetAuthGen); fresh != "" { + finalToken = fresh + } + for _, id := range expired { + temporary.copies = append(temporary.copies, temporaryDriveCopy{id: id, token: finalToken, bound: true}) + } temporary.release = s.useInlineMedia(used) + if driveAuthorizationMissing(uploadErr) { + replaceUploaded() + return rewritten, temporary, nil + } if uploadErr != nil && (keepImages || !driveStorageQuotaExceeded(uploadErr)) { if DefinitiveAuthenticationFailure(uploadErr) { + s.client.InvalidateDriveCache(targetID) uploadErr = errors.Join(uploadErr, target.ConfirmAuthenticationFailure(targetCtx, uploadErr)) } return nil, nil, errors.Join(uploadErr, temporary.Cleanup()) } - for key, indexes := range parts { - file, uploaded := files[key] - if !uploaded { - continue - } - for _, index := range indexes { - part := &rewritten[index.content].Parts[index.part] - part.InlineData = nil - part.File = &file - } - } - if uploader != nil && len(staged) > 0 { - refs := make([]FileRef, 0, len(staged)) + replaceUploaded() + var stagedRefs []FileRef + if len(staged) > 0 { + stagedRefs = make([]FileRef, 0, len(staged)) for _, job := range staged { if file, ok := files[job.key]; ok { - refs = append(refs, file) + stagedRefs = append(stagedRefs, file) } } - reader := s.client.transport.(DriveFileReader) - uploader.uploaded(targetCtx, refs, pageDrive{ - count: func(ctx context.Context, body []byte) ([]byte, error) { - return s.client.readRPC(issuedByPage(ctx), "CountTokens", targetID, body) - }, - read: func(ctx context.Context, fileID string) { - reader.ReadDriveFile(ctx, targetID, token, fileID) - }, + } + if uploader != nil && len(staged) > 0 { + if reader, ok := s.client.transport.(DriveFileReader); ok { + uploader.uploaded(targetCtx, stagedRefs, pageDrive{ + count: countTokens, + read: func(ctx context.Context, fileID string) { + reader.ReadDriveFile(ctx, targetID, finalToken, fileID) + }, + }) + } + } else if deferredPage && (len(staged) > 0 || folderFromCache) { + reader, hasReader := s.client.transport.(DriveFileReader) + worker.deferOnPage(targetCtx, target, func(pageCtx context.Context, page workerRuntime) { + if rt, ok := page.(*goWAARuntime); ok { + if len(staged) > 0 { + rt.beforeUploadNonBlocking(pageCtx, rerun) + } + if folderFromCache { + rt.refreshAppFolderAsync(pageCtx, func(fresh string) { + s.client.storeAppFolderFor(targetID, targetAccount, targetAuthGen, fresh) + }) + } + if len(stagedRefs) > 0 && hasReader { + rt.uploaded(pageCtx, stagedRefs, pageDrive{ + count: countTokens, + read: func(ctx context.Context, fileID string) { + reader.ReadDriveFile(ctx, targetID, finalToken, fileID) + }, + }) + } + } else if up, ok := page.(pageUploader); ok { + if len(staged) > 0 { + up.beforeUpload(pageCtx, rerun) + } + if len(stagedRefs) > 0 && hasReader { + up.uploaded(pageCtx, stagedRefs, pageDrive{ + count: countTokens, + read: func(ctx context.Context, fileID string) { + reader.ReadDriveFile(ctx, targetID, finalToken, fileID) + }, + }) + } + } }) } if len(pending) > 0 { @@ -1324,29 +2317,50 @@ func (p *AccountPool) fileReferenceMetadata(ctx context.Context, fileID, targetI // UploadDrive 通过当前账户固定出口上传 Drive 文件 func (t *MakerSuiteHTTPTransport) UploadDrive(ctx context.Context, accountID string, token string, request UploadRequest) (_ FileRef, err error) { - lease, owned, err := resolveAccountLease(ctx, t.pool, AccountSelection{AccountID: accountID}) - if err != nil { - return FileRef{}, err - } - if owned { - defer func() { err = errors.Join(err, lease.Release()) }() + var account *Account + if flightAccount, ok := flightAccountFromContext(ctx); ok && flightAccount.ID == accountID && t.pool.isCurrentAccount(flightAccount) { + account = flightAccount + } else { + lease, owned, err := resolveAccountLease(ctx, t.pool, AccountSelection{AccountID: accountID}) + if err != nil { + return FileRef{}, err + } + if owned { + defer func() { err = errors.Join(err, lease.Release()) }() + } + account = lease.Account() } - client, err := t.clientForAccount(lease.Account()) + client, err := t.clientForAccount(account) if err != nil { return FileRef{}, err } if request.Size < 0 { return uploadDriveResumable(ctx, client, token, request) } - headers, apiKey, err := t.gapiHeaders(ctx, lease.Account()) + headers, apiKey, err := t.gapiHeaders(ctx, account) if err != nil { return FileRef{}, err } - if err := t.loadDriveDiscovery(ctx, lease.Account(), client, headers, apiKey); err != nil { - return FileRef{}, err - } + discoverySent := t.startDriveDiscovery(ctx, account, client, headers, apiKey) headers.Set("Authorization", "Bearer "+token) - return uploadDriveMultipart(ctx, client, driveUploadURL+url.QueryEscape(apiKey), headers, request) + uploadCtx := ctx + if discoverySent != nil { + if _, isBrowser := client.Transport.(*browserRoundTripper); isBrowser { + uploadCtx = withBeforeActualRequest(ctx, func(waitCtx context.Context) { + select { + case <-discoverySent: + case <-waitCtx.Done(): + } + }) + } else { + select { + case <-discoverySent: + case <-ctx.Done(): + return FileRef{}, ctx.Err() + } + } + } + return uploadDriveMultipart(uploadCtx, client, driveUploadURL+url.QueryEscape(apiKey), headers, request) } // clientDetails 返回官网页面 gapi 请求的 X-ClientDetails:按 encodeURIComponent 写出的 appVersion、platform 与 User-Agent @@ -1354,18 +2368,41 @@ func clientDetails(appVersion, platform, userAgent string) string { return "appVersion=" + uriComponent(appVersion) + "&platform=" + uriComponent(platform) + "&userAgent=" + uriComponent(userAgent) } +// cachedGapiFingerprint 返回账户指纹中的 appVersion 与 platform,按账户实例与指纹输入缓存 +func (t *MakerSuiteHTTPTransport) cachedGapiFingerprint(account *Account) (gapiFingerprint, error) { + key := account.StoragePath + "\x00" + account.Config.Locale + "\x00" + account.Config.Timezone + t.gapiFpMu.Lock() + if cached, ok := t.gapiFp[account.ID]; ok && cached.account == account && cached.key == key { + t.gapiFpMu.Unlock() + return cached.fp, nil + } + t.gapiFpMu.Unlock() + fingerprint, err := camoufoxnative.AccountFingerprint(camoufoxnative.Options{StorageStatePath: account.StoragePath, Locale: account.Config.Locale, Timezone: account.Config.Timezone}) + if err != nil { + return gapiFingerprint{}, err + } + appVersion, _ := fingerprint["navigator.appVersion"].(string) + platform, _ := fingerprint["navigator.platform"].(string) + entry := gapiFingerprint{appVersion: appVersion, platform: platform} + t.gapiFpMu.Lock() + if t.gapiFp == nil { + t.gapiFp = make(map[string]cachedGapiFingerprint) + } + t.gapiFp[account.ID] = cachedGapiFingerprint{account: account, key: key, fp: entry} + t.gapiFpMu.Unlock() + return entry, nil +} + // gapiHeaders 返回官网页面 gapi 请求的公共头与页面的 API key,X-ClientDetails 取账户指纹的 appVersion、platform 与 User-Agent func (t *MakerSuiteHTTPTransport) gapiHeaders(ctx context.Context, account *Account) (http.Header, string, error) { public, err := t.headers.ProtocolHeaders(ctx, account.ID) if err != nil { return nil, "", fmt.Errorf("读取账户动态公共头: %w", err) } - fingerprint, err := camoufoxnative.AccountFingerprint(camoufoxnative.Options{StorageStatePath: account.StoragePath, Locale: account.Config.Locale, Timezone: account.Config.Timezone}) + fp, err := t.cachedGapiFingerprint(account) if err != nil { return nil, "", fmt.Errorf("读取账户指纹: %w", err) } - appVersion, _ := fingerprint["navigator.appVersion"].(string) - platform, _ := fingerprint["navigator.platform"].(string) userAgent := public.Get("User-Agent") headers := http.Header{} headers.Set("User-Agent", userAgent) @@ -1378,7 +2415,7 @@ func (t *MakerSuiteHTTPTransport) gapiHeaders(ctx context.Context, account *Acco headers.Set("X-JavaScript-User-Agent", "google-api-javascript-client/1.1.0") headers.Set("X-Requested-With", "XMLHttpRequest") headers.Set("X-Goog-Encode-Response-If-Executable", "base64") - headers.Set("X-ClientDetails", clientDetails(appVersion, platform, userAgent)) + headers.Set("X-ClientDetails", clientDetails(fp.appVersion, fp.platform, userAgent)) headers.Set("Origin", aiStudioOrigin) headers.Set("Sec-Fetch-Dest", "empty") headers.Set("Sec-Fetch-Mode", "cors") @@ -1390,55 +2427,120 @@ func uriComponent(value string) string { return strings.NewReplacer("+", "%20", "%21", "!", "%27", "'", "%28", "(", "%29", ")", "%2A", "*").Replace(url.QueryEscape(value)) } -// loadDriveDiscovery 在账户第一次经 gapi 上传前按官网页面读取 Drive v3 discovery 文档,每个账户读取一次,同时上传的多个文件等待同一次读取 -func (t *MakerSuiteHTTPTransport) loadDriveDiscovery(ctx context.Context, account *Account, client *http.Client, gapi http.Header, apiKey string) error { - _, err, _ := t.driveDiscovery.Do(account.ID, func() (any, error) { - return nil, t.readDriveDiscovery(ctx, account, client, gapi, apiKey) - }) - return err +// StartDriveDiscoveryAsync 在后台启动账户首次 Drive discovery,不等它发出 +func (t *MakerSuiteHTTPTransport) StartDriveDiscoveryAsync(ctx context.Context, account *Account) { + if account == nil || !t.pool.isCurrentAccount(account) { + return + } + t.driveMu.Lock() + if t.driveDiscovered[account.ID] == account || t.driveStarting[account.ID] != nil { + t.driveMu.Unlock() + return + } + t.driveMu.Unlock() + go func() { + bgCtx, cancel := context.WithTimeout(contextWithFlightAccount(context.WithoutCancel(ctx), account), driveLookupFlightTimeout) + defer cancel() + client, err := t.clientForAccount(account) + if err != nil { + return + } + headers, apiKey, err := t.gapiHeaders(bgCtx, account) + if err != nil { + return + } + t.startDriveDiscovery(bgCtx, account, client, headers, apiKey) + }() } -// readDriveDiscovery 读取账户尚未读取过的 Drive v3 discovery 文档 -func (t *MakerSuiteHTTPTransport) readDriveDiscovery(ctx context.Context, account *Account, client *http.Client, gapi http.Header, apiKey string) error { +// startDriveDiscovery 在账户首次经 gapi 上传前于后台读取一次 Drive v3 discovery 文档,返回的通道在 GET discovery 的请求头写出后关闭,账户已读取过时返回 nil +// 同一账户同时只有一次读取,读取不随调用方取消 +func (t *MakerSuiteHTTPTransport) startDriveDiscovery(ctx context.Context, account *Account, client *http.Client, gapi http.Header, apiKey string) <-chan struct{} { t.driveMu.Lock() - loaded := t.driveDiscovered[account.ID] - t.driveMu.Unlock() - if loaded { + if t.driveDiscovered[account.ID] == account { + t.driveMu.Unlock() return nil } - if err := t.getDriveDiscovery(ctx, account, client, gapi, apiKey); err != nil { - return err + if starting, inflight := t.driveStarting[account.ID]; inflight { + t.driveMu.Unlock() + return starting } - t.driveMu.Lock() - t.driveDiscovered[account.ID] = true + if t.driveStarting == nil { + t.driveStarting = make(map[string]chan struct{}) + } + starting := make(chan struct{}) + t.driveStarting[account.ID] = starting t.driveMu.Unlock() - return nil + + headers := gapi.Clone() + go func() { + discCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), driveLookupFlightTimeout) + defer cancel() + var once sync.Once + signalSent := func() { once.Do(func() { close(starting) }) } + defer func() { + signalSent() + t.driveMu.Lock() + if t.driveStarting[account.ID] == starting { + delete(t.driveStarting, account.ID) + } + t.driveMu.Unlock() + }() + if _, isBrowser := client.Transport.(*browserRoundTripper); isBrowser { + discCtx = withRequestWroteHeaders(discCtx, signalSent) + } else { + discCtx = httptrace.WithClientTrace(discCtx, &httptrace.ClientTrace{WroteHeaders: signalSent}) + } + request, err := t.prepareDriveDiscovery(discCtx, account, headers, apiKey) + if err != nil { + slog.Warn("准备 Drive discovery 请求失败", "account", account.ID, "error", err) + return + } + if err := sendDriveDiscovery(client, request); err != nil { + slog.Warn("后台读取 Drive discovery 失败", "account", account.ID, "error", err) + return + } + t.driveMu.Lock() + if t.driveDiscovered == nil { + t.driveDiscovered = make(map[string]*Account) + } + if t.pool.isCurrentAccount(account) { + t.driveDiscovered[account.ID] = account + } + t.driveMu.Unlock() + }() + return starting } -// getDriveDiscovery 以页面 gapi 的请求形状、页面的登录凭据读取 Drive v3 discovery 文档 -func (t *MakerSuiteHTTPTransport) getDriveDiscovery(ctx context.Context, account *Account, client *http.Client, gapi http.Header, apiKey string) error { +// prepareDriveDiscovery 构造页面 gapi 读取 Drive v3 discovery 文档的 HTTP 请求 +func (t *MakerSuiteHTTPTransport) prepareDriveDiscovery(ctx context.Context, account *Account, gapi http.Header, apiKey string) (*http.Request, error) { address := fmt.Sprintf(driveDiscoveryURL, url.QueryEscape(apiKey)) state, err := pageLoginState(ctx, account) if err != nil { - return fmt.Errorf("读取账户登录状态: %w", err) + return nil, fmt.Errorf("读取账户登录状态: %w", err) } authorization, err := t.signer.Authorization(state) if err != nil { - return err + return nil, err } cookie, err := state.CookieHeader(address, t.now()) if err != nil { - return err + return nil, err } request, err := http.NewRequestWithContext(ctx, http.MethodGet, address, nil) if err != nil { - return err + return nil, err } request.Header = gapi.Clone() request.Header.Set("X-Goog-AuthUser", strconv.Itoa(account.Config.AuthUser)) request.Header.Set("Authorization", authorization) request.Header.Set("Cookie", cookie) request.Header.Set("Sec-Fetch-Site", "same-site") + return request, nil +} + +// sendDriveDiscovery 发送并校验 Drive v3 discovery 文档请求 +func sendDriveDiscovery(client *http.Client, request *http.Request) error { response, err := sendHTTP(client, request) if err != nil { return fmt.Errorf("读取 Drive discovery: %w", err) @@ -1454,6 +2556,15 @@ func (t *MakerSuiteHTTPTransport) getDriveDiscovery(ctx context.Context, account return nil } +// getDriveDiscovery 以页面 gapi 的请求形状、页面的登录凭据读取 Drive v3 discovery 文档 +func (t *MakerSuiteHTTPTransport) getDriveDiscovery(ctx context.Context, account *Account, client *http.Client, gapi http.Header, apiKey string) error { + request, err := t.prepareDriveDiscovery(ctx, account, gapi, apiKey) + if err != nil { + return err + } + return sendDriveDiscovery(client, request) +} + // DriveFileReader 负责像官网对话中显示附件一样读取 Drive 文件 type DriveFileReader interface { ReadDriveFile(ctx context.Context, accountID, token, fileID string) @@ -1765,19 +2876,25 @@ func (t *MakerSuiteHTTPTransport) DownloadDrive(ctx context.Context, accountID s // DeleteDrive 通过当前账户固定出口删除 Drive 文件 func (t *MakerSuiteHTTPTransport) DeleteDrive(ctx context.Context, accountID string, token string, fileID string) (err error) { - lease, owned, err := resolveAccountLease(ctx, t.pool, AccountSelection{AccountID: accountID}) - if err != nil { - return err - } - if owned { - defer func() { err = errors.Join(err, lease.Release()) }() + var account *Account + if flightAccount, ok := flightAccountFromContext(ctx); ok && flightAccount.ID == accountID && t.pool.isCurrentAccount(flightAccount) { + account = flightAccount + } else { + lease, owned, err := resolveAccountLease(ctx, t.pool, AccountSelection{AccountID: accountID}) + if err != nil { + return err + } + if owned { + defer func() { err = errors.Join(err, lease.Release()) }() + } + account = lease.Account() } request, err := http.NewRequestWithContext(ctx, http.MethodDelete, driveAPIBase+"/"+url.PathEscape(fileID), nil) if err != nil { return err } request.Header.Set("Authorization", "Bearer "+token) - client, err := t.clientForAccount(lease.Account()) + client, err := t.clientForAccount(account) if err != nil { return err } diff --git a/internal/aistudio/webchannel.go b/internal/aistudio/webchannel.go index fefdf8a2..312eb020 100644 --- a/internal/aistudio/webchannel.go +++ b/internal/aistudio/webchannel.go @@ -145,7 +145,7 @@ func (s *PooledService) OpenBidi(ctx context.Context, request BidiRequest) (*Bid } lease, owned, err := resolveAccountLease(ctx, s.pool, selection) if err != nil { - if requestErr != nil && errors.Is(err, ErrNoEligibleAccount) { + if requestErr != nil && NoMoreEligibleAccounts(err) { return nil, requestErr } return nil, err diff --git a/internal/api/admin.go b/internal/api/admin.go index 2fa710b9..c74172d9 100644 --- a/internal/api/admin.go +++ b/internal/api/admin.go @@ -185,6 +185,8 @@ type AccessLog struct { Generation bool Attempts []RequestAttempt Authorized bool + // APIKey 是请求所用 API key 的标识,没有配置 key 时为空 + APIKey string } // AdminAccountCounts 表示账户状态计数 @@ -233,6 +235,8 @@ type AdminAccount struct { VerificationRequired bool `json:"verification_required,omitempty"` // DeviceBoundSession 表示账户会话带 __Secure-1PSIDRTS 且缺少本地与远程续签材料,约 2 小时内失效 DeviceBoundSession bool `json:"device_bound_session,omitempty"` + // MigratedModels 是账户目录中被 Google 迁移到任务接口的模型 ID,没有时省略 + MigratedModels []string `json:"migrated_models,omitempty"` } // AccountExit 表示一个账户出口代理的公网 IP 与按 IP 定位的国家、时区和语言,Proxy 为空时是直连,查询失败时 Error 为原因 @@ -402,6 +406,10 @@ type RuntimeConfig struct { WAABackend string `json:"waa_backend"` MediaOutput string `json:"media_output"` MediaBaseURL string `json:"media_base_url"` + BuildChatModels bool `json:"build_chat_models"` + HideModels string `json:"hide_models"` + GenerateContentAccounts string `json:"generate_content_accounts"` + SillyTavernAPIKeys string `json:"sillytavern_api_keys"` Environment []string `json:"environment"` Invalid []InvalidConfigValue `json:"invalid"` } diff --git a/internal/api/anthropic.go b/internal/api/anthropic.go index 9b42fb94..eb56cab7 100644 --- a/internal/api/anthropic.go +++ b/internal/api/anthropic.go @@ -168,7 +168,7 @@ func (s *server) handleAnthropicMessages(w http.ResponseWriter, r *http.Request) if request.Stream { estimate = aistudio.StartInputTokenEstimate(generateRequest) } - events, err := s.service.Generate(r.Context(), generateRequest) + events, err := s.generate(r.Context(), generateRequest) var startUsage *aistudio.Usage if err == nil && request.Stream { events, startUsage, err = awaitStreamStart(r.Context(), events) @@ -237,7 +237,7 @@ func (s *server) writeAnthropicPrefill(w http.ResponseWriter, r *http.Request, r one := int64(1) generateRequest.Config.MaxOutputTokens = &one generateRequest.Unary = true - events, err := s.service.Generate(r.Context(), generateRequest) + events, err := s.generate(r.Context(), generateRequest) var generated generationResult if err == nil { generated, err = consumeEvents(r.Context(), events) diff --git a/internal/api/chat_choices.go b/internal/api/chat_choices.go index c10575d9..20c2ce0a 100644 --- a/internal/api/chat_choices.go +++ b/internal/api/chat_choices.go @@ -42,7 +42,7 @@ func (s *server) startChatChoices(ctx context.Context, request aistudio.Generate choices.running.Add(1) go func() { defer choices.running.Done() - upstream, err := s.service.Generate(choices.ctx, choice) + upstream, err := s.generate(choices.ctx, choice) source := upstream if err == nil && stream { source, _, err = awaitStreamStart(choices.ctx, upstream) diff --git a/internal/api/gemini_files.go b/internal/api/gemini_files.go index f6b03e0a..c7593d7c 100644 --- a/internal/api/gemini_files.go +++ b/internal/api/gemini_files.go @@ -109,6 +109,7 @@ type geminiUploadSession struct { name string mime string scope context.Context + apiKey string received int64 buffer *os.File expires time.Time @@ -280,8 +281,9 @@ func (s *server) startGeminiUpload(w http.ResponseWriter, r *http.Request) { } session := &geminiUploadSession{ alias: alias, name: geminiUploadName(metadata, "", r), - mime: firstMediaType(r.Header.Get("X-Goog-Upload-Header-Content-Type"), metadata.File.MIMEType), - scope: aistudio.ContextWithSelectionScope(context.Background(), r.Context()), + mime: firstMediaType(r.Header.Get("X-Goog-Upload-Header-Content-Type"), metadata.File.MIMEType), + scope: aistudio.ContextWithSelectionScope(context.Background(), r.Context()), + apiKey: accessLogAPIKey(r.Context()), } id := s.uploads.start(session) w.Header().Set("X-Goog-Upload-URL", requestOrigin(r)+"/upload/v1beta/files?upload_id="+url.QueryEscape(id)+"&upload_protocol=resumable") @@ -314,7 +316,7 @@ func (s *server) handleGeminiUploadChunk(w http.ResponseWriter, r *http.Request) writeGeminiUploadError(w, http.StatusNotFound, "NOT_FOUND", "upload session was not found", "final") return } - markAccessLogAuthorized(r.Context()) + markAccessLogAuthorized(r.Context(), session.apiKey) session.mu.Lock() defer session.mu.Unlock() if session.done { diff --git a/internal/api/interactions.go b/internal/api/interactions.go index db999b50..9f4d9b19 100644 --- a/internal/api/interactions.go +++ b/internal/api/interactions.go @@ -131,7 +131,7 @@ func (s *server) handleInteraction(w http.ResponseWriter, r *http.Request) { } } r = r.WithContext(ctx) - events, err := s.service.Generate(ctx, generate) + events, err := s.generate(ctx, generate) if err == nil && request.Stream { events, _, err = awaitStreamStart(ctx, events) } diff --git a/internal/api/ledger.go b/internal/api/ledger.go index 1443aad2..5d2e7396 100644 --- a/internal/api/ledger.go +++ b/internal/api/ledger.go @@ -13,6 +13,7 @@ import ( "strings" "sync" "time" + "unicode/utf8" ) // requestBodyLimit 是单个请求或响应正文保存的最大字节数 @@ -39,7 +40,7 @@ type RequestLedger interface { } // UsageDimensions 是用量可筛选与分组的维度 -var UsageDimensions = []string{"model", "account", "channel", "protocol", "state"} +var UsageDimensions = []string{"model", "account", "channel", "protocol", "state", "api_key"} // UsageFilters 按维度限定参与统计的请求,同一维度内多个取值为或关系 type UsageFilters map[string][]string @@ -115,7 +116,7 @@ type UsageRecent struct { Tokens int64 `json:"tokens"` } -// UsageReport 返回用量看板的汇总、上一周期、当前吞吐、估算费用与未计价模型、逐桶趋势、堆叠序列、分项与筛选候选 +// UsageReport 返回用量看板的汇总、上一周期、当前吞吐、估算费用、各 API key 的估算费用与未计价模型、逐桶趋势、堆叠序列、分项与筛选候选 type UsageReport struct { From time.Time `json:"from"` To time.Time `json:"to"` @@ -126,6 +127,7 @@ type UsageReport struct { Previous UsageStats `json:"previous"` Cost float64 `json:"cost"` PreviousCost float64 `json:"previous_cost"` + APIKeyCost map[string]float64 `json:"api_key_cost"` UnpricedModels []string `json:"unpriced_models"` Recent UsageRecent `json:"recent"` Buckets []UsageBucket `json:"buckets"` @@ -207,6 +209,7 @@ type UsageRecord struct { Model string `json:"model"` Account string `json:"account"` Channel string `json:"channel"` + APIKey string `json:"api_key"` Status int `json:"status"` State string `json:"state"` DurationMS int64 `json:"duration_ms"` @@ -332,7 +335,7 @@ func (s *server) handleUsage(w http.ResponseWriter, r *http.Request) { } if value := values.Get("stack"); value != "" { if !slices.Contains(UsageDimensions, value) { - writeAdminError(w, http.StatusBadRequest, "invalid_request", "stack 必须是 model、account、channel、protocol 或 state") + writeAdminError(w, http.StatusBadRequest, "invalid_request", "stack 必须是 model、account、channel、protocol、state 或 api_key") return } query.Stack = value @@ -450,7 +453,26 @@ func (capture *bodyCapture) add(data []byte) { func (capture *bodyCapture) result() (string, int64) { capture.mu.Lock() defer capture.mu.Unlock() - return capture.data.String(), capture.size + text := capture.data.String() + if capture.size > int64(len(text)) { + text = trimIncompleteUTF8(text) + } + return text, capture.size +} + +// trimIncompleteUTF8 截断字节前缀时去掉末尾不完整的 UTF-8 多字节序列,不产生 U+FFFD +func trimIncompleteUTF8(text string) string { + end := len(text) + for cut := 1; cut < utf8.UTFMax && cut <= end; cut++ { + start := end - cut + if utf8.RuneStart(text[start]) { + if utf8.FullRuneInString(text[start:end]) { + return text + } + return text[:start] + } + } + return text } // captureReader 在读取请求正文时复制前缀 diff --git a/internal/api/media.go b/internal/api/media.go index d5c26404..0f25e29a 100644 --- a/internal/api/media.go +++ b/internal/api/media.go @@ -507,7 +507,7 @@ func (s *server) handleOpenAISpeech(w http.ResponseWriter, r *http.Request) { if style != "" { part.SpeechMetadata = &aistudio.SpeechMetadata{Style: style} } - events, err := s.service.Generate(r.Context(), aistudio.GenerateRequest{ + events, err := s.generate(r.Context(), aistudio.GenerateRequest{ ID: newID("speech"), Unary: streamFormat != "sse", Model: request.Model, diff --git a/internal/api/middleware.go b/internal/api/middleware.go index 9956d4a2..5e44e398 100644 --- a/internal/api/middleware.go +++ b/internal/api/middleware.go @@ -62,6 +62,7 @@ type accessLogMetadata struct { proof ProofTiming attempts []RequestAttempt authorized bool + apiKey string } type accessLogResponseWriter struct { @@ -144,7 +145,7 @@ func (metadata *accessLogMetadata) finished(status int, disconnected bool) Acces Temperature: metadata.temperature, TopP: metadata.topP, Thinking: metadata.thinking, MaxOutputTokens: metadata.maxOutputTokens, RequestID: metadata.requestID, Model: metadata.model, Account: metadata.account, Channel: metadata.channel, FinishReason: metadata.finishReason, Error: metadata.err, Canceled: metadata.canceled, Generation: metadata.generation, - Attempts: slices.Clone(metadata.attempts), Authorized: metadata.authorized, + Attempts: slices.Clone(metadata.attempts), Authorized: metadata.authorized, APIKey: metadata.apiKey, } } @@ -175,15 +176,26 @@ func DetachAccessLog(ctx context.Context) { } } -// markAccessLogAuthorized 标记请求已通过公开 API key 校验 -func markAccessLogAuthorized(ctx context.Context) { +// markAccessLogAuthorized 标记请求已通过公开 API key 校验,apiKey 是所用 key 的标识,没有配置 key 时为空 +func markAccessLogAuthorized(ctx context.Context, apiKey string) { if metadata, ok := ctx.Value(accessLogContextKey{}).(*accessLogMetadata); ok { metadata.mu.Lock() metadata.authorized = true + metadata.apiKey = apiKey metadata.mu.Unlock() } } +// accessLogAPIKey 返回请求已记下的 API key 标识 +func accessLogAPIKey(ctx context.Context) string { + if metadata, ok := ctx.Value(accessLogContextKey{}).(*accessLogMetadata); ok { + metadata.mu.Lock() + defer metadata.mu.Unlock() + return metadata.apiKey + } + return "" +} + // AddAccessLogAttempt 追加一次未成功的上游尝试 func AddAccessLogAttempt(ctx context.Context, attempt RequestAttempt) { if metadata, ok := ctx.Value(accessLogContextKey{}).(*accessLogMetadata); ok { @@ -603,14 +615,21 @@ func sameOriginMiddleware(next http.Handler) http.Handler { }) } +// authMiddleware 校验公开请求的 API key,成功后记下脱敏标识并把匹配的 key 放进请求上下文供账户池选号 func authMiddleware(configuredKeys func() string, next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { keys := apiKeys(configuredKeys()) - if len(keys) > 0 && !checkAPIKeyMatches(r, keys) { - writeAuthError(w, r) - return + label := "" + if len(keys) > 0 { + key, ok := matchedAPIKey(r, keys) + if !ok { + writeAuthError(w, r) + return + } + label = apiKeyLabel(key) + r = r.WithContext(aistudio.ContextWithAPIKey(r.Context(), key)) } - markAccessLogAuthorized(r.Context()) + markAccessLogAuthorized(r.Context(), label) next.ServeHTTP(w, r) }) } @@ -630,22 +649,6 @@ func accountContextMiddleware(next http.Handler) http.Handler { }) } -// apiKeyContextMiddleware 把请求所用的已配置 API key 放进请求上下文,供账户池按 key 绑定的账户选号 -func apiKeyContextMiddleware(configuredKeys func() string, next http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - keys := apiKeys(configuredKeys()) - if len(keys) > 0 { - for _, candidate := range apiKeyCandidates(r) { - if candidate != "" && slices.Contains(keys, candidate) { - r = r.WithContext(aistudio.ContextWithAPIKey(r.Context(), candidate)) - break - } - } - } - next.ServeHTTP(w, r) - }) -} - // apiKeys 返回逗号分隔、去掉空白的已配置 API key func apiKeys(configuredKeys string) []string { var keys []string @@ -671,19 +674,25 @@ func apiKeyCandidates(r *http.Request) []string { return candidates } -// checkAPIKeyMatches 判断请求头或 URL 中任一 API key 是否与配置的某个 key 相同 -func checkAPIKeyMatches(r *http.Request, keys []string) bool { +// matchedAPIKey 返回请求头或 URL 中与配置相同的第一个 API key +func matchedAPIKey(r *http.Request, keys []string) (string, bool) { for _, cand := range apiKeyCandidates(r) { if cand == "" { continue } for _, key := range keys { if subtle.ConstantTimeCompare([]byte(cand), []byte(key)) == 1 { - return true + return key, true } } } - return false + return "", false +} + +// apiKeyLabel 返回请求记录中 API key 的标识:圆点加 key 的末 4 个字符,不足 8 个字符的 key 只取后一半;末几位相同的 key 为同一个标识 +func apiKeyLabel(key string) string { + runes := []rune(key) + return "••••" + string(runes[len(runes)-min(4, len(runes)/2):]) } // bearerToken 返回 Authorization Bearer 凭据 diff --git a/internal/api/middleware_test.go b/internal/api/middleware_test.go index 3104b455..10eab146 100644 --- a/internal/api/middleware_test.go +++ b/internal/api/middleware_test.go @@ -77,10 +77,10 @@ func TestDynamicAPIKeyHotReload(t *testing.T) { }, 1) pool.SetAPIKeyAccounts(map[string][]string{"key-b": {"acct-b"}, "key-c": {"acct-c"}}) var allowed []string - handler := browserOriginMiddleware(keySource, authMiddleware(keySource, apiKeyContextMiddleware(keySource, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + handler := browserOriginMiddleware(keySource, authMiddleware(keySource, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { allowed = pool.ScopedSelection(r.Context(), aistudio.AccountSelection{}).AllowedAccountIDs w.WriteHeader(http.StatusOK) - })))) + }))) send := func(headers map[string]string) int { allowed = nil diff --git a/internal/api/responses.go b/internal/api/responses.go index 983d6870..fdbdff29 100644 --- a/internal/api/responses.go +++ b/internal/api/responses.go @@ -739,7 +739,7 @@ func (s *server) handleResponses(w http.ResponseWriter, r *http.Request) { } generateRequest := prepared.generate generateRequest.Unary = !request.Stream || s.responseModes().FakeStream - events, err := s.service.Generate(r.Context(), generateRequest) + events, err := s.generate(r.Context(), generateRequest) if err == nil && request.Stream { events, _, err = awaitStreamStart(r.Context(), events) } diff --git a/internal/api/responses_background.go b/internal/api/responses_background.go index 6098178b..2f2f6590 100644 --- a/internal/api/responses_background.go +++ b/internal/api/responses_background.go @@ -74,7 +74,7 @@ func (s *server) respondBackground(w http.ResponseWriter, r *http.Request, reque generate := prepared.generate generate.Unary = true generate.Background = true - events, err = s.service.Generate(ctx, generate) + events, err = s.generate(ctx, generate) } var result generationResult if err == nil { @@ -124,7 +124,7 @@ func (s *server) streamBackground(w http.ResponseWriter, r *http.Request, reques prepared.generate.Background = true var events <-chan aistudio.Event if err == nil { - events, err = s.service.Generate(ctx, prepared.generate) + events, err = s.generate(ctx, prepared.generate) } reported := func(error) bool { return !errors.Is(ctx.Err(), context.Canceled) } if err == nil { diff --git a/internal/api/responses_compaction.go b/internal/api/responses_compaction.go index 38b07c48..b83ffdd7 100644 --- a/internal/api/responses_compaction.go +++ b/internal/api/responses_compaction.go @@ -369,7 +369,7 @@ func (s *server) generateCompactionSummary(ctx context.Context, base aistudio.Ge summarize.Config.ResponseJSONSchema = nil summarize.Config.MaxOutputTokens = nil summarize.Config.StopSequences = nil - events, err := s.service.Generate(ctx, summarize) + events, err := s.generate(ctx, summarize) if err != nil { return "", nil, err } diff --git a/internal/api/router.go b/internal/api/router.go index 73a6d79f..788ffd55 100644 --- a/internal/api/router.go +++ b/internal/api/router.go @@ -17,8 +17,7 @@ import ( type Config struct { // PickPath 以系统对话框选择账户目录并返回选中的路径,用户取消时返回空串;只在桌面版提供 PickPath func(start string) (string, error) - APIKey string - // APIKeys 返回当前生效的逗号分隔 API key,为空时使用 APIKey + // APIKeys 返回当前生效的逗号分隔 API key APIKeys func() string Admin AdminService AdminAuthEnabled bool @@ -45,6 +44,8 @@ type Config struct { EgressProxy func() string // States 持久保存 Responses、Interactions 与 Chat 音频回复的续接节点,为空时只保存在内存中 States StateStore + // VoicesDir 是 Voice Design 自定义声音的保存目录 + VoicesDir string } // ResponseModes 是生成请求的响应方式设置 @@ -70,6 +71,10 @@ type server struct { background sync.Map // media 是媒体 URL 模式的生成媒体目录 media *mediaStore + // voices 是 Voice Design 自定义声音 + voices *voiceStore + // voiceRankings 是各声音描述的预置音色排名 + voiceRankings voiceRankings } var idSequence atomic.Uint64 @@ -79,7 +84,7 @@ func NewHandler(service aistudio.Service, config Config) http.Handler { s := &server{ service: service, config: config, responseStates: newResponseStateStore(config.States), uploads: newGeminiUploads(), caches: newGeminiCaches(), thoughtSignatures: newThoughtSignatureStore(), pairing: &pairingTokens{}, loginViews: &loginViews{}, accountTasks: &accountTasks{}, - media: &mediaStore{dir: config.MediaDir, limit: config.MediaLimit}, + media: &mediaStore{dir: config.MediaDir, limit: config.MediaLimit}, voices: &voiceStore{dir: config.VoicesDir}, } if config.MediaDir != "" { if err := s.media.trim(); err != nil { @@ -138,6 +143,10 @@ func NewHandler(service aistudio.Service, config Config) http.Handler { public.HandleFunc("POST /v1beta/models/{action}", s.handleGeminiAction) public.HandleFunc("GET /v1beta/operations/{operation}", s.handleGeminiVideoOperation) public.HandleFunc("POST /v1beta/decisions", s.handleDecision) + public.HandleFunc("GET /v1beta/voices", s.handleVoiceList) + public.HandleFunc("POST /v1beta/voices", s.handleVoiceCreate) + public.HandleFunc("GET /v1beta/voices/{voice}", s.handleVoiceGet) + public.HandleFunc("DELETE /v1beta/voices/{voice}", s.handleVoiceDelete) public.HandleFunc("POST /upload/v1beta/files", s.handleGeminiFileUpload) public.HandleFunc("GET /v1beta/files", s.handleGeminiFileList) public.HandleFunc("GET /v1beta/files/{file}", s.handleGeminiFileGet) @@ -160,13 +169,8 @@ func NewHandler(service aistudio.Service, config Config) http.Handler { root := http.NewServeMux() root.Handle("GET /health", corsMiddleware(http.HandlerFunc(s.handleHealth))) - keySource := config.APIKeys - if keySource == nil { - staticKey := config.APIKey - keySource = func() string { return staticKey } - } - s.config.APIKeys = keySource - publicHandler := bodyLimitMiddleware(browserOriginMiddleware(keySource, authMiddleware(keySource, apiKeyContextMiddleware(keySource, accountContextMiddleware(requestEncodingMiddleware(requestBodyMiddleware(config.Ledger, waitLaunchMiddleware(config.WaitLaunch, s.catalogRead, public)))))))) + keys := config.APIKeys + publicHandler := bodyLimitMiddleware(browserOriginMiddleware(keys, authMiddleware(keys, accountContextMiddleware(requestEncodingMiddleware(requestBodyMiddleware(config.Ledger, waitLaunchMiddleware(config.WaitLaunch, s.catalogRead, public))))))) loggedHandler := requestLoggingMiddleware(config.Admin, corsMiddleware(publicHandler)) root.Handle("/v1/", loggedHandler) root.Handle("/v1beta/", loggedHandler) diff --git a/internal/api/translations.go b/internal/api/translations.go index f5d9aa09..b23e64cf 100644 --- a/internal/api/translations.go +++ b/internal/api/translations.go @@ -125,7 +125,7 @@ func (s *server) translateSegments(ctx context.Context, model string, sources [] instruction += "Context and style guidance: " + prompt + "\n\n" } schema := fmt.Sprintf(`{"type":"object","properties":{"segments":{"type":"array","items":{"type":"string"},"minItems":%d,"maxItems":%d}},"required":["segments"]}`, len(sources), len(sources)) - events, err := s.service.Generate(ctx, aistudio.GenerateRequest{ + events, err := s.generate(ctx, aistudio.GenerateRequest{ ID: newID("translation"), Unary: true, Model: model, Contents: []aistudio.Content{{Role: aistudio.RoleUser, Parts: []aistudio.Part{{Text: instruction + string(encoded)}}}}, Config: aistudio.GenerationConfig{Temperature: temperature, ResponseMIMEType: "application/json", ResponseSchema: json.RawMessage(schema)}, diff --git a/internal/api/voices.go b/internal/api/voices.go new file mode 100644 index 00000000..2851292a --- /dev/null +++ b/internal/api/voices.go @@ -0,0 +1,603 @@ +package api + +import ( + "cmp" + "context" + "crypto/rand" + "encoding/hex" + "encoding/json" + "errors" + "fmt" + "net/http" + "os" + "path/filepath" + "slices" + "strings" + "sync" + "time" + + "github.com/Mag1cFall/AIStudio2API/internal/aistudio" +) + +// voicePickModel 是按声音描述挑选预置音色与试听台词的文本模型 +const voicePickModel = "gemini-flash-lite-latest" + +// voiceSampleText 是挑选试听台词失败时使用的官网语音页试听台词 +const voiceSampleText = "Hello! I'm ready to bring your story to life." + +// errVoiceNotFound 表示自定义声音不存在 +var errVoiceNotFound = errors.New("voice not found") + +// storedVoice 是本地保存的一个自定义声音:描述作为风格提示,在 BaseVoice 预置音色上生成语音 +type storedVoice struct { + ID string `json:"id"` + DisplayName string `json:"display_name"` + Input string `json:"input"` + BaseVoice string `json:"base_voice"` + Model string `json:"model"` + LanguageCode string `json:"language_code,omitempty"` + CreateTime time.Time `json:"create_time"` +} + +// voiceRanking 是一个声音描述的预置音色排名与试听台词 +// 约束:ready 关闭后 voices、line 与 err 只读;next 由 voiceRankings.mu 保护 +type voiceRanking struct { + ready chan struct{} + voices []string + line string + err error + next int +} + +// voiceRankings 按“TTS 模型 + 描述”记住预置音色排名,同一描述的创建请求依次取排名中的下一个音色 +// 约束:mu 保护 entries 与各项的 next +type voiceRankings struct { + mu sync.Mutex + entries map[string]*voiceRanking +} + +// voiceStore 是自定义声音目录:每个声音为 .json 与试听音频 .wav +// 约束:mu 保护目录中文件的写入与删除 +type voiceStore struct { + dir string + mu sync.Mutex +} + +// list 返回全部自定义声音,最新的在前 +func (store *voiceStore) list() ([]storedVoice, error) { + entries, err := os.ReadDir(store.dir) + if errors.Is(err, os.ErrNotExist) { + return nil, nil + } + if err != nil { + return nil, err + } + voices := make([]storedVoice, 0, len(entries)) + for _, entry := range entries { + if entry.IsDir() || filepath.Ext(entry.Name()) != ".json" { + continue + } + voice, err := store.get(strings.TrimSuffix(entry.Name(), ".json")) + if err != nil { + return nil, err + } + voices = append(voices, voice) + } + slices.SortFunc(voices, func(a, b storedVoice) int { return b.CreateTime.Compare(a.CreateTime) }) + return voices, nil +} + +// get 读取一个自定义声音 +func (store *voiceStore) get(id string) (storedVoice, error) { + var voice storedVoice + if !strings.HasPrefix(id, "voice_") || strings.ContainsAny(id, `/\.`) { + return voice, errVoiceNotFound + } + data, err := os.ReadFile(filepath.Join(store.dir, id+".json")) + if errors.Is(err, os.ErrNotExist) { + return voice, errVoiceNotFound + } + if err != nil { + return voice, err + } + return voice, json.Unmarshal(data, &voice) +} + +// sample 读取自定义声音的试听音频 +func (store *voiceStore) sample(id string) ([]byte, error) { + return os.ReadFile(filepath.Join(store.dir, id+".wav")) +} + +// save 写入一个自定义声音与它的试听音频 +func (store *voiceStore) save(voice storedVoice, sample []byte) error { + store.mu.Lock() + defer store.mu.Unlock() + if err := os.MkdirAll(store.dir, 0o755); err != nil { + return err + } + data, err := json.MarshalIndent(voice, "", " ") + if err != nil { + return err + } + if err := os.WriteFile(filepath.Join(store.dir, voice.ID+".wav"), sample, 0o644); err != nil { + return err + } + return os.WriteFile(filepath.Join(store.dir, voice.ID+".json"), data, 0o644) +} + +// remove 删除一个自定义声音 +func (store *voiceStore) remove(id string) error { + if _, err := store.get(id); err != nil { + return err + } + store.mu.Lock() + defer store.mu.Unlock() + if err := os.Remove(filepath.Join(store.dir, id+".json")); err != nil { + return err + } + if err := os.Remove(filepath.Join(store.dir, id+".wav")); err != nil && !errors.Is(err, os.ErrNotExist) { + return err + } + return nil +} + +// voiceID 去掉声音资源名的 voices/ 前缀 +func voiceID(name string) string { + return strings.TrimPrefix(strings.TrimSpace(name), "voices/") +} + +// storedVoiceID 表示声音 ID 是 Gemini API 已存声音或声音复刻密钥的格式 +func storedVoiceID(id string) bool { + return strings.HasPrefix(id, "voice_") || strings.HasPrefix(id, "voicekey_") +} + +// generate 把语音请求中的自定义声音改写为预置音色加风格提示后交给生成服务 +func (s *server) generate(ctx context.Context, request aistudio.GenerateRequest) (<-chan aistudio.Event, error) { + if request.Config.SpeechConfig != nil { + resolved, err := s.resolveVoices(ctx, request) + if err != nil { + return nil, err + } + request = resolved + } + return s.service.Generate(ctx, request) +} + +// resolveVoices 把单人与多人语音配置中的自定义声音换成它的预置音色,多人的“说话人: 台词”文本在支持分段风格的模型上先拆成分段,再把声音描述写入对应台词的风格;其余 voice_ 与 voicekey_ 标识照官网写入 VoiceConfig.voice +func (s *server) resolveVoices(ctx context.Context, request aistudio.GenerateRequest) (aistudio.GenerateRequest, error) { + speech := *request.Config.SpeechConfig + speech.Speakers = slices.Clone(speech.Speakers) + personas := map[string]string{} + resolve := func(name, voice *string, speaker string) error { + id := voiceID(cmp.Or(*name, *voice)) + if !storedVoiceID(id) { + return nil + } + stored, err := s.voices.get(id) + if errors.Is(err, errVoiceNotFound) { + *name, *voice = "", id + return nil + } + if err != nil { + return err + } + *name, *voice = stored.BaseVoice, "" + personas[speaker] = stored.Input + return nil + } + if err := resolve(&speech.VoiceName, &speech.Voice, ""); err != nil { + return request, err + } + for index := range speech.Speakers { + if err := resolve(&speech.Speakers[index].VoiceName, &speech.Speakers[index].Voice, speech.Speakers[index].Speaker); err != nil { + return request, err + } + } + request.Config.SpeechConfig = &speech + if len(personas) == 0 { + return request, nil + } + segmented := request.Contents + if len(speech.Speakers) > 0 { + models, err := s.service.Models(ctx) + if err != nil { + return request, err + } + if model, _ := LookupPublicModel(s.searchModels(models), request.Model); model.Capabilities["speech_metadata"] { + segmented = aistudio.SplitSpeakerSegments(request.Contents, speech.Speakers) + } + } + contents := make([]aistudio.Content, len(segmented)) + for index, content := range segmented { + content.Parts = slices.Clone(content.Parts) + for partIndex, part := range content.Parts { + if part.Text == "" || content.Role == aistudio.RoleAssistant { + continue + } + speaker := "" + if part.SpeechMetadata != nil { + speaker = part.SpeechMetadata.Speaker + } + persona, ok := personas[speaker] + if !ok && len(speech.Speakers) == 0 { + persona, ok = personas[""] + } + if !ok { + continue + } + metadata := aistudio.SpeechMetadata{} + if part.SpeechMetadata != nil { + metadata = *part.SpeechMetadata + } + metadata.Style = strings.TrimSpace(persona + "\n" + metadata.Style) + part.SpeechMetadata = &metadata + content.Parts[partIndex] = part + } + contents[index] = content + } + request.Contents = contents + return request, nil +} + +// voiceObject 是 Gemini API Voice 资源,base_voice 是生成时使用的预置音色 +type voiceObject struct { + ID string `json:"id"` + Type string `json:"type"` + DisplayName string `json:"display_name,omitempty"` + Description string `json:"description,omitempty"` + Model string `json:"model,omitempty"` + LanguageCode string `json:"language_code,omitempty"` + RegionCode string `json:"region_code,omitempty"` + Accent string `json:"accent,omitempty"` + Gender string `json:"gender,omitempty"` + Pitch string `json:"pitch,omitempty"` + Persona string `json:"persona,omitempty"` + Context string `json:"context,omitempty"` + Prompted *promptedVoice `json:"prompted,omitempty"` + SampleAudio *voiceAudioData `json:"sample_audio,omitempty"` + BaseVoice string `json:"base_voice,omitempty"` + CreateTime string `json:"create_time,omitempty"` +} + +// promptedVoice 是 Voice Design 的自然语言描述 +type promptedVoice struct { + Input string `json:"input"` +} + +// voiceAudioData 是 Gemini API AudioData +type voiceAudioData struct { + Data []byte `json:"data"` + MIMEType string `json:"mime_type"` +} + +// customVoiceObject 返回自定义声音的 Voice 资源,sample 非空时带试听音频 +func customVoiceObject(voice storedVoice, sample []byte) voiceObject { + object := voiceObject{ + ID: voice.ID, Type: "prompted", DisplayName: voice.DisplayName, Model: "models/" + voice.Model, + LanguageCode: voice.LanguageCode, Prompted: &promptedVoice{Input: voice.Input}, BaseVoice: voice.BaseVoice, + CreateTime: voice.CreateTime.UTC().Format(time.RFC3339), + } + if len(sample) > 0 { + object.SampleAudio = &voiceAudioData{Data: sample, MIMEType: "audio/wav"} + } + return object +} + +// voicePitches 把目录音高归入 Gemini API 的 low、medium、high +var voicePitches = map[string]string{ + "deep": "low", "lower": "low", "low": "low", "lower middle": "low", "medium-low": "low", + "middle": "medium", "medium": "medium", + "medium-high": "high", "high": "high", "higher": "high", "very high": "high", +} + +// prebuiltVoiceObject 返回目录音色的 Voice 资源 +func prebuiltVoiceObject(voice aistudio.VoiceDetail) voiceObject { + gender := strings.ToLower(voice.Gender) + switch gender { + case "masculine": + gender = "male" + case "feminine": + gender = "female" + } + _, region, _ := strings.Cut(voice.Locale, "-") + return voiceObject{ + ID: voice.Name, Type: "prebuilt", DisplayName: voice.Name, Description: strings.Join(voice.Descriptions, " "), + LanguageCode: voice.Locale, RegionCode: region, Accent: voice.Accent, Gender: gender, + Pitch: voicePitches[strings.ToLower(voice.Pitch)], Persona: voice.Trait, Context: voice.UseCase, + } +} + +// voiceDesignModel 返回 Voice Design 使用的 TTS 模型:请求指定的模型,未指定时为目录中第一个支持分段风格的语音模型 +func voiceDesignModel(models []aistudio.Model, requested string) (aistudio.Model, error) { + requested = strings.TrimPrefix(strings.TrimSpace(requested), "models/") + for _, model := range models { + if requested != "" && (model.ID == requested || model.Name == "models/"+requested) { + if !model.Capabilities["speech_route"] { + return aistudio.Model{}, fmt.Errorf("model %q does not generate speech", requested) + } + return model, nil + } + if requested == "" && model.Capabilities["speech_metadata"] && model.Capabilities["speech_route"] { + return model, nil + } + } + if requested != "" { + return aistudio.Model{}, fmt.Errorf("model %q is not in the model catalog", requested) + } + return aistudio.Model{}, fmt.Errorf("the model catalog has no TTS model that supports voice design") +} + +// handleVoiceList 返回自定义声音(最新的在前)与 Voice Design 模型的目录音色,按 Gemini API ListVoices 的条件筛选与分页 +// 目录音色来自生成服务的模型目录,生成服务未启动时只列出自定义声音 +func (s *server) handleVoiceList(w http.ResponseWriter, r *http.Request) { + custom, err := s.voices.list() + if err != nil { + writeGeminiError(w, http.StatusInternalServerError, "INTERNAL", err.Error()) + return + } + voices := make([]voiceObject, 0, len(custom)) + for _, voice := range custom { + voices = append(voices, customVoiceObject(voice, nil)) + } + if models, err := s.service.Models(r.Context()); err == nil { + if model, err := voiceDesignModel(models, ""); err == nil { + for _, voice := range model.VoiceDetails { + voices = append(voices, prebuiltVoiceObject(voice)) + } + } + } + query := r.URL.Query() + matches := func(values []string, value string) bool { + return len(values) == 0 || slices.ContainsFunc(values, func(item string) bool { return strings.EqualFold(item, value) }) + } + search := strings.ToLower(strings.TrimSpace(query.Get("search"))) + filtered := voices[:0] + for _, voice := range voices { + description := voice.Description + if voice.Prompted != nil { + description = voice.Prompted.Input + } + if matches(query["language_code"], voice.LanguageCode) && matches(query["region_code"], voice.RegionCode) && + matches(query["accent"], voice.Accent) && matches(query["gender"], voice.Gender) && matches(query["pitch"], voice.Pitch) && + matches(query["persona"], voice.Persona) && matches(query["context"], voice.Context) && matches(query["type"], voice.Type) && + (search == "" || strings.Contains(strings.ToLower(voice.DisplayName), search) || strings.Contains(strings.ToLower(description), search)) { + filtered = append(filtered, voice) + } + } + page, next, err := geminiPage(query, filtered, 50, 1000) + if err != nil { + writeGeminiError(w, http.StatusBadRequest, "INVALID_ARGUMENT", err.Error()) + return + } + response := map[string]any{"voices": page} + if next != "" { + response["next_page_token"] = next + } + writeJSON(w, http.StatusOK, response) +} + +// handleVoiceGet 返回一个自定义声音与它的试听音频 +func (s *server) handleVoiceGet(w http.ResponseWriter, r *http.Request) { + id := voiceID(r.PathValue("voice")) + voice, err := s.voices.get(id) + if err != nil { + writeVoiceError(w, id, err) + return + } + sample, err := s.voices.sample(id) + if err != nil { + writeGeminiError(w, http.StatusInternalServerError, "INTERNAL", err.Error()) + return + } + writeJSON(w, http.StatusOK, customVoiceObject(voice, sample)) +} + +// handleVoiceDelete 删除一个自定义声音 +func (s *server) handleVoiceDelete(w http.ResponseWriter, r *http.Request) { + id := voiceID(r.PathValue("voice")) + if err := s.voices.remove(id); err != nil { + writeVoiceError(w, id, err) + return + } + writeJSON(w, http.StatusOK, map[string]any{}) +} + +// writeVoiceError 写入声音查询与删除的错误,声音不存在时返回 404 +func writeVoiceError(w http.ResponseWriter, id string, err error) { + if errors.Is(err, errVoiceNotFound) { + writeGeminiError(w, http.StatusNotFound, "NOT_FOUND", fmt.Sprintf("Voice voices/%s was not found.", id)) + return + } + writeGeminiError(w, http.StatusInternalServerError, "INTERNAL", err.Error()) +} + +// handleVoiceCreate 按 Gemini API CreateVoice 创建 prompted 声音:挑选最贴近描述的预置音色,以描述为风格生成试听音频后保存 +func (s *server) handleVoiceCreate(w http.ResponseWriter, r *http.Request) { + var request struct { + Store *bool `json:"store"` + Voice struct { + Type string `json:"type"` + DisplayName string `json:"display_name"` + Model string `json:"model"` + LanguageCode string `json:"language_code"` + Prompted *promptedVoice `json:"prompted"` + Replicated json.RawMessage `json:"replicated"` + } `json:"voice"` + } + if err := decodeJSON(r, &request); err != nil { + writeGeminiError(w, http.StatusBadRequest, "INVALID_ARGUMENT", fmt.Sprintf("Invalid JSON payload: %v", err)) + return + } + switch strings.ToLower(strings.TrimSpace(request.Voice.Type)) { + case "prompted": + case "replicated": + writeGeminiError(w, http.StatusBadRequest, "FAILED_PRECONDITION", "Voice replication runs on the Gemini API paid tier and is not available with Google AI plan accounts; create a prompted voice instead.") + return + default: + writeGeminiError(w, http.StatusBadRequest, "INVALID_ARGUMENT", `voice.type must be "prompted".`) + return + } + input := "" + if request.Voice.Prompted != nil { + input = strings.TrimSpace(request.Voice.Prompted.Input) + } + if input == "" { + writeGeminiError(w, http.StatusBadRequest, "INVALID_ARGUMENT", "voice.prompted.input is required.") + return + } + if request.Store != nil && !*request.Store { + writeGeminiError(w, http.StatusBadRequest, "INVALID_ARGUMENT", `store must be true when voice.type is "prompted".`) + return + } + models, err := s.service.Models(r.Context()) + if err != nil { + if shouldWriteRequestError(r, err) { + writeGeminiRequestError(w, err) + } + return + } + model, err := voiceDesignModel(models, request.Voice.Model) + if err != nil { + writeGeminiError(w, http.StatusBadRequest, "INVALID_ARGUMENT", err.Error()) + return + } + base, line, err := s.pickVoice(r.Context(), model, input) + if err != nil { + if shouldWriteRequestError(r, err) { + writeGeminiRequestError(w, err) + } + return + } + sample, err := s.voiceSample(r.Context(), model.ID, base, input, line, request.Voice.LanguageCode) + if err != nil { + if shouldWriteRequestError(r, err) { + writeGeminiRequestError(w, err) + } + return + } + random := make([]byte, 8) + _, _ = rand.Read(random) + voice := storedVoice{ + ID: "voice_" + hex.EncodeToString(random), DisplayName: cmp.Or(strings.TrimSpace(request.Voice.DisplayName), "Custom Voice"), + Input: input, BaseVoice: base, Model: model.ID, LanguageCode: strings.TrimSpace(request.Voice.LanguageCode), CreateTime: time.Now(), + } + if err := s.voices.save(voice, sample); err != nil { + writeGeminiError(w, http.StatusInternalServerError, "INTERNAL", err.Error()) + return + } + writeJSON(w, http.StatusOK, customVoiceObject(voice, sample)) +} + +// pickVoice 返回这次创建使用的预置音色与试听台词:同一描述首次创建时排名,之后的创建依次取排名中的下一个音色 +func (s *server) pickVoice(ctx context.Context, model aistudio.Model, input string) (string, string, error) { + key := model.ID + "\n" + input + rankings := &s.voiceRankings + rankings.mu.Lock() + ranking, found := rankings.entries[key] + if !found { + ranking = &voiceRanking{ready: make(chan struct{})} + if rankings.entries == nil { + rankings.entries = map[string]*voiceRanking{} + } + rankings.entries[key] = ranking + } + rankings.mu.Unlock() + if !found { + ranking.voices, ranking.line, ranking.err = s.rankVoices(ctx, model, input) + if ranking.err != nil { + rankings.mu.Lock() + delete(rankings.entries, key) + rankings.mu.Unlock() + } + close(ranking.ready) + } + <-ranking.ready + if ranking.err != nil { + return "", "", ranking.err + } + rankings.mu.Lock() + defer rankings.mu.Unlock() + voice := ranking.voices[ranking.next%len(ranking.voices)] + ranking.next++ + return voice, ranking.line, nil +} + +// rankVoices 让文本模型从 TTS 模型的目录音色中选出最贴近描述的三个互不相同的预置音色,并写一句符合人设、与描述同语言的试听台词 +// 约束:模型给出的不同音色不足三个时,依次补入与第一个音色同性别、再其余的目录音色 +func (s *server) rankVoices(ctx context.Context, model aistudio.Model, input string) ([]string, string, error) { + names := make([]string, 0, len(model.VoiceDetails)) + var catalog strings.Builder + for _, voice := range model.VoiceDetails { + names = append(names, voice.Name) + fmt.Fprintf(&catalog, "%s | %s | pitch %s | %s | %s | %s\n", voice.Name, voice.Gender, voice.Pitch, voice.Accent, strings.Join(voice.Descriptions, " "), voice.Trait) + } + if len(names) == 0 { + return nil, "", fmt.Errorf("model %s has no prebuilt voices", model.ID) + } + encoded, _ := json.Marshal(names) + count := min(3, len(names)) + schema := fmt.Sprintf(`{"type":"object","properties":{"voices":{"type":"array","items":{"type":"string","enum":%s},"minItems":%d,"maxItems":%d},"sample":{"type":"string"}},"required":["voices","sample"]}`, encoded, count, count) + prompt := fmt.Sprintf("Choose the %d different prebuilt TTS voices whose gender, age, pitch and timbre best match the voice description, best match first. ", count) + + "Also write one or two short sentences this character would say to introduce themselves, in the same language as the description.\n\n" + + "Voice description:\n" + input + "\n\nPrebuilt voices (name | gender | pitch | accent | description | trait):\n" + catalog.String() + events, err := s.service.Generate(ctx, aistudio.GenerateRequest{ + ID: newID("voice"), Unary: true, Model: voicePickModel, + Contents: []aistudio.Content{{Role: aistudio.RoleUser, Parts: []aistudio.Part{{Text: prompt}}}}, + Config: aistudio.GenerationConfig{ResponseMIMEType: "application/json", ResponseSchema: json.RawMessage(schema)}, + }) + if err != nil { + return nil, "", err + } + result, err := consumeEvents(ctx, events) + if err != nil { + return nil, "", err + } + var output struct { + Voices []string `json:"voices"` + Sample string `json:"sample"` + } + _ = json.Unmarshal(result.text.Bytes(), &output) + ranked := make([]string, 0, count) + for _, name := range output.Voices { + if slices.Contains(names, name) && !slices.Contains(ranked, name) { + ranked = append(ranked, name) + } + } + if len(ranked) == 0 { + return nil, "", fmt.Errorf("AI Studio returned no prebuilt voice for the description: %q", result.text.String()) + } + gender := model.VoiceDetails[slices.Index(names, ranked[0])].Gender + for _, sameGender := range []bool{true, false} { + for _, voice := range model.VoiceDetails { + if len(ranked) < count && (voice.Gender == gender) == sameGender && !slices.Contains(ranked, voice.Name) { + ranked = append(ranked, voice.Name) + } + } + } + return ranked, cmp.Or(strings.TrimSpace(output.Sample), voiceSampleText), nil +} + +// voiceSample 以描述为风格、在预置音色上生成试听台词,返回 WAV 音频 +func (s *server) voiceSample(ctx context.Context, model, base, input, line, language string) ([]byte, error) { + events, err := s.service.Generate(ctx, aistudio.GenerateRequest{ + ID: newID("voice"), Unary: true, Model: model, + Contents: []aistudio.Content{{Role: aistudio.RoleUser, Parts: []aistudio.Part{{Text: line, SpeechMetadata: &aistudio.SpeechMetadata{Style: input}}}}}, + Config: aistudio.GenerationConfig{ + ResponseModalities: []aistudio.ResponseModality{aistudio.ResponseModalityAudio}, + SpeechConfig: &aistudio.SpeechConfig{VoiceName: base, LanguageCode: language}, + }, + }) + if err != nil { + return nil, err + } + result, err := consumeEvents(ctx, events) + if err != nil { + return nil, err + } + media, err := joinedAudio(result.media) + if err != nil { + return nil, err + } + data, _, err := encodeSpeechResponse(media, "wav") + return data, err +} diff --git a/internal/app/admin.go b/internal/app/admin.go index e987ff5c..e17db0cf 100644 --- a/internal/app/admin.go +++ b/internal/app/admin.go @@ -264,10 +264,7 @@ func (admin *runtimeAdmin) CreateAccount(ctx context.Context, input api.AccountC if savedID == "" { return false, nil } - admin.requests.logStage(savedLabel, "INFO", api.LogStage{Name: "账户添加", Step: 3, Steps: 3}, "核对账户验证状态") - target, done := admin.accountCommit() - defer done() - return target.verifyAccountNow(checkCtx, savedID, updated) + return admin.checkAccountVerification(checkCtx, api.LogStage{Name: "账户添加", Step: 3, Steps: 3}, savedLabel, savedID, updated) }, OnVerifyStep: func(step string) { reportAccountVerifyStep(ctx, step) }, }) @@ -1154,10 +1151,7 @@ func (admin *runtimeAdmin) LoginAccount(ctx context.Context, accountID string, v return nil } request.CheckVerification = func(checkCtx context.Context, updated aistudio.StorageState) (bool, error) { - admin.requests.logStage(label, "INFO", api.LogStage{Name: "账户登录", Step: 3, Steps: 3}, "核对账户验证状态") - target, done := admin.accountCommit() - defer done() - return target.verifyAccountNow(checkCtx, accountID, updated) + return admin.checkAccountVerification(checkCtx, api.LogStage{Name: "账户登录", Step: 3, Steps: 3}, label, accountID, updated) } request.OnVerifyStep = func(step string) { reportAccountVerifyStep(ctx, step) } result, err := admin.login.Login(ctx, request) @@ -1232,10 +1226,7 @@ func (admin *runtimeAdmin) VerifyAccount(ctx context.Context, accountID string, Timezone: account.Config.Timezone, View: view, CheckVerification: func(checkCtx context.Context, updated aistudio.StorageState) (bool, error) { - admin.requests.logStage(label, "INFO", api.LogStage{Name: "账户验证", Step: 2, Steps: 2}, "核对账户验证状态") - target, done := admin.accountCommit() - defer done() - return target.verifyAccountNow(checkCtx, accountID, updated) + return admin.checkAccountVerification(checkCtx, api.LogStage{Name: "账户验证", Step: 2, Steps: 2}, label, accountID, updated) }, OnVerifyStep: func(step string) { reportAccountVerifyStep(ctx, step) }, }) @@ -1266,6 +1257,18 @@ func reportAccountVerifyStep(ctx context.Context, step string) { } } +// checkAccountVerification 执行一次账户验证状态核对,核对本身失败时写入 WARN 日志 +func (admin *runtimeAdmin) checkAccountVerification(checkCtx context.Context, stage api.LogStage, label string, accountID string, updated aistudio.StorageState) (bool, error) { + admin.requests.logStage(label, "INFO", stage, "核对账户验证状态") + target, done := admin.accountCommit() + defer done() + needVerify, err := target.verifyAccountNow(checkCtx, accountID, updated) + if err != nil && checkCtx.Err() == nil { + admin.requests.logStage(label, "WARN", stage, "账户验证核对失败", "error", err) + } + return needVerify, err +} + // verifiedAccount 在后台同步账户目录并核对一次验证状态,立即返回账户 func (admin *runtimeAdmin) verifiedAccount(account *aistudio.Account) (api.AdminAccount, error) { admin.cancelTransition(account.ID) @@ -1688,6 +1691,7 @@ func adminAccountDTO(status aistudio.AccountStatus) api.AdminAccount { TransitionStep: string(status.TransitionStep), TransitionIndex: status.TransitionIndex, TransitionTotal: status.TransitionTotal, VerificationRequired: status.VerificationRequired, DeviceBoundSession: status.DeviceBoundSession && !hasPairingRenewal(status.Directory), + MigratedModels: status.MigratedModels, } if status.Transition != "" { account.TransitionSince = &status.TransitionSince @@ -1756,14 +1760,6 @@ func (admin *runtimeAdmin) UpdateRuntimeConfig(_ context.Context, value api.Runt if err != nil { return api.RuntimeConfig{}, invalidConfigError(fmt.Errorf("REQUEST_TIMEOUT 无效: %w", err)) } - switchInterval := strings.ToLower(strings.TrimSpace(value.AccountSwitchInterval)) - if switchInterval == "" { - switchInterval = config.AccountSwitchIntervalOff - } - maxQuotaSwitches := strings.ToLower(strings.TrimSpace(value.MaxQuotaSwitches)) - if maxQuotaSwitches == "" { - maxQuotaSwitches = config.MaxQuotaSwitchesOff - } cfg := config.Config{ AutoStart: value.AutoStart, HideDockIcon: value.HideDockIcon, @@ -1783,8 +1779,8 @@ func (admin *runtimeAdmin) UpdateRuntimeConfig(_ context.Context, value api.Runt RoutingStrategy: value.RoutingStrategy, AccountOrder: strings.TrimSpace(value.AccountOrder), MaxAccountSwitches: value.MaxAccountSwitches, - AccountSwitchInterval: switchInterval, - MaxQuotaSwitches: maxQuotaSwitches, + AccountSwitchInterval: strings.ToLower(strings.TrimSpace(value.AccountSwitchInterval)), + MaxQuotaSwitches: strings.ToLower(strings.TrimSpace(value.MaxQuotaSwitches)), UpstreamChannels: value.UpstreamChannels, ModelMapping: strings.TrimSpace(value.ModelMapping), ModelChannels: strings.TrimSpace(value.ModelChannels), @@ -1793,6 +1789,8 @@ func (admin *runtimeAdmin) UpdateRuntimeConfig(_ context.Context, value api.Runt WAABackend: value.WAABackend, MediaOutput: strings.ToLower(strings.TrimSpace(value.MediaOutput)), MediaBaseURL: strings.TrimSpace(value.MediaBaseURL), + BuildChatModels: value.BuildChatModels, HideModels: strings.TrimSpace(value.HideModels), + GenerateContentAccounts: strings.TrimSpace(value.GenerateContentAccounts), SillyTavernAPIKeys: strings.TrimSpace(value.SillyTavernAPIKeys), }.KeepEnvironment(saved) if err := cfg.Validate(); err != nil { return api.RuntimeConfig{}, invalidConfigError(err) @@ -2153,6 +2151,8 @@ func runtimeConfigDTO(cfg config.Config) api.RuntimeConfig { MediaBaseURL: cfg.MediaBaseURL, Environment: append([]string{}, cfg.Environment...), Invalid: invalidConfigDTO(cfg.Invalid), + BuildChatModels: cfg.BuildChatModels, HideModels: cfg.HideModels, + GenerateContentAccounts: cfg.GenerateContentAccounts, SillyTavernAPIKeys: cfg.SillyTavernAPIKeys, } } diff --git a/internal/app/app.go b/internal/app/app.go index 25e85d44..74549c3b 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -265,13 +265,13 @@ func runServer(ctx context.Context, cfg config.Config, manager *runtimeManager, manager.previewAddress = previewListener.Addr().String() manager.settings.Store(requestSettingsOf(manager.currentConfig())) apiHandler := api.NewHandler(manager, api.Config{ - APIKey: cfg.ProxyAPIKey, APIKeys: manager.currentAPIKey, Admin: manager, Ledger: manager.ledger, Prompts: manager.prompts, Updates: updater, + APIKeys: manager.currentAPIKey, Admin: manager, Ledger: manager.ledger, Prompts: manager.prompts, Updates: updater, AdminAuthEnabled: cfg.AdminAuthEnabled, AdminUsername: cfg.AdminUsername, AdminPassword: cfg.AdminPassword, AdminSessionPath: filepath.Join("runtime", "admin-sessions.json"), MediaDir: filepath.Join("runtime", "media"), MediaLimit: mediaLimit, MediaLinks: manager.mediaLinks, ResponseModes: manager.responseModes, WaitLaunch: manager.WaitLaunch, SearchSettings: manager.searchSettings, EgressProxy: manager.egressProxy, States: manager.states, - PickPath: manager.pickPath, + PickPath: manager.pickPath, VoicesDir: filepath.Join("runtime", "voices"), }) server := &http.Server{ Handler: rootHandler(apiHandler), diff --git a/internal/app/bidi.go b/internal/app/bidi.go index f3451e1f..61ce8127 100644 --- a/internal/app/bidi.go +++ b/internal/app/bidi.go @@ -15,6 +15,10 @@ func (service *trackedService) OpenBidi(ctx context.Context, request aistudio.Bi request.Model = service.mappedModel(request.Model) api.SetAccessLogTarget(ctx, request.Model, "") request.Model = service.catalogModelID(ctx, request.Model) + if err := service.modelUnavailable(request.Model); err != nil { + api.SetAccessLogError(ctx, err) + return nil, err + } requestCtx, cancel, err := service.bidiRequestContext(ctx) if err != nil { api.SetAccessLogError(ctx, err) diff --git a/internal/app/embeddings.go b/internal/app/embeddings.go index 816fe41e..194c695d 100644 --- a/internal/app/embeddings.go +++ b/internal/app/embeddings.go @@ -16,6 +16,10 @@ func (service *trackedService) Embed(ctx context.Context, request aistudio.Embed api.StartAccessLog(ctx) request.Model = service.catalogModelID(ctx, request.Model) modelID := strings.TrimPrefix(strings.TrimSpace(request.Model), "models/") + if err := service.modelUnavailable(request.Model); err != nil { + api.SetAccessLogError(ctx, err) + return aistudio.EmbeddingResult{}, err + } requestCtx, cancel, err := service.dataRequestContext(ctx) if err != nil { api.SetAccessLogError(ctx, err) diff --git a/internal/app/hedge.go b/internal/app/hedge.go index cfe162b4..f56d36bb 100644 --- a/internal/app/hedge.go +++ b/internal/app/hedge.go @@ -122,10 +122,10 @@ func percentile95(waits []time.Duration) time.Duration { return waits[(len(waits)*95+99)/100-1] } -// canHedge 判断请求是否允许在等待首事件超时后发起备用请求,后台任务、助手模型与开启回复工具的请求不发起备用请求 +// canHedge 判断请求是否允许在等待首事件超时后发起备用请求,后台任务与助手模型不发起备用请求,回复工具按每次尝试实际是否启用判断 func (service *trackedService) canHedge(request aistudio.GenerateRequest, assistant bool, modelID string) bool { policy := service.currentFirstEventPolicy() - return !request.Background && !assistant && !request.ReplyTool && + return !request.Background && !assistant && (policy.hedgeAuto || policy.hedgeAfter > 0) && slices.Contains(policy.hedgeModels, modelID) } @@ -157,8 +157,8 @@ func (service *trackedService) hedgeSelections(primary aistudio.AccountSelection return []aistudio.AccountSelection{other, same} } -// tryHedgeLease 按顺序立即取得备用请求的租约:其他账户只用 Worker 已就绪且没有活动请求的,原账户用其余并发槽位;都没有时返回 nil -func (service *trackedService) tryHedgeLease(ctx context.Context, selections []aistudio.AccountSelection) (*aistudio.AccountLease, aistudio.AccountSelection) { +// tryHedgeLease 按顺序立即取得不会启用回复工具的备用请求租约:其他账户只用 Worker 已就绪且没有活动请求的,原账户用其余并发槽位;都没有时返回 nil +func (service *trackedService) tryHedgeLease(ctx context.Context, selections []aistudio.AccountSelection, request aistudio.GenerateRequest, modelID string) (*aistudio.AccountLease, aistudio.AccountSelection) { for _, selection := range selections { if selection.AccountID == "" && len(selection.AllowedAccountIDs) == 0 { continue @@ -171,12 +171,21 @@ func (service *trackedService) tryHedgeLease(ctx context.Context, selections []a if selection.AccountID != "" { idle = append(slices.Clone(idle), groups.WarmAvailable...) } - if len(idle) == 0 { - continue - } - selection.AllowedAccountIDs = idle - if lease, _, err := service.pool.TryAcquireFor(ctx, selection); err == nil { - return lease, selection + for len(idle) > 0 { + selection.AllowedAccountIDs = idle + lease, _, err := service.pool.TryAcquireFor(ctx, selection) + if err != nil { + break + } + if !lease.ReplyToolActive(request, modelID) { + return lease, selection + } + rejectedID := lease.Account().ID + _ = lease.Release() + if selection.AccountID != "" { + break + } + idle = slices.DeleteFunc(slices.Clone(idle), func(id string) bool { return id == rejectedID }) } } return nil, aistudio.AccountSelection{} @@ -218,7 +227,7 @@ func (service *trackedService) awaitFirstEvent( primaryDone = nil check = nil if primary.err == nil { - if !request.ReplyTool { + if !primary.replyTool { service.requests.firstEvents.observe(modelID, string(primary.lease.Channel()), primary.firstAt, primary.firstAt.Sub(primary.startedAt)) } if hedgeDone != nil { @@ -233,7 +242,7 @@ func (service *trackedService) awaitFirstEvent( if hedge.err == nil { waited := time.Since(primary.startedAt) if primaryDone != nil { - if !request.ReplyTool { + if !primary.replyTool { service.requests.firstEvents.observe(modelID, string(primary.lease.Channel()), time.Now(), waited) } service.supersede(requestCtx, request.ID, primary, "备用请求先返回首事件") @@ -249,7 +258,7 @@ func (service *trackedService) awaitFirstEvent( check = time.After(schedulingRecheck) continue } - lease, selection := service.tryHedgeLease(requestCtx, plan.selections) + lease, selection := service.tryHedgeLease(requestCtx, plan.selections, request, modelID) if lease == nil { service.hedges.Add(-1) check = time.After(schedulingRecheck) diff --git a/internal/app/lifecycle.go b/internal/app/lifecycle.go index 86664430..1fbeff30 100644 --- a/internal/app/lifecycle.go +++ b/internal/app/lifecycle.go @@ -5,6 +5,7 @@ import ( "errors" "net/http" "reflect" + "slices" "sync" "sync/atomic" "time" @@ -433,6 +434,8 @@ type requestSettings struct { replyTool bool userMessageRewrite string thinkingGuard bool + // sillyTavernKeys 是 For SillyTavern 各项生效的 API key,为空时对全部请求生效 + sillyTavernKeys []string } // requestSettingsOf 返回 cfg 中只决定新请求行为的设置 @@ -446,9 +449,15 @@ func requestSettingsOf(cfg config.Config) *requestSettings { replyTool: cfg.ReplyTool, userMessageRewrite: cfg.UserMessageRewrite, thinkingGuard: cfg.ThinkingGuard, + sillyTavernKeys: config.ScopedAPIKeys(cfg.SillyTavernAPIKeys, cfg.ProxyAPIKey), } } +// sillyTavern 判断请求所用的 API key 是否在 For SillyTavern 各项的生效范围内 +func (settings *requestSettings) sillyTavern(ctx context.Context) bool { + return len(settings.sillyTavernKeys) == 0 || slices.Contains(settings.sillyTavernKeys, aistudio.APIKeyFromContext(ctx)) +} + // responseModes 返回已保存的非流式保活与假流式设置 func (manager *runtimeManager) responseModes() api.ResponseModes { return manager.settings.Load().modes @@ -498,7 +507,7 @@ func (manager *runtimeManager) CountTokens(ctx context.Context, request aistudio // Generate 由当前生成服务生成事件流 func (manager *runtimeManager) Generate(ctx context.Context, request aistudio.GenerateRequest) (<-chan aistudio.Event, error) { - if settings := manager.settings.Load(); settings != nil { + if settings := manager.settings.Load(); settings != nil && settings.sillyTavern(ctx) { request.ReplyTool = request.ReplyTool || settings.replyTool if request.UserMessageRewrite == "" { request.UserMessageRewrite = settings.userMessageRewrite @@ -816,62 +825,6 @@ func (manager *runtimeManager) RuntimeConfig(ctx context.Context) (api.RuntimeCo return value, err } -// configFromDTO 把管理接口配置对象转换为内部 Config,供测试替身未落盘时使用 -func configFromDTO(value api.RuntimeConfig) config.Config { - initTimeout, _ := time.ParseDuration(value.InitTimeout) - requestTimeout, _ := time.ParseDuration(value.RequestTimeout) - return config.Config{ - AutoStart: value.AutoStart, - HideDockIcon: value.HideDockIcon, - RequestBodyLog: value.RequestBodyLog, - LogFile: value.LogFile, - LogMaxTotalMB: value.LogMaxTotalMB, - AdminAuthEnabled: value.AdminAuthEnabled, - AdminUsername: value.AdminUsername, - AdminPassword: value.SavedAdminPassword, - BuildNativeNonstream: value.BuildNativeNonstream, - NonstreamKeepalive: value.NonstreamKeepalive, - FakeStream: value.FakeStream, - YouTubeLinks: value.YouTubeLinks, - SearchModelAliases: value.SearchModelAliases, - DiscoverHiddenModels: value.DiscoverHiddenModels, - GoogleSearch: value.GoogleSearch, - StripThoughtSignatures: value.StripThoughtSignatures, - ContinuationRewrite: value.ContinuationRewrite, - ContinuationPrompt: value.ContinuationPrompt, - ReplyTool: value.ReplyTool, - UserMessageRewrite: value.UserMessageRewrite, - ThinkingGuard: value.ThinkingGuard, - FirstEventHedge: value.FirstEventHedge, - FirstEventHedgeModels: value.FirstEventHedgeModels, - FirstEventTimeout: value.FirstEventTimeout, - AuthStates: value.AuthStates, - ListenAddr: value.ListenAddr, - PreviewListenAddr: value.PreviewListenAddr, - ProxyAPIKey: value.APIKey, - Proxy: value.Proxy, - InitTimeout: initTimeout, - RequestTimeout: requestTimeout, - WarmWorkerLimit: value.WarmWorkerLimit, - MaxActiveWorkers: value.MaxActiveWorkers, - WarmStartupConcurrency: value.WarmStartupConcurrency, - PerAccountConcurrency: value.PerAccountConcurrency, - RoutingStrategy: value.RoutingStrategy, - AccountOrder: value.AccountOrder, - MaxAccountSwitches: value.MaxAccountSwitches, - AccountSwitchInterval: value.AccountSwitchInterval, - MaxQuotaSwitches: value.MaxQuotaSwitches, - UpstreamChannels: value.UpstreamChannels, - ModelMapping: value.ModelMapping, - ModelChannels: value.ModelChannels, - ModelAccounts: value.ModelAccounts, - APIKeyAccounts: value.APIKeyAccounts, - WAABackend: value.WAABackend, - MediaOutput: value.MediaOutput, - MediaBaseURL: value.MediaBaseURL, - } -} - // UpdateRuntimeConfig 保存生成服务配置,除必须重建生成服务或重启程序的极少数项外,其余设置均对下一次请求立即生效 func (manager *runtimeManager) UpdateRuntimeConfig(ctx context.Context, value api.RuntimeConfig) (api.RuntimeConfig, error) { manager.configMu.Lock() @@ -882,15 +835,9 @@ func (manager *runtimeManager) UpdateRuntimeConfig(ctx context.Context, value ap if err != nil { return updated, err } - var saved config.Config - if manager.configPath != "" { - var loadErr error - saved, loadErr = config.Load(manager.configPath) - if loadErr != nil { - return updated, loadErr - } - } else { - saved = configFromDTO(updated) + saved, err := config.Load(manager.configPath) + if err != nil { + return updated, err } manager.overrides.Apply(&saved) manager.setAPIKey(saved.ProxyAPIKey) diff --git a/internal/app/model_visibility.go b/internal/app/model_visibility.go new file mode 100644 index 00000000..6229a889 --- /dev/null +++ b/internal/app/model_visibility.go @@ -0,0 +1,75 @@ +package app + +import ( + "fmt" + "slices" + "strings" + + "github.com/Mag1cFall/AIStudio2API/internal/aistudio" + "github.com/Mag1cFall/AIStudio2API/internal/config" +) + +// modelVisibility 是公开 API 中提供哪些模型的设置 +type modelVisibility struct { + // buildChatModels 表示提供 Build 对话模型(-build) + buildChatModels bool + // hidden 是不在公开 API 中提供的目录模型 ID + hidden map[string]bool +} + +// modelVisibilityOf 返回 cfg 中公开 API 提供哪些模型的设置 +func modelVisibilityOf(cfg config.Config) *modelVisibility { + hidden := make(map[string]bool) + for _, id := range config.ModelList(cfg.HideModels) { + hidden[id] = true + } + return &modelVisibility{buildChatModels: cfg.BuildChatModels, hidden: hidden} +} + +// currentVisibility 返回之后的请求使用的模型可见性设置 +func (service *trackedService) currentVisibility() modelVisibility { + if visibility := service.visibility.Load(); visibility != nil { + return *visibility + } + return modelVisibility{} +} + +// visibleModels 去掉不在公开 API 中提供的模型:隐藏名单中的目录模型,Build 对话模型关闭时的 -build 模型 +func (service *trackedService) visibleModels(models []aistudio.Model) []aistudio.Model { + visibility := service.currentVisibility() + return slices.DeleteFunc(models, func(model aistudio.Model) bool { + return visibility.hidden[model.ID] || !visibility.buildChatModels && aistudio.IsAssistantModelID(model.ID) + }) +} + +// modelUnavailable 返回已换算到目录 ID 的请求模型 model 因设置不在公开 API 中提供时的错误,可用时返回 nil +func (service *trackedService) modelUnavailable(model string) error { + visibility := service.currentVisibility() + model = strings.TrimPrefix(strings.TrimSpace(model), "models/") + switch { + case !visibility.buildChatModels && aistudio.IsAssistantModelID(model): + return &modelHiddenError{model: model, build: true} + case visibility.hidden[model]: + return &modelHiddenError{model: model} + } + return nil +} + +// modelHiddenError 是请求的模型已在设置中设为不在公开 API 中提供的错误,按模型不存在返回 +type modelHiddenError struct { + model string + // build 表示模型是 Build 对话模型且 Build 对话模型已关闭 + build bool +} + +func (err *modelHiddenError) Error() string { + if err.build { + return fmt.Sprintf("Build 对话模型 %s 已在设置中关闭", err.model) + } + return fmt.Sprintf("模型 %s 已在设置中隐藏", err.model) +} + +// Is 让 errors.Is 把它视为 aistudio.ErrModelNotFound +func (err *modelHiddenError) Is(target error) bool { + return target == aistudio.ErrModelNotFound +} diff --git a/internal/app/request_logging.go b/internal/app/request_logging.go index 7bca62e4..f19e63ac 100644 --- a/internal/app/request_logging.go +++ b/internal/app/request_logging.go @@ -103,7 +103,7 @@ func requestRow(entry api.AccessLog, finished time.Time) requestdb.Row { data, _, _ := finishedRequestLog(entry) row := requestdb.Row{ ID: entry.RequestID, Time: finished, Protocol: requestProtocol(entry.Path), Path: entry.Path, - Model: entry.Model, Account: entry.Account, Channel: entry.Channel, Status: entry.Status, State: data.State, + Model: entry.Model, Account: entry.Account, Channel: entry.Channel, APIKey: entry.APIKey, Status: entry.Status, State: data.State, Duration: entry.Latency, FirstEvent: entry.FirstEvent, Queue: entry.QueueWait, Proof: entry.Proof, ToolCalls: entry.ToolCalls, ReplyTool: entry.ReplyTool, ReplyToolCalls: entry.ReplyToolCalls, ReplyToolContinuations: entry.ReplyToolContinuations, Error: cmp.Or(data.Error, entry.TrailingError), diff --git a/internal/app/runtime.go b/internal/app/runtime.go index 328bf3c2..0bb9546e 100644 --- a/internal/app/runtime.go +++ b/internal/app/runtime.go @@ -128,7 +128,7 @@ func newRuntime( service.refresher = refresher service.sharedGlobalProxy = &sharedGlobalProxy service.ApplyHotConfig(cfg) - service.discoverHiddenModels = cfg.DiscoverHiddenModels + service.discoverHiddenModels.Store(cfg.DiscoverHiddenModels) if camoufoxPath != "" { service.camoufoxWait = make(chan struct{}) } @@ -160,8 +160,8 @@ type firstEventPolicy struct { // trackedService 跟踪生成请求及其唯一账户租约 type trackedService struct { - buildNativeNonstream bool - hotBuildNative atomic.Pointer[bool] + // buildNativeNonstream 表示非流式请求优先使用 Build 原生单次调用,保存设置后立即替换 + buildNativeNonstream atomic.Bool pooled *aistudio.PooledService transport *aistudio.MakerSuiteHTTPTransport protected *aistudio.WorkerProtectedTransport @@ -175,8 +175,6 @@ type trackedService struct { pool *aistudio.AccountPool requests *requestRegistry workers *accountWorkerManager - timeout time.Duration - hotTimeout atomic.Pointer[time.Duration] state atomic.Int32 lifecycleMu sync.Mutex transitionDone chan struct{} @@ -201,11 +199,6 @@ type trackedService struct { catalogRoundDone chan struct{} // catalogRoundWake 让巡检循环立即开始请求缺少模型时排定的一轮 catalogRoundWake chan struct{} - // hedgeAuto、hedgeAfter、hedgeModels 与 firstEventTimeout 保留为未调用 ApplyHotConfig 时的测试兼容回退字段 - hedgeAuto bool - hedgeAfter time.Duration - hedgeModels []string - firstEventTimeout time.Duration // firstEventPolicy 是保存设置后立即替换的首字超时与备用请求策略快照 firstEventPolicy atomic.Pointer[firstEventPolicy] // hedges 是正在进行的备用请求数 @@ -220,18 +213,20 @@ type trackedService struct { modelMapping atomic.Pointer[[]config.ModelAlias] // disconnects 记录各模型与通道最近的请求终态,判断成片断连 disconnects disconnectTracker - // discoverHiddenModels 表示同步账户目录时探测官网隐藏模型(未热更新前的初始值);热更新后以 hotDiscoverHidden 为准 - discoverHiddenModels bool - hotDiscoverHidden atomic.Pointer[bool] + // discoverHiddenModels 表示同步账户目录时探测官网隐藏模型,保存设置后立即替换 + discoverHiddenModels atomic.Bool + // visibility 是 BUILD_CHAT_MODELS 与 HIDE_MODELS 决定的公开模型范围,保存设置后立即替换 + visibility atomic.Pointer[modelVisibility] // camoufoxWait 在 Camoufox 后端的启动开始等待 Camoufox 下载时关闭,SpiderMonkey 后端为 nil camoufoxWait chan struct{} - // camoufoxProxy 是未绑定 sharedGlobalProxy 时 Camoufox 下载使用的兼容回退代理 - camoufoxProxy string // step 是生成服务正在进行的启动或停止步骤,没有时为 nil,取值见 api.AdminStatus.Transition // 约束:启动步骤在持有 lifecycleMu 且服务仍在启动时写入,停止步骤由停止流程写入 step atomic.Pointer[serviceStep] // publishStatus 向管理页推送生成服务状态快照 publishStatus func() + // timeout 是上游连续没有数据时结束请求的时长,保存设置后立即替换 + // 单位:纳秒 + timeout atomic.Int64 } // serviceStep 是生成服务的一个启动或停止步骤与进入该步骤的时刻 @@ -259,10 +254,10 @@ func newTrackedService( catalog := service.(modelCatalogService) tracked := &trackedService{ lifecycle: lifecycle, service: service, catalog: catalog, pool: pool, requests: requests, workers: workers, - timeout: timeout, modelRetries: make(map[string]struct{}), catalogRoundWake: make(chan struct{}, 1), publishStatus: func() {}, } + tracked.timeout.Store(int64(timeout)) tracked.SetRequestPolicy(nil, config.DefaultMaxAccountSwitches) return tracked } @@ -349,12 +344,12 @@ func (service *trackedService) ApplyHotConfig(cfg config.Config) { ContinuationPrompt: cfg.ContinuationPrompt, }) } - buildNative := cfg.BuildNativeNonstream - service.hotBuildNative.Store(&buildNative) + service.buildNativeNonstream.Store(cfg.BuildNativeNonstream) if cfg.RequestTimeout > 0 { - timeout := cfg.RequestTimeout - service.hotTimeout.Store(&timeout) + service.timeout.Store(int64(cfg.RequestTimeout)) } + service.visibility.Store(modelVisibilityOf(cfg)) + service.pool.SetGenerateContentAccounts(config.AccountList(cfg.GenerateContentAccounts)) if cfg.InitTimeout > 0 { if service.workers != nil { service.workers.SetInitTimeout(cfg.InitTimeout) @@ -378,33 +373,17 @@ func (service *trackedService) ApplyHotConfig(cfg config.Config) { service.SetSwitchPolicy(switchInterval, quotaLimit, quotaLimited) } -// useBuildNativeNonstream 返回非流式请求是否优先使用 Build 原生单次调用 -func (service *trackedService) useBuildNativeNonstream() bool { - if value := service.hotBuildNative.Load(); value != nil { - return *value - } - return service.buildNativeNonstream -} - -// currentFirstEventPolicy 返回当前生效的首字超时与备用请求策略快照 +// currentFirstEventPolicy 返回当前生效的首字超时与备用请求策略快照,未设置时为零值 func (service *trackedService) currentFirstEventPolicy() firstEventPolicy { if policy := service.firstEventPolicy.Load(); policy != nil { return *policy } - return firstEventPolicy{ - hedgeAuto: service.hedgeAuto, - hedgeAfter: service.hedgeAfter, - hedgeModels: service.hedgeModels, - firstEventTimeout: service.firstEventTimeout, - } + return firstEventPolicy{} } // requestTimeout 返回后续请求使用的无数据超时时长 func (service *trackedService) requestTimeout() time.Duration { - if timeout := service.hotTimeout.Load(); timeout != nil { - return *timeout - } - return service.timeout + return time.Duration(service.timeout.Load()) } // switchInterval 返回同一请求内换号前的最短等待间隔,未启用时为 0 @@ -419,7 +398,7 @@ func (service *trackedService) currentCamoufoxProxy() string { return *proxy } } - return service.camoufoxProxy + return "" } // setSharedGlobalProxy 同步更新生成服务内部各传输、续签器与 Worker 管理器持有的默认出口代理 @@ -498,21 +477,12 @@ func (service *trackedService) applyUpstreamChannels(channels []string) { // isDiscoverHiddenModels 返回当前是否开启官网隐藏模型探测 func (service *trackedService) isDiscoverHiddenModels() bool { - if value := service.hotDiscoverHidden.Load(); value != nil { - return *value - } - return service.discoverHiddenModels + return service.discoverHiddenModels.Load() } // applyDiscoverHiddenModels 热切换官网隐藏模型探测:关闭时立即从目录剥离并持久化,开启时在运行中后台增量探测 func (service *trackedService) applyDiscoverHiddenModels(enabled bool) { - next := enabled - prevPtr := service.hotDiscoverHidden.Swap(&next) - previous := service.discoverHiddenModels - if prevPtr != nil { - previous = *prevPtr - } - if previous == enabled { + if service.discoverHiddenModels.Swap(enabled) == enabled { return } if !enabled { @@ -1033,7 +1003,7 @@ func (service *trackedService) Models(context.Context) ([]aistudio.Model, error) if len(models) == 0 && service.state.Load() != serviceRunning { return nil, service.stoppedError() } - return service.withAliases(service.pool.PublicModels(models)), nil + return service.withAliases(service.visibleModels(service.pool.PublicModels(models))), nil } // withAliases 把 MODEL_MAPPING 中目标在目录内的别名加入公开目录,字段取自目标模型,与目录 ID 同名的别名替换该条目,同名别名以先写的为准 @@ -1744,6 +1714,9 @@ func (service *trackedService) CountTokens(ctx context.Context, request aistudio return aistudio.TokenCount{}, err } request.Model = service.catalogModelID(ctx, model) + if err := service.modelUnavailable(request.Model); err != nil { + return aistudio.TokenCount{}, err + } requestCtx, cancel, err := service.observedDataRequestContext(ctx, request.Model) if err != nil { return aistudio.TokenCount{}, err @@ -1770,6 +1743,9 @@ func (service *trackedService) GenerateTitle(ctx context.Context, request aistud // GenerateImage 生成 Imagen 图片并登记请求目标与账户 func (service *trackedService) GenerateImage(ctx context.Context, request aistudio.ImageRequest) ([]aistudio.GeneratedImage, error) { request.Model = service.catalogModelID(ctx, service.mappedModel(request.Model)) + if err := service.modelUnavailable(request.Model); err != nil { + return nil, err + } requestCtx, cancel, err := service.observedDataRequestContext(ctx, request.Model) if err != nil { return nil, err @@ -1784,6 +1760,9 @@ func (service *trackedService) GenerateImage(ctx context.Context, request aistud // CreateDecision 回答决策问题并登记请求目标与账户,每次请求在运行日志中提醒该模型在 AI Studio 官网中隐藏 func (service *trackedService) CreateDecision(ctx context.Context, request aistudio.DecisionRequest) (aistudio.DecisionResult, error) { request.Model = service.catalogModelID(ctx, service.mappedModel(request.Model)) + if err := service.modelUnavailable(request.Model); err != nil { + return aistudio.DecisionResult{}, err + } requestCtx, cancel, err := service.observedDataRequestContext(ctx, request.Model) if err != nil { return aistudio.DecisionResult{}, err @@ -1801,6 +1780,10 @@ func (service *trackedService) GenerateVideo(ctx context.Context, request aistud request.Model = service.mappedModel(request.Model) api.SetAccessLogTarget(ctx, request.Model, "") request.Model = service.catalogModelID(ctx, request.Model) + if err := service.modelUnavailable(request.Model); err != nil { + api.SetAccessLogError(ctx, err) + return aistudio.VideoOperation{}, err + } requestCtx, cancel, err := service.dataRequestContext(ctx) if err != nil { api.SetAccessLogError(ctx, err) @@ -2024,8 +2007,13 @@ func (service *trackedService) acquireWarmLease(ctx context.Context, selection a // 会话粘性没有指定账户时先选没有请求在等待或生成 proof 的账户,同账户的 proof 不排队 var lease *aistudio.AccountLease var acquireErr error - if idle := service.pool.WithoutPendingProofs(warmAvailable); len(idle) > 0 && len(idle) < len(warmAvailable) && - !slices.Contains(warmAvailable, selection.PreferredAccountID) { + hasPreferred := false + if selection.PreferIdlePage { + hasPreferred = service.pool.HasPreferredIdlePage(selection, warmAvailable) + } else if selection.PreferredAccountID != "" { + hasPreferred = slices.Contains(warmAvailable, selection.PreferredAccountID) + } + if idle := service.pool.WithoutPendingProofs(warmAvailable); len(idle) > 0 && len(idle) < len(warmAvailable) && !hasPreferred { candidate.AllowedAccountIDs = idle lease, _, acquireErr = service.pool.TryAcquireFor(ctx, candidate) candidate.AllowedAccountIDs = warmAvailable @@ -2374,6 +2362,11 @@ func (service *trackedService) Generate(ctx context.Context, request aistudio.Ge err = suffixErr cancel() } + if err == nil { + if err = service.modelUnavailable(request.Model); err != nil { + cancel() + } + } if err == nil && aistudio.RequestBuildOnly(request) && !service.pool.BuildEnabled() { err = fmt.Errorf("%w: File Search 只能经 Build 通道发送,UPSTREAM_CHANNELS 没有启用 build", aistudio.ErrInvalidArgument) cancel() @@ -2432,6 +2425,8 @@ type generateAttempt struct { quotaFailures int // interaction 是租约账户与通道对该模型的 Interaction 选路 interaction aistudio.InteractionRouting + // replyTool 表示本次尝试在租约账户与通道上实际是否启用回复工具 + replyTool bool } // generateRetry 是生成请求跨尝试的换号与恢复状态 @@ -2504,11 +2499,9 @@ func (service *trackedService) generateWithRetry( preferredAccountID := "" if assistant { preferredAccountID = service.service.(aistudio.AssistantService).AssistantAccount(requestCtx, request) - } else { - preferredAccountID = service.pool.InlineMediaAccount(request.Contents) } fePolicy := service.currentFirstEventPolicy() - buildNativeNonstream := service.useBuildNativeNonstream() + buildNativeNonstream := service.buildNativeNonstream.Load() hedgeable := service.canHedge(request, assistant, modelID) hedged := false var winner *generateAttempt @@ -2571,6 +2564,12 @@ func (service *trackedService) generateWithRetry( } } } + if !assistant { + if preferred := service.pool.InlineMediaAccounts(request.Contents, selection.AllowedAccountIDs); len(preferred) > 0 { + selection.PreferredAccountIDs = preferred + selection.PreferIdlePage = true + } + } if len(retry.attempted) > 0 { service.requests.markQueued(request.ID, request.AccountID) } @@ -2623,7 +2622,7 @@ func (service *trackedService) generateWithRetry( } var cooling *aistudio.AllCoolingError switch { - case err != nil && errors.Is(acquireErr, aistudio.ErrNoEligibleAccount): + case err != nil && aistudio.NoMoreEligibleAccounts(acquireErr): case retry.attemptFailure != nil && errors.As(acquireErr, &cooling): err = retry.attemptFailure case retry.quotaReason != "" && errors.As(acquireErr, &cooling): @@ -2656,7 +2655,7 @@ func (service *trackedService) generateWithRetry( service.requests.logRequestProgress(request.ID, accountLabel, "INFO", "等待上游响应") primary := service.startAttempt(requestCtx, request, resourceID, modelID, fallbackReason, lease, selection, false, retry.failures, retry.quotaFailures, fePolicy.firstEventTimeout) var plan *hedgePlan - if hedgeable && !primary.interaction.IsAgent() && !hedged { + if hedgeable && !primary.interaction.IsAgent() && !primary.replyTool && !hedged { if delay, ok := service.hedgeDelay(modelID, string(lease.Channel())); ok { fixed := resourceID != "" || requestedAccountID != "" plan = &hedgePlan{delay: delay, selections: service.hedgeSelections(selection, lease.Account().ID, fixed, retry.attempted)} @@ -2816,11 +2815,12 @@ func (service *trackedService) startAttempt( unbound := strings.TrimSpace(request.AccountID) == "" && resourceID == "" request.AccountID = lease.Account().ID interaction := lease.InteractionRoute(modelID) + replyTool := lease.ReplyToolActive(request, modelID) attempt := &generateAttempt{ lease: lease, selection: selection, hedge: hedge, unbound: unbound, accountLabel: lease.Account().Config.Label, proxy: service.proxies.Binding(request.AccountID), workerGeneration: service.workers.WorkerGeneration(request.AccountID), startedAt: time.Now(), activity: &upstreamActivity{}, done: make(chan struct{}), failures: failures, quotaFailures: quotaFailures, - interaction: interaction, + interaction: interaction, replyTool: replyTool, } attempt.serving.Store(lease) attemptCtx, cancel := context.WithCancelCause(requestCtx) @@ -2869,6 +2869,7 @@ func (service *trackedService) runAttempt( } originalContents := request.Contents ctx = aistudio.ContextWithAccountLease(ctx, lease) + ctx = aistudio.ContextWithPageModel(ctx, modelID) ctx = aistudio.ContextWithUpstreamModeObserver(ctx, service.upstreamModeObserver(request.ID, lease, fallbackReason)) var err error copiedFileCount := 0 @@ -2889,12 +2890,24 @@ func (service *trackedService) runAttempt( } if err == nil && mediaCount > 0 { uploadStartedAt := time.Now() + var mediaTiming aistudio.InlineMediaTiming + uploadCtx := aistudio.ContextWithInlineMediaTiming(ctx, &mediaTiming) request.Contents, attempt.copies, err = service.service.(interface { UploadInlineMediaToLease(context.Context, *aistudio.AccountLease, []aistudio.Content, *aistudio.TemporaryFileCopies, bool) ([]aistudio.Content, *aistudio.TemporaryFileCopies, error) - }).UploadInlineMediaToLease(ctx, lease, request.Contents, attempt.copies, attempt.interaction.IsModel()) + }).UploadInlineMediaToLease(uploadCtx, lease, request.Contents, attempt.copies, attempt.interaction.IsModel()) + mediaFields := []any{ + "attachments", mediaCount, + "bytes", fmt.Sprintf("%d B", mediaBytes), + "duration", time.Since(uploadStartedAt), + "token_folder", mediaTiming.TokenFolder, + "media_upload", mediaTiming.Upload, + "reused", mediaTiming.Reused, + "uploaded", mediaTiming.Uploaded, + } if err == nil { - service.requests.logRequestProgress(request.ID, accountLabel, "INFO", "内联附件处理完成", - "attachments", mediaCount, "bytes", fmt.Sprintf("%d B", mediaBytes), "duration", time.Since(uploadStartedAt)) + service.requests.logRequestProgress(request.ID, accountLabel, "INFO", "内联附件处理完成", mediaFields...) + } else { + service.requests.logRequestProgress(request.ID, accountLabel, "WARN", "内联附件处理失败", append(mediaFields, "error", err)...) } } prepareStartedAt := time.Now() @@ -3028,6 +3041,9 @@ func (service *trackedService) continuationAccount(ctx context.Context, requestI } lease, acquireErr := service.acquireWarmLease(ctx, selection, false, &attempt.failures, new(time.Duration)) if acquireErr != nil { + if aistudio.NoMoreEligibleAccounts(acquireErr) { + return nil, aistudio.ErrNoEligibleAccount + } return nil, acquireErr } attempt.serving.Store(lease) diff --git a/internal/app/transcriptions.go b/internal/app/transcriptions.go index 8012e33e..d0f48dda 100644 --- a/internal/app/transcriptions.go +++ b/internal/app/transcriptions.go @@ -21,6 +21,11 @@ func (service *trackedService) Transcribe( api.StartAccessLog(ctx) request.Model = service.catalogModelID(ctx, request.Model) requestCtx, cancel, err := service.dataRequestContext(ctx) + if err == nil { + if err = service.modelUnavailable(request.Model); err != nil { + cancel() + } + } if err != nil { api.SetAccessLogError(ctx, err) service.requests.start(aistudio.GenerateRequest{ID: request.ID, Model: request.Model}, func() {}) diff --git a/internal/camoufoxnative/generate.go b/internal/camoufoxnative/generate.go index 9dd80802..75768284 100644 --- a/internal/camoufoxnative/generate.go +++ b/internal/camoufoxnative/generate.go @@ -832,6 +832,7 @@ func (worker *Worker) openChat() { worker.chatOpening = false if err == nil && !closed && !stale { worker.chats = append(worker.chats, tab) + worker.syncReadyPages() } else if err == nil && worker.selected == tab.contextID { worker.selected = "" } @@ -881,6 +882,7 @@ func (worker *Worker) releaseChat(tab *chatTab, completed bool) { reset := completed && !worker.closed && !retired if reset { tab.resetting = true + worker.syncReadyPages() } else { tab.busy = false worker.notifyChats() @@ -901,6 +903,7 @@ func (worker *Worker) resetChat(tab *chatTab) { worker.mu.Lock() closed := worker.closed tab.busy, tab.resetting = false, false + worker.syncReadyPages() worker.notifyChats() worker.mu.Unlock() worker.finishRequest(tab.contextID) diff --git a/internal/camoufoxnative/liveview.go b/internal/camoufoxnative/liveview.go index 886b7b00..8e59f00a 100644 --- a/internal/camoufoxnative/liveview.go +++ b/internal/camoufoxnative/liveview.go @@ -59,12 +59,13 @@ var errLiveViewReplaced = errors.New("登录窗口已在其他连接中打开") // LiveView 把无头隔离登录浏览器的画面推给管理页登录窗口,并把窗口中的输入转发给浏览器 type LiveView struct { - mu sync.Mutex - status string - frame *liveFrame - frameSeq int - dialog *liveDialog - dialogSeq int + mu sync.Mutex + status string + statusError string + frame *liveFrame + frameSeq int + dialog *liveDialog + dialogSeq int // contexts 为顶层页面,按打开顺序排列,画面取最后一个 contexts []string viewer *liveViewer @@ -143,14 +144,20 @@ func (view *LiveView) notify() { } } -// setStatus 更新登录阶段,view 为 nil 时不做任何事 +// setStatus 更新登录阶段并清除阶段提示错误,view 为 nil 时不做任何事 func (view *LiveView) setStatus(status string) { + view.setStatusWithError(status, "") +} + +// setStatusWithError 更新登录阶段与非致命核对失败原因,view 为 nil 时不做任何事 +func (view *LiveView) setStatusWithError(status, errText string) { if view == nil { return } view.mu.Lock() defer view.mu.Unlock() view.status = status + view.statusError = errText view.notify() } @@ -224,7 +231,7 @@ func (view *LiveView) enqueue(input liveInput) { // push 在状态变化时向登录窗口写出登录阶段、页面对话框与最新一帧画面 func (view *LiveView) push(ctx context.Context, connection *websocket.Conn, viewer *liveViewer) error { - status, frameSeq, dialogSeq := "", 0, 0 + status, statusError, frameSeq, dialogSeq := "", "", 0, 0 write := func(messageType int, data []byte) error { if err := connection.SetWriteDeadline(time.Now().Add(liveViewWriteTimeout)); err != nil { return err @@ -247,13 +254,17 @@ func (view *LiveView) push(ctx context.Context, connection *websocket.Conn, view case <-viewer.wake: } view.mu.Lock() - currentStatus, frame, currentFrame, dialog, currentDialog := view.status, view.frame, view.frameSeq, view.dialog, view.dialogSeq + currentStatus, currentError, frame, currentFrame, dialog, currentDialog := view.status, view.statusError, view.frame, view.frameSeq, view.dialog, view.dialogSeq view.mu.Unlock() - if currentStatus != status { - if err := writeJSON(map[string]any{"type": "status", "status": currentStatus}); err != nil { + if currentStatus != status || currentError != statusError { + message := map[string]any{"type": "status", "status": currentStatus} + if currentError != "" { + message["error"] = currentError + } + if err := writeJSON(message); err != nil { return err } - status = currentStatus + status, statusError = currentStatus, currentError } if currentDialog != dialogSeq { if err := writeJSON(map[string]any{"type": "dialog", "dialog": dialog}); err != nil { diff --git a/internal/camoufoxnative/login.go b/internal/camoufoxnative/login.go index 113e075d..81f1d61e 100644 --- a/internal/camoufoxnative/login.go +++ b/internal/camoufoxnative/login.go @@ -309,6 +309,7 @@ func (session *loginSession) waitVerification( view.setStatus(liveViewVerifying) reportVerifyStep(onStep, "verify") var latest []byte + lastCheckError := "" sawVerifyPage := false checkedAppPage := false lastCheck := time.Now() @@ -344,21 +345,27 @@ func (session *loginSession) waitVerification( } else if loginBrowserExit(exportErr) != nil || ctx.Err() != nil { return true, latest, nil } - view.setStatus(liveViewChecking) + view.setStatusWithError(liveViewChecking, lastCheckError) reportVerifyStep(onStep, "verifying") needVerify, checkErr := check(ctx, latest) lastCheck = time.Now() if checkErr == nil && !needVerify { + view.setStatus(liveViewChecking) return false, latest, nil } if ctx.Err() != nil { return true, latest, nil } + if checkErr != nil { + lastCheckError = checkErr.Error() + } else { + lastCheckError = "" + } if leftVerify { sawVerifyPage = false checkedAppPage = true } - view.setStatus(liveViewVerifying) + view.setStatusWithError(liveViewVerifying, lastCheckError) reportVerifyStep(onStep, "verify") } if waitContext(ctx, 300*time.Millisecond) != nil { diff --git a/internal/camoufoxnative/startup_cache.go b/internal/camoufoxnative/startup_cache.go index 43717c6c..8348e302 100644 --- a/internal/camoufoxnative/startup_cache.go +++ b/internal/camoufoxnative/startup_cache.go @@ -21,6 +21,9 @@ func restoreStartupCache(cacheDirectory, profile string) { // saveStartupCache 用浏览器退出后 profile 中的启动缓存替换账户缓存目录中保存的副本 func saveStartupCache(profile, cacheDirectory string) { + if _, err := os.Stat(cacheDirectory); err != nil { + return + } if _, err := os.Stat(filepath.Join(profile, "startupCache")); err != nil { return } diff --git a/internal/camoufoxnative/worker.go b/internal/camoufoxnative/worker.go index 8aaecd08..abe4c20e 100644 --- a/internal/camoufoxnative/worker.go +++ b/internal/camoufoxnative/worker.go @@ -65,6 +65,8 @@ type Worker struct { tabs map[string]*tabUse // chats 是可运行界面对话的标签页,第一个是当前页面所在的标签页 chats []*chatTab + // readyPages 是当前未重置的可立即接收请求的界面对话标签页数,供选号路径无锁读取 + readyPages atomic.Int32 // chatsChanged 在界面对话标签页空出或新开结束时关闭 chatsChanged chan struct{} // chatOpening 表示正在后台新开界面对话标签页,chatOpenErr 是最近一次新开失败的原因 @@ -444,6 +446,7 @@ func (worker *Worker) abort() error { return nil } worker.closed = true + worker.syncReadyPages() connection := worker.connection process := worker.process worker.mu.Unlock() @@ -516,6 +519,7 @@ func (worker *Worker) switchTab(contextID string, loaded loadedPage) error { worker.reloads++ worker.contextID, worker.page, worker.state, worker.pageCatalog = contextID, loaded.page, loaded.state, loaded.catalog worker.chats = []*chatTab{{contextID: contextID, page: loaded.page}} + worker.syncReadyPages() if previous != contextID || worker.selected == "" { worker.selected = contextID } @@ -676,6 +680,7 @@ func (worker *Worker) Close() error { } worker.mu.Lock() worker.closed = true + worker.syncReadyPages() worker.mu.Unlock() return nil } @@ -694,6 +699,7 @@ func (worker *Worker) Retire() { return } worker.closed = true + worker.syncReadyPages() worker.mu.Unlock() directory := worker.options.CacheDirectory if directory != "" { @@ -800,9 +806,30 @@ func (worker *Worker) bootstrap(ctx context.Context, options Options, storage st } worker.page, worker.state, worker.pageCatalog = loaded.page, loaded.state, loaded.catalog worker.chats, worker.selected = []*chatTab{{contextID: contextID, page: loaded.page}}, contextID + worker.syncReadyPages() return nil } +// syncReadyPages 按当前未重置的界面对话标签页数更新 readyPages,调用方持有 mu +func (worker *Worker) syncReadyPages() { + if worker.closed { + worker.readyPages.Store(0) + return + } + ready := 0 + for _, tab := range worker.chats { + if !tab.resetting { + ready++ + } + } + worker.readyPages.Store(int32(ready)) +} + +// ReadyPages 返回当前可立即接收请求的界面对话标签页数 +func (worker *Worker) ReadyPages() int { + return int(worker.readyPages.Load()) +} + // loadedPage 是一次官网页面载入取得的 WAA 页面对象、页面状态与目录 RPC 响应 type loadedPage struct { page pageHandle diff --git a/internal/config/config.go b/internal/config/config.go index 7e2d624d..4ce29350 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -50,6 +50,8 @@ var configKeys = [...]string{ "MODEL_MAPPING", "MODEL_CHANNELS", "MODEL_ACCOUNTS", + "HIDE_MODELS", + "GENERATE_CONTENT_ACCOUNTS", "WAA_BACKEND", "MEDIA_OUTPUT", "MEDIA_BASE_URL", @@ -62,6 +64,7 @@ var configKeys = [...]string{ "ADMIN_USERNAME", "ADMIN_PASSWORD", "BUILD_NATIVE_NONSTREAM", + "BUILD_CHAT_MODELS", "NONSTREAM_KEEPALIVE", "FAKE_STREAM", "YOUTUBE_LINKS", @@ -77,6 +80,7 @@ var configKeys = [...]string{ "REPLY_TOOL", "USER_MESSAGE_REWRITE", "THINKING_GUARD", + "SILLYTAVERN_API_KEYS", } // LogFileMB 是单个日志文件的轮转大小 @@ -187,6 +191,14 @@ type Config struct { Invalid []InvalidValue // Environment 是取自进程环境变量、覆盖 .env 的配置键 Environment []string + // BuildChatModels 让公开 API 提供并接受 Build 对话模型(-build) + BuildChatModels bool + // HideModels 是不在公开 API 中提供的目录模型 ID,逗号分隔 + HideModels string + // GenerateContentAccounts 是被迁移到任务接口的模型改走 GenerateContent 的账户 ID,逗号分隔 + GenerateContentAccounts string + // SillyTavernAPIKeys 是 For SillyTavern 各项生效的 API key,逗号分隔,其中没有一个在 PROXY_API_KEY 中时对全部 key 生效 + SillyTavernAPIKeys string } // workerDefaultKeys 是默认值随 WAA 后端变化的键 @@ -299,13 +311,17 @@ var configSetters = map[string]func(*Config, string) error{ "MODEL_CHANNELS": textSetter(func(c *Config) *string { return &c.ModelChannels }, strings.TrimSpace), "MODEL_ACCOUNTS": textSetter(func(c *Config) *string { return &c.ModelAccounts }, strings.TrimSpace), "API_KEY_ACCOUNTS": textSetter(func(c *Config) *string { return &c.APIKeyAccounts }, strings.TrimSpace), - "WAA_BACKEND": setWAABackend, + "WAA_BACKEND": textSetter(func(c *Config) *string { return &c.WAABackend }, lowerTrim), "MEDIA_OUTPUT": textSetter(func(c *Config) *string { return &c.MediaOutput }, lowerTrim), "MEDIA_BASE_URL": textSetter(func(c *Config) *string { return &c.MediaBaseURL }, strings.TrimSpace), "UPSTREAM_CHANNELS": func(c *Config, value string) error { c.UpstreamChannels = parseUpstreamChannels(value) return nil }, + "BUILD_CHAT_MODELS": boolSetter("BUILD_CHAT_MODELS", func(c *Config) *bool { return &c.BuildChatModels }), + "HIDE_MODELS": textSetter(func(c *Config) *string { return &c.HideModels }, strings.TrimSpace), + "GENERATE_CONTENT_ACCOUNTS": textSetter(func(c *Config) *string { return &c.GenerateContentAccounts }, strings.TrimSpace), + "SILLYTAVERN_API_KEYS": textSetter(func(c *Config) *string { return &c.SillyTavernAPIKeys }, strings.TrimSpace), } func boolSetter(key string, field func(*Config) *bool) func(*Config, string) error { @@ -365,15 +381,6 @@ func setMaxAccountSwitches(c *Config, value string) error { return nil } -// setWAABackend 设置 WAA 后端,camoufox 以外的取值都使用 spidermonkey -func setWAABackend(c *Config, value string) error { - c.WAABackend = WAABackendSpiderMonkey - if lowerTrim(value) == WAABackendCamoufox { - c.WAABackend = WAABackendCamoufox - } - return nil -} - // configCheck 是一条配置校验与校验失败时改回默认值的键 type configCheck struct { keys []string @@ -520,17 +527,12 @@ var configChecks = []configCheck{ }}, } -// Load 从指定 env 文件和进程环境加载配置,取值无效的项改用默认值并记入 Invalid,没写的常驻预热账户数与启动并发取默认值且不超过活动 Worker 上限,两者都没有 WAA 后端时按账户状态目录确定后端并追加到文件 +// Load 从指定 env 文件和进程环境加载配置,取值无效的项改用默认值并记入 Invalid,没写的常驻预热账户数与启动并发取默认值且不超过活动 Worker 上限 func Load(path string) (Config, error) { - values, commented, err := readEnvFile(path) + values, err := readEnvFile(path) if err != nil { return Config{}, err } - if !commented && upgradeEnv(values) { - if err := writeEnv(path, values); err != nil { - return Config{}, err - } - } cfg := Default() for _, key := range configKeys { if value, ok := os.LookupEnv(key); ok { @@ -545,14 +547,6 @@ func Load(path string) (Config, error) { } } } - if _, ok := values["WAA_BACKEND"]; !ok { - if camoufoxOnlyAccounts(cfg.AuthStates) { - cfg.WAABackend = WAABackendCamoufox - } - if err := appendEnv(path, "WAA_BACKEND", cfg.WAABackend); err != nil { - return Config{}, err - } - } defaults := defaultsFor(cfg.WAABackend).envValues() for _, key := range workerDefaultKeys { if _, ok := values[key]; !ok { @@ -588,56 +582,6 @@ func Load(path string) (Config, error) { return cfg, nil } -// legacyEnvKeys 是 v0.2.18 及之前的版本保存设置时总会写出的键 -var legacyEnvKeys = []string{ - "AISTUDIO_AUTH_STATES", "LISTEN_ADDR", "PROXY_API_KEY", "PROXY", "INIT_TIMEOUT", "REQUEST_TIMEOUT", "WARM_WORKER_LIMIT", - "MAX_ACTIVE_WORKERS", "WARM_STARTUP_CONCURRENCY", "PER_ACCOUNT_CONCURRENCY", "ROUTING_STRATEGY", "UPSTREAM_CHANNELS", "WAA_BACKEND", -} - -// upgradeEnv 改写旧版本写出的没有注释的全量 .env:上游通道与请求超时的旧默认值改为当前值,WAA 后端保留为当前取值,删去其余等于默认值的键,返回是否改写 -func upgradeEnv(values map[string]string) bool { - if slices.ContainsFunc(legacyEnvKeys, func(key string) bool { - _, ok := values[key] - return !ok - }) { - return false - } - defaults := Default().envValues() - isDefault := func(key, value string) bool { - parsed := Default() - return configSetters[key](&parsed, value) == nil && parsed.envValues()[key] == defaults[key] - } - if slices.Equal(parseUpstreamChannels(values["UPSTREAM_CHANNELS"]), []string{"playground", "build"}) { - delete(values, "UPSTREAM_CHANNELS") - } - if timeout, err := time.ParseDuration(strings.TrimSpace(values["REQUEST_TIMEOUT"])); err == nil && timeout == 5*time.Minute { - delete(values, "REQUEST_TIMEOUT") - } - backend := Default() - configSetters["WAA_BACKEND"](&backend, values["WAA_BACKEND"]) - values["WAA_BACKEND"] = backend.WAABackend - for key, value := range values { - if key != "WAA_BACKEND" && isDefault(key, value) { - delete(values, key) - } - } - return true -} - -// camoufoxOnlyAccounts 判断账户状态目录中已有账户而都没有 SpiderMonkey 的解释器缓存,即账户只在 Camoufox 后端下运行过 -func camoufoxOnlyAccounts(authStates string) bool { - found := false - for _, directory := range strings.Split(authStates, ",") { - directory = strings.TrimSpace(directory) - if _, err := os.Stat(filepath.Join(directory, WAAInterpreterCacheName)); err == nil { - return false - } - accounts, _ := filepath.Glob(filepath.Join(directory, "*", "account.json")) - found = found || len(accounts) > 0 - } - return found -} - // KeepEnvironment 返回把进程环境变量决定的项及其无效记录取 saved 中的值后的配置 func (c Config) KeepEnvironment(saved Config) Config { values := saved.envValues() @@ -700,15 +644,20 @@ func (c Config) envValues() map[string]string { "WAA_BACKEND": c.WAABackend, "MEDIA_OUTPUT": c.MediaOutput, "MEDIA_BASE_URL": c.MediaBaseURL, + + "BUILD_CHAT_MODELS": strconv.FormatBool(c.BuildChatModels), + "HIDE_MODELS": c.HideModels, + "GENERATE_CONTENT_ACCOUNTS": c.GenerateContentAccounts, + "SILLYTAVERN_API_KEYS": c.SillyTavernAPIKeys, } } -// Save 将 WAA 后端与其余和默认值不同的配置原子写入指定 env 文件,进程环境变量决定的项保留文件中原有的值;文件中没有的常驻预热账户数与活动 Worker 上限仍等于原后端的默认值时不写入,随后端取默认值 +// Save 将与默认值不同的配置原子写入指定 env 文件,进程环境变量决定的项保留文件中原有的值;文件中没有的常驻预热账户数与活动 Worker 上限仍等于原后端的默认值时不写入,随后端取默认值 func (c Config) Save(path string) error { if err := c.Validate(); err != nil { return err } - saved, _, err := readEnvFile(path) + saved, err := readEnvFile(path) if err != nil { return err } @@ -726,8 +675,6 @@ func (c Config) Save(path string) error { if inFile { file[key] = saved[key] } - case key == "WAA_BACKEND": - file[key] = values[key] case slices.Contains(workerDefaultKeys, key) && !inFile && values[key] == previousDefaults[key]: case values[key] != defaults[key]: file[key] = values[key] @@ -750,18 +697,6 @@ func writeEnv(path string, values map[string]string) error { return atomicWrite(path, []byte(output.String()), 0o600) } -// appendEnv 在 env 文件末尾原子追加一个键,文件不存在时创建 -func appendEnv(path, key, value string) error { - content, err := os.ReadFile(path) - if err != nil && !os.IsNotExist(err) { - return fmt.Errorf("读取配置文件: %w", err) - } - if len(content) > 0 && content[len(content)-1] != '\n' { - content = append(content, '\n') - } - return atomicWrite(path, append(content, key+"="+formatEnvValue(value)+"\n"...), 0o600) -} - // Validate 校验配置值是否能用于服务启动 func (c Config) Validate() error { if c.AdminAuthEnabled && (strings.TrimSpace(c.AdminUsername) == "" || strings.TrimSpace(c.AdminPassword) == "") { @@ -913,6 +848,23 @@ func APIKeys(value string) []string { return keys } +// ScopedAPIKeys 返回 value 中逗号分隔、出现在 apiKeys 里的 key +func ScopedAPIKeys(value string, apiKeys string) []string { + keys := APIKeys(apiKeys) + return slices.DeleteFunc(APIKeys(value), func(key string) bool { return !slices.Contains(keys, key) }) +} + +// AccountList 返回逗号分隔、去掉空白与重复的账户 ID +func AccountList(value string) []string { + var ids []string + for id := range strings.SplitSeq(value, ",") { + if id = strings.TrimSpace(id); id != "" && !slices.Contains(ids, id) { + ids = append(ids, id) + } + } + return ids +} + // ParseModelMapping 解析逗号分隔的 别名:模型 ID,别名可含冒号,以最后一个冒号分隔 func ParseModelMapping(value string) ([]ModelAlias, error) { var mapping []ModelAlias @@ -1015,32 +967,27 @@ func ValidateProxy(value string) error { return nil } -// readEnvFile 读取 env 文件中的配置键,并返回文件是否含注释行 -func readEnvFile(path string) (map[string]string, bool, error) { +// readEnvFile 读取 env 文件中的配置键 +func readEnvFile(path string) (map[string]string, error) { values := make(map[string]string) - commented := false file, err := os.Open(path) if os.IsNotExist(err) { - return values, false, nil + return values, nil } if err != nil { - return nil, false, fmt.Errorf("读取配置文件: %w", err) + return nil, fmt.Errorf("读取配置文件: %w", err) } defer file.Close() scanner := bufio.NewScanner(file) for lineNumber := 1; scanner.Scan(); lineNumber++ { line := strings.TrimSpace(scanner.Text()) - if strings.HasPrefix(line, "#") { - commented = true - continue - } - if line == "" { + if line == "" || strings.HasPrefix(line, "#") { continue } key, raw, ok := strings.Cut(line, "=") if !ok { - return nil, false, fmt.Errorf("%s:%d 缺少等号", path, lineNumber) + return nil, fmt.Errorf("%s:%d 缺少等号", path, lineNumber) } key = strings.TrimSpace(key) if !slices.Contains(configKeys[:], key) { @@ -1048,14 +995,14 @@ func readEnvFile(path string) (map[string]string, bool, error) { } value, err := parseEnvValue(strings.TrimSpace(raw)) if err != nil { - return nil, false, fmt.Errorf("%s:%d: %w", path, lineNumber, err) + return nil, fmt.Errorf("%s:%d: %w", path, lineNumber, err) } values[key] = value } if err := scanner.Err(); err != nil { - return nil, false, fmt.Errorf("读取配置文件: %w", err) + return nil, fmt.Errorf("读取配置文件: %w", err) } - return values, commented, nil + return values, nil } func parseEnvValue(value string) (string, error) { diff --git a/internal/config/env_test.go b/internal/config/env_test.go index b7a1e511..a808b4ad 100644 --- a/internal/config/env_test.go +++ b/internal/config/env_test.go @@ -28,15 +28,24 @@ func readTestEnv(t *testing.T, path string) string { return string(data) } -// TestSaveWritesOnlyChangedKeys 核对保存写入 WAA 后端与其余和默认值不同的键,未写的键取当前默认值 +// TestSaveWritesOnlyChangedKeys 核对首次加载缺少 .env 时不创建文件,保存只写入与默认值不同的键,未写的键取当前默认值 func TestSaveWritesOnlyChangedKeys(t *testing.T) { + missing := filepath.Join(t.TempDir(), ".env") + fresh, err := Load(missing) + if err != nil || fresh.WAABackend != WAABackendSpiderMonkey { + t.Fatalf("fresh = %+v, err = %v", fresh, err) + } + if _, err := os.Stat(missing); !os.IsNotExist(err) { + t.Fatalf("加载不存在的 .env 创建了文件: %v", err) + } + path := writeTestEnv(t, "") cfg := Default() cfg.RoutingStrategy = "fill-first" if err := cfg.Save(path); err != nil { t.Fatal(err) } - if got := readTestEnv(t, path); got != "ROUTING_STRATEGY=fill-first\nWAA_BACKEND=spidermonkey\n" { + if got := readTestEnv(t, path); got != "ROUTING_STRATEGY=fill-first\n" { t.Fatalf(".env = %q", got) } loaded, err := Load(path) @@ -47,13 +56,14 @@ func TestSaveWritesOnlyChangedKeys(t *testing.T) { // TestLoadInvalidValueUsesDefault 核对取值无效的项按默认值加载并记录键与原值 func TestLoadInvalidValueUsesDefault(t *testing.T) { - path := writeTestEnv(t, "ROUTING_STRATEGY=fill-first\nMEDIA_OUTPUT=file\nPER_ACCOUNT_CONCURRENCY=abc\nWARM_WORKER_LIMIT=30\n") + path := writeTestEnv(t, "ROUTING_STRATEGY=fill-first\nMEDIA_OUTPUT=file\nPER_ACCOUNT_CONCURRENCY=abc\nWARM_WORKER_LIMIT=30\nWAA_BACKEND=go\n") cfg, err := Load(path) if err != nil { t.Fatal(err) } if cfg.MediaOutput != MediaOutputInline || cfg.PerAccountConcurrency != defaultAccountConcurrency || - cfg.WarmWorkerLimit != defaultWarmWorkerLimit || cfg.MaxActiveWorkers != defaultMaxActiveWorkers || cfg.RoutingStrategy != "fill-first" { + cfg.WarmWorkerLimit != defaultWarmWorkerLimit || cfg.MaxActiveWorkers != defaultMaxActiveWorkers || + cfg.WAABackend != WAABackendSpiderMonkey || cfg.RoutingStrategy != "fill-first" { t.Fatalf("cfg = %+v", cfg) } var keys []string @@ -61,7 +71,7 @@ func TestLoadInvalidValueUsesDefault(t *testing.T) { keys = append(keys, item.Key+"="+item.Value) } slices.Sort(keys) - if !slices.Equal(keys, []string{"MEDIA_OUTPUT=file", "PER_ACCOUNT_CONCURRENCY=abc", "WARM_WORKER_LIMIT=30"}) { + if !slices.Equal(keys, []string{"MEDIA_OUTPUT=file", "PER_ACCOUNT_CONCURRENCY=abc", "WAA_BACKEND=go", "WARM_WORKER_LIMIT=30"}) { t.Fatalf("invalid = %v", keys) } } @@ -87,7 +97,7 @@ func TestEnvironmentKeepsSavedFile(t *testing.T) { if err := update.Save(path); err != nil { t.Fatal(err) } - if got := readTestEnv(t, path); got != "ROUTING_STRATEGY=fill-first\nWAA_BACKEND=spidermonkey\nREQUEST_BODY_LOG=true\n" { + if got := readTestEnv(t, path); got != "ROUTING_STRATEGY=fill-first\nREQUEST_BODY_LOG=true\n" { t.Fatalf(".env = %q", got) } } diff --git a/internal/i18n/messages/de.json b/internal/i18n/messages/de.json index 2e9c42e8..2884ad81 100644 --- a/internal/i18n/messages/de.json +++ b/internal/i18n/messages/de.json @@ -1,5 +1,6 @@ { "%s 不可用": "{0} nicht verfügbar", + "%s 不接受 %s 工具": "{0} akzeptiert Werkzeug {1} nicht", "%s 之后没有可监听的端口": "Nach {0} gibt es keinen Port, auf dem gelauscht werden kann", "%s 已停用": "{0} deaktiviert", "%s 必须是 host:port": "{0} muss host:port sein", @@ -31,6 +32,7 @@ "%w: %s 已由另一个 AIStudio2API runtime 使用": "{0}: {1} wird bereits von einer anderen AIStudio2API-Runtime verwendet", "%w: CountTokens model 不能为空": "{0}: CountTokens model darf nicht leer sein", "%w: GenerateContent model 不能为空": "{0}: GenerateContent model darf nicht leer sein", + "%w: Waa/Create 未确认账户会话": "{0}: Waa/Create hat Kontositzung nicht bestätigt", "%w: audio 未在 setup input_modalities 中声明": "{0}: audio ist in setup input_modalities nicht deklariert", "%w: bidi function response 列表为空": "{0}: bidi function response-Liste ist leer", "%w: bidi function response 缺少函数名": "{0}: bidi function response fehlt Funktionsname", @@ -249,6 +251,7 @@ "Google 多账号会话序号 (0..9,对应 /u/0、/u/1...)": "Google-Mehrkonten-Sitzungsindex (0..9, entspricht /u/0, /u/1...)", "INIT_TIMEOUT 必须是正数时长": "INIT_TIMEOUT muss eine positive Zeitdauer sein", "INIT_TIMEOUT 无效: %w": "INIT_TIMEOUT ist ungültig: {0}", + "Interaction 模型": "Interaction-Modelle", "Interaction 模型不接受 %s 消息": "Interaction-Modell akzeptiert keine {0}-Nachrichten", "Interaction 模型的 %w": "{0} des Interaction-Modells", "Interaction 模型的 contents[%d] 不接受视频截取、采样、处理方式与处理步骤": "contents[{0}] des Interaction-Modells akzeptiert kein Video-Clipping, Sampling, Verarbeitungsverfahren oder Verarbeitungsschritte", @@ -363,7 +366,6 @@ "WebChannel envelope 字段不足": "Zu wenige WebChannel-Envelope-Felder", "WebView2 运行时安装失败": "Installation der WebView2-Runtime fehlgeschlagen", "WriteProcessMemory 失败: %w": "WriteProcessMemory fehlgeschlagen: {0}", - "agent 不接受 %s 工具": "Der Agent unterstützt das Tool {0} nicht", "agent_config.type %q 与 agent %s 不匹配,应为 %q": "agent_config.type {0} passt nicht zu Agent {1}, erwartet: {2}", "app_bound_encrypted_key 缺少 APPB 前缀": "app_bound_encrypted_key fehlt das APPB-Präfix", "behavior %q 无效,可用 BLOCKING 或 NON_BLOCKING": "behavior {0} ist ungültig, zulässig sind BLOCKING oder NON_BLOCKING", @@ -442,7 +444,7 @@ "smart transcription 不能同时启用 word timestamps 或 speaker labels": "smart transcription kann nicht gleichzeitig mit word timestamps oder speaker labels aktiviert werden", "speech config mode 只能用于 multi-speaker": "speech config mode kann nur für multi-speaker verwendet werden", "speech config mode 必须是 VERBATIM 或 CONVERSATIONAL": "speech config mode muss VERBATIM oder CONVERSATIONAL sein", - "stack 必须是 model、account、channel、protocol 或 state": "stack muss model, account, channel, protocol oder state sein", + "stack 必须是 model、account、channel、protocol、state 或 api_key": "stack muss model, account, channel, protocol, state oder api_key sein", "status 必须是 HTTP 状态码": "status muss ein HTTP-Statuscode sein", "storage state Cookie %d 缺少名称或域": "storage state Cookie {0} fehlt Name oder Domain", "storage state Cookie %s 的 SameSite 无效": "storage state Cookie {0}: SameSite ist ungültig", @@ -462,6 +464,8 @@ "video endOffset %s 必须晚于 startOffset %s": "video endOffset {0} muss nach startOffset {1} liegen", "video offset %q 必须是秒数加 s 的 Duration,例如 \"2.5s\"": "video offset {0} muss eine Duration aus Sekunden mit angehängtem s sein, z. B. \"2.5s\"", "video task 必须是 text_to_video、image_to_video、reference_to_video、edit 或 extend": "video task muss text_to_video, image_to_video, reference_to_video, edit oder extend sein", + "【回复交付硬性要求】必须完全通过 `final(content=..., more=...)` 交付全部正文,禁止在 `final` 外直接输出正文。`final` 为单向流式输出,不会返回结果也没有后续回合": "【Verbindliche Anforderung an die Antwortübermittlung】 Sämtliche Inhalte müssen vollständig über `final(content=..., more=...)` übermittelt werden; es ist verboten, Inhalte direkt außerhalb von `final` auszugeben. `final` ist eine unidirektionale Streaming-Ausgabe, liefert kein Ergebnis zurück und hat keine nachfolgenden Runden.", + "【回复交付硬性要求】必须完全通过 `final(content=..., more=...)` 交付全部正文,禁止在 `final` 外直接输出正文。`final` 为单向流式输出,不会返回结果也没有后续回合;长回复必须在当前这一回合内连续并行发出全部段落的 `final` 调用(每段约 300–600 字),未写完前设 `more: true` 并紧接着发出下一个 `final`,只有整篇达到要求长度并彻底写完后的最后一段才设 `more: false` 并结束回合。": "【Verbindliche Anforderung an die Antwortübermittlung】 Sämtliche Inhalte müssen vollständig über `final(content=..., more=...)` übermittelt werden; es ist verboten, Inhalte direkt außerhalb von `final` auszugeben. `final` ist eine unidirektionale Streaming-Ausgabe, liefert kein Ergebnis zurück und hat keine nachfolgenden Runden; Lange Antworten müssen innerhalb dieser aktuellen Runde kontinuierlich und parallel für alle Abschnitte als `final`-Aufrufe gesendet werden (jeder Abschnitt ca. 300–600 Zeichen). Solange der Text noch nicht fertig ist, muss `more: true` gesetzt und unmittelbar das nächste `final` gesendet werden; erst beim letzten Abschnitt, wenn der gesamte Text die geforderte Länge erreicht hat und vollständig abgeschlossen ist, wird `more: false` gesetzt und die Runde beendet.", "一行 Cookie 请求头": "Einzeiliger Cookie-Header", "上传 Drive 文件: %w": "Drive-Datei hochladen: {0}", "上传 Drive 文件块: %w": "Drive-Dateiblock hochladen: {0}", @@ -537,6 +541,7 @@ "关闭标签页: %w": "Tab schließen: {0}", "关闭配置: %w": "Konfiguration schließen: {0}", "内联附件处理完成": "Verarbeitung von Inline-Anhängen abgeschlossen", + "内联附件处理失败": "Verarbeitung von Inline-Anhängen fehlgeschlagen", "写入 ABE helper: %w": "ABE-Helper schreiben: {0}", "写入 Camoufox profile: %w": "Camoufox-Profile schreiben: {0}", "写入 Camoufox 字体配置: %w": "Camoufox-Schriftartkonfiguration schreiben: {0}", @@ -550,6 +555,7 @@ "冷却已手动清除": "Cooldown manuell aufgehoben", "冷却期限必须在未来": "Cooldown-Ende muss in der Zukunft liegen", "冷却检查时间不能为空": "Cooldown-Prüfzeitpunkt darf nicht leer sein", + "准备 Drive discovery 请求失败": "Vorbereitung der Drive discovery-Anfrage fehlgeschlagen", "准备 bidi fresh WAA proof: %w": "Frischen Bidi-WAA-Proof vorbereiten: {0}", "准备 bidi setup fresh WAA proof: %w": "Frischen Bidi-Setup-WAA-Proof vorbereiten: {0}", "准备 fresh WAA proof: %w": "Frischen WAA-Proof vorbereiten: {0}", @@ -615,10 +621,7 @@ "参数值不能为空": "Parameterwert darf nicht leer sein", "双引号值无效": "Wert in doppelten Anführungszeichen ist ungültig", "发布 Camoufox 目录: %w": "Camoufox-Verzeichnis bereitstellen: {0}", - "发行包 %s 的 SHA-256 与发行版本记录不一致": "SHA-256 von Release-Paket {0} stimmt nicht mit den Release-Aufzeichnungen überein", - "发行包 %s 缺少 SHA-256 摘要": "Dem Release-Paket {0} fehlt der SHA-256-Digest", "发行包中没有 %s": "{0} ist im Release-Paket nicht enthalten", - "发行版本 %s 没有 %s": "Release-Version {0} enthält {1} nicht", "发送 AI Studio %s: %w": "AI Studio {0} senden: {1}", "发送 AI Studio CreateInteraction: %w": "AI Studio CreateInteraction senden: {0}", "发送 AI Studio CreateInteractionStream: %w": "AI Studio CreateInteractionStream senden: {0}", @@ -637,6 +640,7 @@ "同步官网 prompt": "Offiziellen prompt synchronisieren", "同步配置: %w": "Einstellungen synchronisieren: {0}", "后台下载 WebView2 引导程序失败,重新下载": "Hintergrund-Download des WebView2-Bootstrappers fehlgeschlagen, wird erneut heruntergeladen", + "后台读取 Drive discovery 失败": "Lesen von Drive discovery im Hintergrund fehlgeschlagen", "启动 Camoufox": "Camoufox wird gestartet", "启动 Camoufox: %w": "Camoufox starten: {0}", "启动 Xvfb: %w": "Xvfb starten: {0}", @@ -650,6 +654,7 @@ "响应后存在第二个根值": "Zweiter Root-Wert nach Antwort vorhanden", "响应字节不是 Base64": "Antwort-Bytes sind kein Base64", "响应角色不是 model": "Antwort-Rolle ist nicht model", + "回收未绑定内联附件失败": "Bereinigung ungebundener Inline-Anhänge fehlgeschlagen", "在 .env 的 PROXY 设置能访问 GitHub 的代理后重试,或手动下载 %s 解压到 %s": "Legen Sie in .env einen PROXY fest, der GitHub erreicht, und versuchen Sie es erneut, oder laden Sie {0} manuell herunter und entpacken Sie es nach {1}", "在前台为本机上传到 --remote 实例的 Chrome 导入账户按时续签,用于重启电脑后恢复续签": "Erneuert aus Chrome importierte Konten, die von diesem Gerät auf eine --remote-Instanz hochgeladen wurden, im Vordergrund; zur Wiederaufnahme nach einem Neustart des Rechners", "在线更新": "Online-Aktualisierung", @@ -840,6 +845,7 @@ "根数组缺少响应列表": "Wurzel-Array fehlt Antwortliste", "检查隔离登录页面: %w": "Isolierte Anmeldeseite überprüfen: {0}", "检测代理池": "Proxy-Pool wird geprüft", + "模型 %s 不接受 agent_config": "Modell {0} akzeptiert agent_config nicht", "模型 %s 不支持 %s": "Modell {0} unterstützt {1} nicht", "模型 %s 没有 %s 任务": "Modell {0} hat keine {1}-Aufgabe", "模型 %s 没有尾帧输入": "Modell {0} hat keine Endframe-Eingabe", @@ -864,6 +870,7 @@ "每日限额": "Tageslimit", "没有 DISPLAY 时 Camoufox 需要 Xvfb: %w": "Ohne DISPLAY erfordert Camoufox Xvfb: {0}", "没有 DISPLAY 时 Camoufox 需要 Xvfb,执行 %s 后重试: %w": "Ohne DISPLAY erfordert Camoufox Xvfb; führen Sie {0} aus und versuchen Sie es erneut: {1}", + "没有其他工具,严禁调用或编造 `final` 以外的任何函数。": "Es sind keine weiteren Werkzeuge vorhanden; es ist streng verboten, andere Funktionen als `final` aufzurufen oder zu erfinden.", "没有可安装的新版本": "Keine neue Version zur Installation verfügbar", "没有可预热的账户: %w": "Keine Konten zum Vorwärmen verfügbar: {0}", "没有找到 WebView2 运行时,管理页面在默认浏览器中打开": "Keine WebView2-Laufzeitumgebung gefunden, Administrationsseite wird im Standardbrowser geöffnet", @@ -1056,7 +1063,7 @@ "请求正文不存在": "Anfrageinhalt nicht vorhanden", "请求账本写入失败": "Schreiben in das Anfragen-Ledger fehlgeschlagen", "请求账本写入队列已满": "Schreibwarteschlange des Anfragen-Ledgers ist voll", - "请求账本已按服务器时区重建本地日汇总": "Lokale Tageszusammenfassung im Anfragen-Ledger nach Server-Zeitzone neu aufgebaut", + "请求账本已从请求记录重建汇总": "Das Anfrage-Ledger hat die Zusammenfassung aus dem Anfrageverlauf neu aufgebaut", "请求账本清理失败": "Bereinigung des Anfragen-Ledgers fehlgeschlagen", "请粘贴远程实例账户页生成的配对令牌: ": "Bitte das auf der Kontoseite der Remote-Instanz generierte Kopplungstoken einfügen: ", "请输入逗号分隔的编号: ": "Bitte kommagetrennte Nummern eingeben: ", @@ -1094,6 +1101,8 @@ "读取 ListModels: %w": "ListModels lesen: {0}", "读取 OAuthMultilogin 响应: %w": "OAuthMultilogin-Antwort lesen: {0}", "Xvfb 在报告显示号前退出:%s": "Xvfb wurde beendet, bevor die Displaynummer gemeldet wurde: {0}", + "[DELIVERY RULE / 回复交付规则]": "[DELIVERY RULE / Antwortübermittlungsregel]", + "[DELIVERY RULE / 回复交付规则]\nYou MUST deliver 100%% of your user-facing reply through the `final` tool and NEVER output reply text directly outside `final`.\n`final` is a one-way streaming output sink and NEVER returns a tool result—there is NO follow-up turn. You MUST emit the ENTIRE complete reply in this single turn before stopping.\nSplit every multi-paragraph reply into consecutive parallel `final` calls within this SAME turn (~300–600 characters or 1–2 paragraphs per call): set `more: true` on each continuing chunk and immediately emit the next `final` call, and set `more: false` ONLY on the final chunk after the entire requested length and story beat are complete.\n": "[DELIVERY RULE / Antwortübermittlungsregel]\nYou MUST deliver 100% of your user-facing reply through the `final` tool and NEVER output reply text directly outside `final`.\n`final` is a one-way streaming output sink and NEVER returns a tool result—there is NO follow-up turn. You MUST emit the ENTIRE complete reply in this single turn before stopping.\nSplit every multi-paragraph reply into consecutive parallel `final` calls within this SAME turn (~300–600 characters or 1–2 paragraphs per call): set `more: true` on each continuing chunk and immediately emit the next `final` call, and set `more: false` ONLY on the final chunk after the entire requested length and story beat are complete.\n", "读取 bidi WebChannel ACK: %w": "bidi WebChannel-ACK lesen: {0}", "读取 bidi WebChannel Cookie: %w": "bidi WebChannel-Cookie lesen: {0}", "读取 bidi WebChannel frame: %w": "bidi WebChannel-Frame lesen: {0}", @@ -1106,6 +1115,7 @@ "读取官网日志上下文: %w": "Protokollkontext der offiziellen Website lesen: {0}", "读取收缩模式: %w": "Auto-Vacuum-Modus lesen: {0}", "读取最新发行版本: %w": "Neueste Release-Version lesen: {0}", + "读取本地日汇总: %w": "Lesen der lokalen Tageszusammenfassung: {0}", "读取权益与模型目录": "Abo und Modelle werden gelesen", "读取浏览器 Cookie: %w": "Browser-Cookies lesen: {0}", "读取浏览器 tab: %w": "Browser-Tab lesen: {0}", @@ -1233,7 +1243,7 @@ "释放管理界面启动进程: %w": "Freigabe des Konsolen-Startprozesses: {0}", "释放账户 %s 的模型目录租约: %w": "Freigabe des Modellkatalog-Lease für Konto {0}: {1}", "释放账户浏览器缓存: %w": "Freigabe des Konto-Browser-Cache: {0}", - "重建本地日汇总: %w": "Neuerstellung der lokalen Tageszusammenfassung: {0}", + "重建汇总: %w": "Neuerstellung der Zusammenfassung: {0}", "重置协议运行时": "Protokoll-Laufzeit wird zurückgesetzt", "重置账户 %s runtime: %w": "Runtime für Konto {0} zurücksetzen: {1}", "重置转录文件: %w": "Transkriptionsdatei zurücksetzen: {0}", @@ -1243,6 +1253,7 @@ "锁定账户浏览器缓存: %w": "Sperrung des Konto-Browser-Cache: {0}", "锁定账户租约: %w": "Sperrung des Konto-Lease: {0}", "锁定账户运行状态: %w": "Sperrung des Konto-Laufzeitstatus: {0}", + "长回复必须在当前这一回合内连续并行发出全部段落的 `final` 调用(每段约 300–600 字),未写完前设 `more: true` 并紧接着发出下一个 `final`,只有整篇达到要求长度并彻底写完后的最后一段才设 `more: false` 并结束回合。": "Lange Antworten müssen innerhalb dieser aktuellen Runde kontinuierlich und parallel für alle Abschnitte als `final`-Aufrufe gesendet werden (jeder Abschnitt ca. 300–600 Zeichen). Solange der Text noch nicht fertig ist, muss `more: true` gesetzt und unmittelbar das nächste `final` gesendet werden; erst beim letzten Abschnitt, wenn der gesamte Text die geforderte Länge erreicht hat und vollständig abgeschlossen ist, wird `more: false` gesetzt und die Runde beendet.", "隔离浏览器没有可导出的 Cookie": "Isolierter Browser hat keine exportierbaren Cookies", "隔离登录 Camoufox 指纹为空": "Camoufox-Fingerabdruck für isolierte Anmeldung ist leer", "隔离登录: aistudio2api setup --login": "Isolierte Anmeldung: aistudio2api setup --login", @@ -1328,6 +1339,7 @@ "页面应用没有发出 GenerateContent": "Die Seitenanwendung hat GenerateContent nicht gesendet", "读取官网 Run 按钮状态: %w": "Status des Run-Buttons der Website lesen: {0}", "解析官网 Run 按钮状态: %w": "Status des Run-Buttons der Website parsen: {0}", + "解析对话媒体引用: %w": "Auflösen der Chat-Medienreferenz: {0}", "Run 按钮不存在": "Run-Button nicht gefunden", "对话框 %q": "Dialog {0}", "遮挡 Run 按钮的元素 %q": "Element über dem Run-Button {0}", @@ -1539,9 +1551,10 @@ "只能在本机访问时关闭管理登录": "Die Konsolenanmeldung kann nur auf diesem Computer deaktiviert werden", "最新发行版本跳转缺少版本号": "Die Weiterleitung zur neuesten Version enthält keine Versionsnummer", "等待换号间隔": "Warten auf Kontowechsel-Intervall", - "读取校验摘要: %w": "Prüfsumme wird gelesen: {0}", "读取账户历史使用记录失败": "Lesen des Kontonutzungsverlaufs fehlgeschlagen", "模型 %s 需要 %s,本次请求可用的账户 %s 都不具备": "Modell {0} erfordert {1}, die für diese Anfrage verfügbaren Konten ({2}) verfügen nicht darüber", "模型 %s 需要以下任一权益,本次请求可用的账户 %s 都不具备:%s": "Modell {0} erfordert eine dieser Berechtigungen, die für diese Anfrage verfügbaren Konten ({1}) verfügen nicht darüber: {2}", - "Interaction 模型的 contents[%d] 不接受服务端工具步骤 %s": "Interaction-Modell contents[{0}] akzeptiert keinen serverseitigen Tool-Schritt {1}" + "Interaction 模型的 contents[%d] 不接受服务端工具步骤 %s": "Interaction-Modell contents[{0}] akzeptiert keinen serverseitigen Tool-Schritt {1}", + "模型 %s 已在设置中隐藏": "Modell {0} ist in den Einstellungen ausgeblendet", + "Build 对话模型 %s 已在设置中关闭": "Build-Chatmodell {0} ist in den Einstellungen ausgeschaltet" } diff --git a/internal/i18n/messages/en.json b/internal/i18n/messages/en.json index 6fb114c8..336c2056 100644 --- a/internal/i18n/messages/en.json +++ b/internal/i18n/messages/en.json @@ -1,5 +1,6 @@ { "%s 不可用": "{0} is unavailable", + "%s 不接受 %s 工具": "{0} does not accept {1} tools", "%s 之后没有可监听的端口": "No port after {0} can be listened on", "%s 已停用": "{0} is disabled", "%s 必须是 host:port": "{0} must be host:port", @@ -31,6 +32,7 @@ "%w: %s 已由另一个 AIStudio2API runtime 使用": "{0}: {1} is already in use by another AIStudio2API runtime", "%w: CountTokens model 不能为空": "{0}: CountTokens model cannot be empty", "%w: GenerateContent model 不能为空": "{0}: GenerateContent model cannot be empty", + "%w: Waa/Create 未确认账户会话": "{0}: Waa/Create did not confirm account session", "%w: audio 未在 setup input_modalities 中声明": "{0}: audio is not declared in setup input_modalities", "%w: bidi function response 列表为空": "{0}: bidi function response list is empty", "%w: bidi function response 缺少函数名": "{0}: bidi function response is missing function name", @@ -249,6 +251,7 @@ "Google 多账号会话序号 (0..9,对应 /u/0、/u/1...)": "Google multi-account session index (0..9, for /u/0, /u/1...)", "INIT_TIMEOUT 必须是正数时长": "INIT_TIMEOUT must be a positive duration", "INIT_TIMEOUT 无效: %w": "Invalid INIT_TIMEOUT: {0}", + "Interaction 模型": "Interaction models", "Interaction 模型不接受 %s 消息": "Interaction models do not accept {0} messages", "Interaction 模型的 %w": "{0} of Interaction model", "Interaction 模型的 contents[%d] 不接受视频截取、采样、处理方式与处理步骤": "Interaction model contents[{0}] does not accept video clipping, sampling, processing mode, or processing steps", @@ -363,7 +366,6 @@ "WebChannel envelope 字段不足": "Insufficient WebChannel envelope fields", "WebView2 运行时安装失败": "WebView2 runtime installation failed", "WriteProcessMemory 失败: %w": "WriteProcessMemory failed: {0}", - "agent 不接受 %s 工具": "The agent does not accept the {0} tool", "agent_config.type %q 与 agent %s 不匹配,应为 %q": "agent_config.type {0} does not match agent {1}, expected {2}", "app_bound_encrypted_key 缺少 APPB 前缀": "app_bound_encrypted_key is missing APPB prefix", "behavior %q 无效,可用 BLOCKING 或 NON_BLOCKING": "Invalid behavior {0}, available: BLOCKING or NON_BLOCKING", @@ -442,7 +444,7 @@ "smart transcription 不能同时启用 word timestamps 或 speaker labels": "smart transcription cannot enable word timestamps or speaker labels simultaneously", "speech config mode 只能用于 multi-speaker": "speech config mode can only be used for multi-speaker", "speech config mode 必须是 VERBATIM 或 CONVERSATIONAL": "speech config mode must be VERBATIM or CONVERSATIONAL", - "stack 必须是 model、account、channel、protocol 或 state": "stack must be model, account, channel, protocol, or state", + "stack 必须是 model、account、channel、protocol、state 或 api_key": "stack must be model, account, channel, protocol, state, or api_key", "status 必须是 HTTP 状态码": "status must be an HTTP status code", "storage state Cookie %d 缺少名称或域": "storage state Cookie {0} is missing name or domain", "storage state Cookie %s 的 SameSite 无效": "storage state Cookie {0} has an invalid SameSite", @@ -462,6 +464,8 @@ "video endOffset %s 必须晚于 startOffset %s": "video endOffset {0} must be later than startOffset {1}", "video offset %q 必须是秒数加 s 的 Duration,例如 \"2.5s\"": "video offset {0} must be a duration in seconds followed by \"s\", such as \"2.5s\"", "video task 必须是 text_to_video、image_to_video、reference_to_video、edit 或 extend": "video task must be text_to_video, image_to_video, reference_to_video, edit or extend", + "【回复交付硬性要求】必须完全通过 `final(content=..., more=...)` 交付全部正文,禁止在 `final` 外直接输出正文。`final` 为单向流式输出,不会返回结果也没有后续回合": "【MANDATORY REPLY DELIVERY REQUIREMENT】All body text must be delivered entirely through `final(content=..., more=...)`; directly outputting body text outside `final` is prohibited. `final` is a one-way streaming output, returns no results, and has no follow-up turns", + "【回复交付硬性要求】必须完全通过 `final(content=..., more=...)` 交付全部正文,禁止在 `final` 外直接输出正文。`final` 为单向流式输出,不会返回结果也没有后续回合;长回复必须在当前这一回合内连续并行发出全部段落的 `final` 调用(每段约 300–600 字),未写完前设 `more: true` 并紧接着发出下一个 `final`,只有整篇达到要求长度并彻底写完后的最后一段才设 `more: false` 并结束回合。": "【MANDATORY REPLY DELIVERY REQUIREMENT】All body text must be delivered entirely through `final(content=..., more=...)`; directly outputting body text outside `final` is prohibited. `final` is a one-way streaming output, returns no results, and has no follow-up turns; Long replies must issue `final` calls for all paragraphs (approx. 300–600 words each) continuously and in parallel within the current turn; set `more: true` and immediately issue the next `final` until finished, and only set `more: false` on the last paragraph and end the turn once the entire text has reached the required length and is completely written.", "一行 Cookie 请求头": "Single-line Cookie request header", "上传 Drive 文件: %w": "Upload Drive file: {0}", "上传 Drive 文件块: %w": "Upload Drive file chunk: {0}", @@ -537,6 +541,7 @@ "关闭标签页: %w": "Close tab: {0}", "关闭配置: %w": "Close configuration: {0}", "内联附件处理完成": "Inline attachment processing completed", + "内联附件处理失败": "Inline attachment processing failed", "写入 ABE helper: %w": "Write ABE helper: {0}", "写入 Camoufox profile: %w": "Write Camoufox profile: {0}", "写入 Camoufox 字体配置: %w": "Write Camoufox font configuration: {0}", @@ -550,6 +555,7 @@ "冷却已手动清除": "Cooldown manually cleared", "冷却期限必须在未来": "Cooldown expiration must be in the future", "冷却检查时间不能为空": "Cooldown check time cannot be empty", + "准备 Drive discovery 请求失败": "Drive discovery request preparation failed", "准备 bidi fresh WAA proof: %w": "Prepare bidi fresh WAA proof: {0}", "准备 bidi setup fresh WAA proof: %w": "Prepare bidi setup fresh WAA proof: {0}", "准备 fresh WAA proof: %w": "Prepare fresh WAA proof: {0}", @@ -615,10 +621,7 @@ "参数值不能为空": "Argument value cannot be empty", "双引号值无效": "Invalid double-quoted value", "发布 Camoufox 目录: %w": "Publish Camoufox directory: {0}", - "发行包 %s 的 SHA-256 与发行版本记录不一致": "SHA-256 for release package {0} does not match the release record", - "发行包 %s 缺少 SHA-256 摘要": "Release package {0} is missing SHA-256 digest", "发行包中没有 %s": "{0} not found in release package", - "发行版本 %s 没有 %s": "Release {0} does not have {1}", "发送 AI Studio %s: %w": "Send AI Studio {0}: {1}", "发送 AI Studio CreateInteraction: %w": "Send AI Studio CreateInteraction: {0}", "发送 AI Studio CreateInteractionStream: %w": "Send AI Studio CreateInteractionStream: {0}", @@ -637,6 +640,7 @@ "同步官网 prompt": "Sync official prompt", "同步配置: %w": "Settings sync: {0}", "后台下载 WebView2 引导程序失败,重新下载": "Background download of WebView2 bootstrapper failed, downloading again", + "后台读取 Drive discovery 失败": "Background Drive discovery read failed", "启动 Camoufox": "Launching Camoufox", "启动 Camoufox: %w": "Camoufox startup: {0}", "启动 Xvfb: %w": "Xvfb startup: {0}", @@ -650,6 +654,7 @@ "响应后存在第二个根值": "Second root value exists after response", "响应字节不是 Base64": "Response bytes are not Base64", "响应角色不是 model": "Response role is not model", + "回收未绑定内联附件失败": "Unbound inline attachment reclamation failed", "在 .env 的 PROXY 设置能访问 GitHub 的代理后重试,或手动下载 %s 解压到 %s": "Set a PROXY that can reach GitHub in .env and retry, or download {0} manually and extract it to {1}", "在前台为本机上传到 --remote 实例的 Chrome 导入账户按时续签,用于重启电脑后恢复续签": "Renew Chrome-imported accounts uploaded from this machine to the --remote instance on schedule in the foreground, used to resume renewal after restarting the computer", "在线更新": "Online update", @@ -840,6 +845,7 @@ "根数组缺少响应列表": "Root array is missing response list", "检查隔离登录页面: %w": "Checking isolated sign-in page: {0}", "检测代理池": "Checking the proxy pool", + "模型 %s 不接受 agent_config": "Model {0} does not accept agent_config", "模型 %s 不支持 %s": "Model {0} does not support {1}", "模型 %s 没有 %s 任务": "Model {0} has no {1} task", "模型 %s 没有尾帧输入": "Model {0} has no end frame input", @@ -864,6 +870,7 @@ "每日限额": "Daily limit", "没有 DISPLAY 时 Camoufox 需要 Xvfb: %w": "Camoufox requires Xvfb without DISPLAY: {0}", "没有 DISPLAY 时 Camoufox 需要 Xvfb,执行 %s 后重试: %w": "Camoufox requires Xvfb without DISPLAY; run {0} and retry: {1}", + "没有其他工具,严禁调用或编造 `final` 以外的任何函数。": "There are no other tools; calling or fabricating any function other than `final` is strictly prohibited.", "没有可安装的新版本": "No new version to install", "没有可预热的账户: %w": "No accounts to warm up: {0}", "没有找到 WebView2 运行时,管理页面在默认浏览器中打开": "WebView2 runtime not found, console opened in default browser", @@ -1056,7 +1063,7 @@ "请求正文不存在": "Request body does not exist", "请求账本写入失败": "Request ledger write failed", "请求账本写入队列已满": "Request ledger write queue is full", - "请求账本已按服务器时区重建本地日汇总": "Request ledger rebuilt local daily summary by server timezone", + "请求账本已从请求记录重建汇总": "Request ledger rebuilt summaries from request records", "请求账本清理失败": "Request ledger cleanup failed", "请粘贴远程实例账户页生成的配对令牌: ": "Please paste the pairing token generated on the remote instance account page: ", "请输入逗号分隔的编号: ": "Please enter comma-separated numbers: ", @@ -1094,6 +1101,8 @@ "读取 ListModels: %w": "Read ListModels: {0}", "读取 OAuthMultilogin 响应: %w": "Read OAuthMultilogin response: {0}", "Xvfb 在报告显示号前退出:%s": "Xvfb exited before reporting the display number: {0}", + "[DELIVERY RULE / 回复交付规则]": "[DELIVERY RULE / Reply delivery rules]", + "[DELIVERY RULE / 回复交付规则]\nYou MUST deliver 100%% of your user-facing reply through the `final` tool and NEVER output reply text directly outside `final`.\n`final` is a one-way streaming output sink and NEVER returns a tool result—there is NO follow-up turn. You MUST emit the ENTIRE complete reply in this single turn before stopping.\nSplit every multi-paragraph reply into consecutive parallel `final` calls within this SAME turn (~300–600 characters or 1–2 paragraphs per call): set `more: true` on each continuing chunk and immediately emit the next `final` call, and set `more: false` ONLY on the final chunk after the entire requested length and story beat are complete.\n": "[DELIVERY RULE / Reply delivery rules]\nYou MUST deliver 100% of your user-facing reply through the `final` tool and NEVER output reply text directly outside `final`.\n`final` is a one-way streaming output sink and NEVER returns a tool result—there is NO follow-up turn. You MUST emit the ENTIRE complete reply in this single turn before stopping.\nSplit every multi-paragraph reply into consecutive parallel `final` calls within this SAME turn (~300–600 characters or 1–2 paragraphs per call): set `more: true` on each continuing chunk and immediately emit the next `final` call, and set `more: false` ONLY on the final chunk after the entire requested length and story beat are complete.\n", "读取 bidi WebChannel ACK: %w": "Read bidi WebChannel ACK: {0}", "读取 bidi WebChannel Cookie: %w": "Read bidi WebChannel cookies: {0}", "读取 bidi WebChannel frame: %w": "Read bidi WebChannel frame: {0}", @@ -1106,6 +1115,7 @@ "读取官网日志上下文: %w": "Read official logging context: {0}", "读取收缩模式: %w": "Read auto-vacuum mode: {0}", "读取最新发行版本: %w": "Read latest release: {0}", + "读取本地日汇总: %w": "Reading local daily summaries: {0}", "读取权益与模型目录": "Reading plan and models", "读取浏览器 Cookie: %w": "Read browser cookies: {0}", "读取浏览器 tab: %w": "Read browser tab: {0}", @@ -1233,7 +1243,7 @@ "释放管理界面启动进程: %w": "Releasing console startup process: {0}", "释放账户 %s 的模型目录租约: %w": "Releasing model catalog lease for account {0}: {1}", "释放账户浏览器缓存: %w": "Releasing account browser cache: {0}", - "重建本地日汇总: %w": "Rebuilding local daily summary: {0}", + "重建汇总: %w": "Rebuilding summary: {0}", "重置协议运行时": "Resetting protocol runtime", "重置账户 %s runtime: %w": "Resetting account {0} runtime: {1}", "重置转录文件: %w": "Resetting transcription file: {0}", @@ -1243,6 +1253,7 @@ "锁定账户浏览器缓存: %w": "Locking account browser cache: {0}", "锁定账户租约: %w": "Locking account lease: {0}", "锁定账户运行状态: %w": "Locking account running state: {0}", + "长回复必须在当前这一回合内连续并行发出全部段落的 `final` 调用(每段约 300–600 字),未写完前设 `more: true` 并紧接着发出下一个 `final`,只有整篇达到要求长度并彻底写完后的最后一段才设 `more: false` 并结束回合。": "Long replies must issue `final` calls for all paragraphs (approx. 300–600 words each) continuously and in parallel within the current turn; set `more: true` and immediately issue the next `final` until finished, and only set `more: false` on the last paragraph and end the turn once the entire text has reached the required length and is completely written.", "隔离浏览器没有可导出的 Cookie": "Isolated browser has no exportable Cookies", "隔离登录 Camoufox 指纹为空": "Isolated sign-in Camoufox fingerprint is empty", "隔离登录: aistudio2api setup --login": "Isolated sign-in: aistudio2api setup --login", @@ -1328,6 +1339,7 @@ "页面应用没有发出 GenerateContent": "The page app did not send GenerateContent", "读取官网 Run 按钮状态: %w": "Read official Run button state: {0}", "解析官网 Run 按钮状态: %w": "Parse official Run button state: {0}", + "解析对话媒体引用: %w": "Resolving chat media references: {0}", "Run 按钮不存在": "Run button not found", "对话框 %q": "Dialog {0}", "遮挡 Run 按钮的元素 %q": "Element covering the Run button {0}", @@ -1539,9 +1551,10 @@ "只能在本机访问时关闭管理登录": "Console login can only be turned off from this computer", "最新发行版本跳转缺少版本号": "Latest release redirect is missing a version tag", "等待换号间隔": "Waiting for account switch interval", - "读取校验摘要: %w": "Reading checksums: {0}", "读取账户历史使用记录失败": "Failed to read account usage history", "模型 %s 需要 %s,本次请求可用的账户 %s 都不具备": "Model {0} requires {1}, which the accounts available to this request ({2}) do not have", "模型 %s 需要以下任一权益,本次请求可用的账户 %s 都不具备:%s": "Model {0} requires one of these entitlements, which the accounts available to this request ({1}) do not have: {2}", - "Interaction 模型的 contents[%d] 不接受服务端工具步骤 %s": "Interaction model contents[{0}] does not accept server-side tool step {1}" + "Interaction 模型的 contents[%d] 不接受服务端工具步骤 %s": "Interaction model contents[{0}] does not accept server-side tool step {1}", + "模型 %s 已在设置中隐藏": "Model {0} is hidden in settings", + "Build 对话模型 %s 已在设置中关闭": "Build chat model {0} is turned off in settings" } diff --git a/internal/i18n/messages/fr.json b/internal/i18n/messages/fr.json index 3146276c..df25d06e 100644 --- a/internal/i18n/messages/fr.json +++ b/internal/i18n/messages/fr.json @@ -1,5 +1,6 @@ { "%s 不可用": "{0} indisponible", + "%s 不接受 %s 工具": "{0} n'accepte pas l'outil {1}", "%s 之后没有可监听的端口": "Aucun port après {0} ne peut être écouté", "%s 已停用": "{0} désactivé", "%s 必须是 host:port": "{0} doit être au format host:port", @@ -31,6 +32,7 @@ "%w: %s 已由另一个 AIStudio2API runtime 使用": "{0} : {1} est déjà utilisé par un autre runtime AIStudio2API", "%w: CountTokens model 不能为空": "{0} : le modèle CountTokens ne peut pas être vide", "%w: GenerateContent model 不能为空": "{0} : le modèle GenerateContent ne peut pas être vide", + "%w: Waa/Create 未确认账户会话": "{0} : session de compte non confirmée par Waa/Create", "%w: audio 未在 setup input_modalities 中声明": "{0} : audio n’est pas déclaré dans les input_modalities du setup", "%w: bidi function response 列表为空": "{0} : la liste des bidi function response est vide", "%w: bidi function response 缺少函数名": "{0} : le nom de fonction est manquant dans la bidi function response", @@ -249,6 +251,7 @@ "Google 多账号会话序号 (0..9,对应 /u/0、/u/1...)": "Index de session Google multi-comptes (0..9, correspond à /u/0, /u/1...)", "INIT_TIMEOUT 必须是正数时长": "INIT_TIMEOUT doit être une durée positive", "INIT_TIMEOUT 无效: %w": "INIT_TIMEOUT non valide : {0}", + "Interaction 模型": "Modèles Interaction", "Interaction 模型不接受 %s 消息": "Les modèles Interaction n’acceptent pas les messages {0}", "Interaction 模型的 %w": "{0} du modèle Interaction", "Interaction 模型的 contents[%d] 不接受视频截取、采样、处理方式与处理步骤": "contents[{0}] du modèle Interaction n’accepte pas le découpage vidéo, l’échantillonnage, le mode de traitement ni les étapes de traitement", @@ -363,7 +366,6 @@ "WebChannel envelope 字段不足": "Champs d’enveloppe WebChannel insuffisants", "WebView2 运行时安装失败": "Échec de l’installation du runtime WebView2", "WriteProcessMemory 失败: %w": "Échec de WriteProcessMemory : {0}", - "agent 不接受 %s 工具": "L’agent n’accepte pas l’outil {0}", "agent_config.type %q 与 agent %s 不匹配,应为 %q": "agent_config.type {0} ne correspond pas à l’agent {1}, valeur attendue : {2}", "app_bound_encrypted_key 缺少 APPB 前缀": "app_bound_encrypted_key sans préfixe APPB", "behavior %q 无效,可用 BLOCKING 或 NON_BLOCKING": "behavior {0} non valide, BLOCKING ou NON_BLOCKING disponibles", @@ -442,7 +444,7 @@ "smart transcription 不能同时启用 word timestamps 或 speaker labels": "smart transcription ne peut pas être activé en même temps que word timestamps ou speaker labels", "speech config mode 只能用于 multi-speaker": "speech config mode ne peut être utilisé que pour multi-speaker", "speech config mode 必须是 VERBATIM 或 CONVERSATIONAL": "speech config mode doit être VERBATIM ou CONVERSATIONAL", - "stack 必须是 model、account、channel、protocol 或 state": "stack doit être model, account, channel, protocol ou state", + "stack 必须是 model、account、channel、protocol、state 或 api_key": "stack doit être model, account, channel, protocol, state ou api_key", "status 必须是 HTTP 状态码": "status doit être un code d’état HTTP", "storage state Cookie %d 缺少名称或域": "Le Cookie {0} de storage state n’a ni nom ni domaine", "storage state Cookie %s 的 SameSite 无效": "SameSite invalide pour le Cookie {0} de storage state", @@ -462,6 +464,8 @@ "video endOffset %s 必须晚于 startOffset %s": "video endOffset {0} doit être postérieur à startOffset {1}", "video offset %q 必须是秒数加 s 的 Duration,例如 \"2.5s\"": "video offset {0} doit être une Duration en secondes avec s, par exemple \"2.5s\"", "video task 必须是 text_to_video、image_to_video、reference_to_video、edit 或 extend": "video task doit être text_to_video, image_to_video, reference_to_video, edit ou extend", + "【回复交付硬性要求】必须完全通过 `final(content=..., more=...)` 交付全部正文,禁止在 `final` 外直接输出正文。`final` 为单向流式输出,不会返回结果也没有后续回合": "【Règle stricte de livraison de la réponse】Tout le corps doit être entièrement livré via `final(content=..., more=...)`, interdiction formelle de sortir directement du corps en dehors de `final`. `final` est une sortie streaming unidirectionnelle sans résultat renvoyé ni tour suivant", + "【回复交付硬性要求】必须完全通过 `final(content=..., more=...)` 交付全部正文,禁止在 `final` 外直接输出正文。`final` 为单向流式输出,不会返回结果也没有后续回合;长回复必须在当前这一回合内连续并行发出全部段落的 `final` 调用(每段约 300–600 字),未写完前设 `more: true` 并紧接着发出下一个 `final`,只有整篇达到要求长度并彻底写完后的最后一段才设 `more: false` 并结束回合。": "【Règle stricte de livraison de la réponse】Tout le corps doit être entièrement livré via `final(content=..., more=...)`, interdiction formelle de sortir directement du corps en dehors de `final`. `final` est une sortie streaming unidirectionnelle sans résultat renvoyé ni tour suivant ; les réponses longues doivent émettre tous les appels `final` de paragraphes en continu et en parallèle au cours de ce même tour (environ 300–600 mots par paragraphe). Définissez `more: true` tant que ce n'est pas terminé et émettez immédiatement le `final` suivant ; ne définissez `more: false` et ne terminez le tour que sur le dernier paragraphe une fois la longueur requise atteinte et l'intégralité rédigée.", "一行 Cookie 请求头": "En-tête de requête Cookies sur une seule ligne", "上传 Drive 文件: %w": "Import du fichier Drive: {0}", "上传 Drive 文件块: %w": "Import d’un bloc de fichier Drive: {0}", @@ -537,6 +541,7 @@ "关闭标签页: %w": "Fermeture de l’onglet : {0}", "关闭配置: %w": "Fermeture de la configuration: {0}", "内联附件处理完成": "Traitement des pièces jointes inline terminé", + "内联附件处理失败": "Échec du traitement des pièces jointes inline", "写入 ABE helper: %w": "Écriture du helper ABE: {0}", "写入 Camoufox profile: %w": "Écriture du Profile Camoufox: {0}", "写入 Camoufox 字体配置: %w": "Écriture de la configuration des polices Camoufox: {0}", @@ -550,6 +555,7 @@ "冷却已手动清除": "Temporisation effacée manuellement", "冷却期限必须在未来": "L'expiration de la temporisation doit être dans le futur", "冷却检查时间不能为空": "L'heure de vérification de temporisation ne peut pas être vide", + "准备 Drive discovery 请求失败": "Échec de la préparation de la requête Drive discovery", "准备 bidi fresh WAA proof: %w": "Préparation de la fresh WAA proof bidi: {0}", "准备 bidi setup fresh WAA proof: %w": "Préparation de la fresh WAA proof bidi setup: {0}", "准备 fresh WAA proof: %w": "Préparation de la fresh WAA proof: {0}", @@ -615,10 +621,7 @@ "参数值不能为空": "La valeur du paramètre ne peut pas être vide", "双引号值无效": "Valeur entre guillemets doubles non valide", "发布 Camoufox 目录: %w": "Publication du répertoire Camoufox : {0}", - "发行包 %s 的 SHA-256 与发行版本记录不一致": "Le SHA-256 du paquet de version {0} ne correspond pas à l'enregistrement de version", - "发行包 %s 缺少 SHA-256 摘要": "Le paquet de version {0} ne contient pas de condensé SHA-256", "发行包中没有 %s": "Le paquet de version ne contient pas {0}", - "发行版本 %s 没有 %s": "La version {0} ne contient pas {1}", "发送 AI Studio %s: %w": "Envoi à AI Studio de {0} : {1}", "发送 AI Studio CreateInteraction: %w": "Envoi à AI Studio de CreateInteraction : {0}", "发送 AI Studio CreateInteractionStream: %w": "Envoi à AI Studio de CreateInteractionStream : {0}", @@ -637,6 +640,7 @@ "同步官网 prompt": "Synchroniser le prompt officiel", "同步配置: %w": "Synchronisation des paramètres : {0}", "后台下载 WebView2 引导程序失败,重新下载": "Échec du téléchargement en arrière-plan du programme d’amorçage WebView2, nouveau téléchargement", + "后台读取 Drive discovery 失败": "Échec de la lecture en arrière-plan de Drive discovery", "启动 Camoufox": "Lancement de Camoufox", "启动 Camoufox: %w": "Démarrage de Camoufox : {0}", "启动 Xvfb: %w": "Démarrage de Xvfb : {0}", @@ -650,6 +654,7 @@ "响应后存在第二个根值": "Deuxième valeur racine présente après la réponse", "响应字节不是 Base64": "Les octets de réponse ne sont pas en Base64", "响应角色不是 model": "Le rôle de la réponse n’est pas model", + "回收未绑定内联附件失败": "Échec de la récupération des pièces jointes intégrées non liées", "在 .env 的 PROXY 设置能访问 GitHub 的代理后重试,或手动下载 %s 解压到 %s": "Définissez dans .env un PROXY qui accède à GitHub puis réessayez, ou téléchargez {0} manuellement et extrayez-le dans {1}", "在前台为本机上传到 --remote 实例的 Chrome 导入账户按时续签,用于重启电脑后恢复续签": "Renouvelle au premier plan et à temps les comptes importés depuis Chrome et envoyés à l'instance --remote, utilisé pour reprendre le renouvellement après le redémarrage de l'ordinateur", "在线更新": "Mise à jour en ligne", @@ -840,6 +845,7 @@ "根数组缺少响应列表": "Liste de réponses manquante dans le tableau racine", "检查隔离登录页面: %w": "Vérification de la page de connexion isolée: {0}", "检测代理池": "Vérification du pool de proxys", + "模型 %s 不接受 agent_config": "Le modèle {0} n'accepte pas agent_config", "模型 %s 不支持 %s": "Le modèle {0} ne prend pas en charge {1}", "模型 %s 没有 %s 任务": "Le modèle {0} n’a pas de tâche {1}", "模型 %s 没有尾帧输入": "Le modèle {0} n’a pas d’entrée d’image finale", @@ -864,6 +870,7 @@ "每日限额": "Limite quotidienne", "没有 DISPLAY 时 Camoufox 需要 Xvfb: %w": "Camoufox nécessite Xvfb sans DISPLAY: {0}", "没有 DISPLAY 时 Camoufox 需要 Xvfb,执行 %s 后重试: %w": "Camoufox nécessite Xvfb sans DISPLAY ; exécutez {0} puis réessayez : {1}", + "没有其他工具,严禁调用或编造 `final` 以外的任何函数。": "Aucun autre outil disponible, interdiction stricte d'appeler ou d'inventer toute fonction autre que `final`.", "没有可安装的新版本": "Aucune nouvelle version installable", "没有可预热的账户: %w": "Aucun compte à préchauffer: {0}", "没有找到 WebView2 运行时,管理页面在默认浏览器中打开": "Runtime WebView2 introuvable, ouverture de la console dans le navigateur par défaut", @@ -1056,7 +1063,7 @@ "请求正文不存在": "Corps de la requête inexistant", "请求账本写入失败": "Échec de l’écriture dans le registre des requêtes", "请求账本写入队列已满": "File d’attente d’écriture du registre des requêtes pleine", - "请求账本已按服务器时区重建本地日汇总": "Le registre des requêtes a reconstruit les résumés quotidiens locaux selon le fuseau horaire du serveur", + "请求账本已从请求记录重建汇总": "Le registre des requêtes a reconstruit les totaux à partir de l'historique des requêtes", "请求账本清理失败": "Échec du nettoyage du registre des requêtes", "请粘贴远程实例账户页生成的配对令牌: ": "Veuillez coller le jeton d’association généré sur la page des comptes de l’instance distante : ", "请输入逗号分隔的编号: ": "Veuillez saisir les numéros séparés par des virgules : ", @@ -1094,6 +1101,8 @@ "读取 ListModels: %w": "Lecture de ListModels : {0}", "读取 OAuthMultilogin 响应: %w": "Lecture de la réponse OAuthMultilogin : {0}", "Xvfb 在报告显示号前退出:%s": "Xvfb a quitté avant d’avoir signalé le numéro d’affichage : {0}", + "[DELIVERY RULE / 回复交付规则]": "[DELIVERY RULE / Règle de livraison de la réponse]", + "[DELIVERY RULE / 回复交付规则]\nYou MUST deliver 100%% of your user-facing reply through the `final` tool and NEVER output reply text directly outside `final`.\n`final` is a one-way streaming output sink and NEVER returns a tool result—there is NO follow-up turn. You MUST emit the ENTIRE complete reply in this single turn before stopping.\nSplit every multi-paragraph reply into consecutive parallel `final` calls within this SAME turn (~300–600 characters or 1–2 paragraphs per call): set `more: true` on each continuing chunk and immediately emit the next `final` call, and set `more: false` ONLY on the final chunk after the entire requested length and story beat are complete.\n": "[DELIVERY RULE / Règle de livraison de la réponse]\nYou MUST deliver 100% of your user-facing reply through the `final` tool and NEVER output reply text directly outside `final`.\n`final` is a one-way streaming output sink and NEVER returns a tool result—there is NO follow-up turn. You MUST emit the ENTIRE complete reply in this single turn before stopping.\nSplit every multi-paragraph reply into consecutive parallel `final` calls within this SAME turn (~300–600 characters or 1–2 paragraphs per call): set `more: true` on each continuing chunk and immediately emit the next `final` call, and set `more: false` ONLY on the final chunk after the entire requested length and story beat are complete.\n", "读取 bidi WebChannel ACK: %w": "Lecture de l'ACK bidi WebChannel : {0}", "读取 bidi WebChannel Cookie: %w": "Lecture des Cookies bidi WebChannel : {0}", "读取 bidi WebChannel frame: %w": "Lecture du frame bidi WebChannel : {0}", @@ -1106,6 +1115,7 @@ "读取官网日志上下文: %w": "Lecture du contexte de journaux officiel : {0}", "读取收缩模式: %w": "Lecture du mode de compactage: {0}", "读取最新发行版本: %w": "Lecture de la dernière version publiée : {0}", + "读取本地日汇总: %w": "Lecture du récapitulatif journalier local : {0}", "读取权益与模型目录": "Lecture du forfait et des modèles", "读取浏览器 Cookie: %w": "Lecture des Cookies du navigateur : {0}", "读取浏览器 tab: %w": "Lecture de l'onglet du navigateur : {0}", @@ -1233,7 +1243,7 @@ "释放管理界面启动进程: %w": "Libération du processus de démarrage de la console : {0}", "释放账户 %s 的模型目录租约: %w": "Libération du bail du catalogue de modèles pour le compte {0} : {1}", "释放账户浏览器缓存: %w": "Libération du cache de navigateur du compte : {0}", - "重建本地日汇总: %w": "Reconstruction du récapitulatif quotidien local : {0}", + "重建汇总: %w": "Reconstruction du récapitulatif : {0}", "重置协议运行时": "Réinitialisation du runtime de protocole", "重置账户 %s runtime: %w": "Réinitialisation du runtime du compte {0} : {1}", "重置转录文件: %w": "Réinitialisation du fichier de transcription : {0}", @@ -1243,6 +1253,7 @@ "锁定账户浏览器缓存: %w": "Verrouillage du cache de navigateur du compte : {0}", "锁定账户租约: %w": "Verrouillage du bail du compte : {0}", "锁定账户运行状态: %w": "Verrouillage de l’état d’exécution du compte : {0}", + "长回复必须在当前这一回合内连续并行发出全部段落的 `final` 调用(每段约 300–600 字),未写完前设 `more: true` 并紧接着发出下一个 `final`,只有整篇达到要求长度并彻底写完后的最后一段才设 `more: false` 并结束回合。": "Les réponses longues doivent émettre tous les appels `final` de paragraphes en continu et en parallèle au cours de ce même tour (environ 300–600 mots par paragraphe). Définissez `more: true` tant que ce n'est pas terminé et émettez immédiatement le `final` suivant ; ne définissez `more: false` et ne terminez le tour que sur le dernier paragraphe une fois la longueur requise atteinte et l'intégralité rédigée.", "隔离浏览器没有可导出的 Cookie": "Le navigateur isolé ne contient aucun Cookie exportable", "隔离登录 Camoufox 指纹为空": "L’empreinte Camoufox de connexion isolée est vide", "隔离登录: aistudio2api setup --login": "Connexion isolée : aistudio2api setup --login", @@ -1328,6 +1339,7 @@ "页面应用没有发出 GenerateContent": "L’application de la page n’a pas envoyé GenerateContent", "读取官网 Run 按钮状态: %w": "Lecture de l’état du bouton Run du site officiel : {0}", "解析官网 Run 按钮状态: %w": "Analyse de l’état du bouton Run du site officiel : {0}", + "解析对话媒体引用: %w": "Analyse des références média du chat : {0}", "Run 按钮不存在": "Bouton Run introuvable", "对话框 %q": "Boîte de dialogue {0}", "遮挡 Run 按钮的元素 %q": "Élément masquant le bouton Run {0}", @@ -1539,9 +1551,10 @@ "只能在本机访问时关闭管理登录": "La connexion à la console ne peut être désactivée que depuis cet ordinateur", "最新发行版本跳转缺少版本号": "La redirection de la dernière version ne contient pas de numéro de version", "等待换号间隔": "Attente de l’intervalle de changement de compte", - "读取校验摘要: %w": "Lecture de la somme de contrôle : {0}", "读取账户历史使用记录失败": "Échec de la lecture de l’historique d’utilisation des comptes", "模型 %s 需要 %s,本次请求可用的账户 %s 都不具备": "Le modèle {0} nécessite {1}, que ne possèdent pas les comptes disponibles pour cette requête ({2})", "模型 %s 需要以下任一权益,本次请求可用的账户 %s 都不具备:%s": "Le modèle {0} nécessite l'un de ces droits, que ne possèdent pas les comptes disponibles pour cette requête ({1}) : {2}", - "Interaction 模型的 contents[%d] 不接受服务端工具步骤 %s": "Le modèle Interaction contents[{0}] n'accepte pas l'étape d'outil côté serveur {1}" + "Interaction 模型的 contents[%d] 不接受服务端工具步骤 %s": "Le modèle Interaction contents[{0}] n'accepte pas l'étape d'outil côté serveur {1}", + "模型 %s 已在设置中隐藏": "Le modèle {0} est masqué dans les paramètres", + "Build 对话模型 %s 已在设置中关闭": "Le modèle de chat Build {0} est désactivé dans les paramètres" } diff --git a/internal/i18n/messages/ja.json b/internal/i18n/messages/ja.json index 2750afc5..87fb69a7 100644 --- a/internal/i18n/messages/ja.json +++ b/internal/i18n/messages/ja.json @@ -1,5 +1,6 @@ { "%s 不可用": "{0} は利用不可", + "%s 不接受 %s 工具": "{0} は {1} ツールを受け付けません", "%s 之后没有可监听的端口": "{0} 以降に待ち受け可能なポートがありません", "%s 已停用": "{0} は無効", "%s 必须是 host:port": "{0} は host:port 形式である必要があります", @@ -31,6 +32,7 @@ "%w: %s 已由另一个 AIStudio2API runtime 使用": "{0}: {1} は別の AIStudio2API runtime で既に使用されています", "%w: CountTokens model 不能为空": "{0}: CountTokens の model は空にできません", "%w: GenerateContent model 不能为空": "{0}: GenerateContent の model は空にできません", + "%w: Waa/Create 未确认账户会话": "{0}: Waa/Create アカウントセッションが未確認です", "%w: audio 未在 setup input_modalities 中声明": "{0}: audio が setup の input_modalities で宣言されていません", "%w: bidi function response 列表为空": "{0}: bidi function response リストが空です", "%w: bidi function response 缺少函数名": "{0}: bidi function response に関数名がありません", @@ -249,6 +251,7 @@ "Google 多账号会话序号 (0..9,对应 /u/0、/u/1...)": "Google マルチアカウントのセッション番号 (0..9、/u/0、/u/1... に対応)", "INIT_TIMEOUT 必须是正数时长": "INIT_TIMEOUT は正の期間である必要があります", "INIT_TIMEOUT 无效: %w": "INIT_TIMEOUT が無効です: {0}", + "Interaction 模型": "Interaction モデル", "Interaction 模型不接受 %s 消息": "Interaction モデルは {0} メッセージを受け付けません", "Interaction 模型的 %w": "Interaction モデルの {0}", "Interaction 模型的 contents[%d] 不接受视频截取、采样、处理方式与处理步骤": "Interaction モデルの contents[{0}] では、動画の切り出し、サンプリング、処理方法、処理手順を受け付けません", @@ -363,7 +366,6 @@ "WebChannel envelope 字段不足": "WebChannel envelope フィールドが不足しています", "WebView2 运行时安装失败": "WebView2 ランタイムのインストールに失敗しました", "WriteProcessMemory 失败: %w": "WriteProcessMemory に失敗しました: {0}", - "agent 不接受 %s 工具": "agent は {0} ツールに対応していません", "agent_config.type %q 与 agent %s 不匹配,应为 %q": "agent_config.type {0} は agent {1} と一致しません。{2} である必要があります", "app_bound_encrypted_key 缺少 APPB 前缀": "app_bound_encrypted_key に APPB プレフィックスがありません", "behavior %q 无效,可用 BLOCKING 或 NON_BLOCKING": "behavior {0} は無効です。BLOCKING または NON_BLOCKING を使用してください", @@ -442,7 +444,7 @@ "smart transcription 不能同时启用 word timestamps 或 speaker labels": "smart transcription では word timestamps または speaker labels を同時に有効にできません", "speech config mode 只能用于 multi-speaker": "speech config mode は multi-speaker にのみ使用できます", "speech config mode 必须是 VERBATIM 或 CONVERSATIONAL": "speech config mode は VERBATIM または CONVERSATIONAL である必要があります", - "stack 必须是 model、account、channel、protocol 或 state": "stack は model、account、channel、protocol、または state である必要があります", + "stack 必须是 model、account、channel、protocol、state 或 api_key": "stack は model、account、channel、protocol、state、または api_key である必要があります", "status 必须是 HTTP 状态码": "status は HTTP ステータス コードである必要があります", "storage state Cookie %d 缺少名称或域": "storage state Cookie {0} の名前またはドメインがありません", "storage state Cookie %s 的 SameSite 无效": "storage state Cookie {0} の SameSite が無効です", @@ -462,6 +464,8 @@ "video endOffset %s 必须晚于 startOffset %s": "video endOffset {0} は startOffset {1} より後である必要があります", "video offset %q 必须是秒数加 s 的 Duration,例如 \"2.5s\"": "video offset {0} は秒数に s を付けた Duration である必要があります(例: \"2.5s\")", "video task 必须是 text_to_video、image_to_video、reference_to_video、edit 或 extend": "video task は text_to_video、image_to_video、reference_to_video、edit、または extend である必要があります", + "【回复交付硬性要求】必须完全通过 `final(content=..., more=...)` 交付全部正文,禁止在 `final` 外直接输出正文。`final` 为单向流式输出,不会返回结果也没有后续回合": "【応答配信の必須要件】すべての本文は必ず `final(content=..., more=...)` を通して配信してください。`final` の外に直接本文を出力することは禁止されています。`final` は一方向のストリーミング出力であり、結果を返さず、後続のターンもありません", + "【回复交付硬性要求】必须完全通过 `final(content=..., more=...)` 交付全部正文,禁止在 `final` 外直接输出正文。`final` 为单向流式输出,不会返回结果也没有后续回合;长回复必须在当前这一回合内连续并行发出全部段落的 `final` 调用(每段约 300–600 字),未写完前设 `more: true` 并紧接着发出下一个 `final`,只有整篇达到要求长度并彻底写完后的最后一段才设 `more: false` 并结束回合。": "【応答配信の必須要件】すべての本文は必ず `final(content=..., more=...)` を通して配信してください。`final` の外に直接本文を出力することは禁止されています。`final` は一方向のストリーミング出力であり、結果を返さず、後続のターンもありません;長文の応答は、現在のターン内にすべての段落の `final` 呼び出し(各段落約 300〜600 文字)を連続して並行して発行する必要があります。書き終わる前は `more: true` に設定して直ちに次の `final` を発行し、全体が必要な長さに達して完全に書き終えた最後の段落でのみ `more: false` に設定してターンを終了してください。", "一行 Cookie 请求头": "1行の Cookie リクエスト ヘッダー", "上传 Drive 文件: %w": "Drive ファイルをアップロード: {0}", "上传 Drive 文件块: %w": "Drive ファイル チャンクをアップロード: {0}", @@ -537,6 +541,7 @@ "关闭标签页: %w": "タブのクローズ: {0}", "关闭配置: %w": "設定のクローズ: {0}", "内联附件处理完成": "インライン添付ファイルの処理完了", + "内联附件处理失败": "インライン添付ファイルの処理に失敗", "写入 ABE helper: %w": "ABE helper の書き込み: {0}", "写入 Camoufox profile: %w": "Camoufox profile の書き込み: {0}", "写入 Camoufox 字体配置: %w": "Camoufox フォント設定の書き込み: {0}", @@ -550,6 +555,7 @@ "冷却已手动清除": "クールダウンを手動でクリアしました", "冷却期限必须在未来": "クールダウン期限は未来の日時である必要があります", "冷却检查时间不能为空": "クールダウン確認時間は空にできません", + "准备 Drive discovery 请求失败": "Drive discovery リクエストの準備に失敗しました", "准备 bidi fresh WAA proof: %w": "bidi fresh WAA proof の準備: {0}", "准备 bidi setup fresh WAA proof: %w": "bidi setup fresh WAA proof の準備: {0}", "准备 fresh WAA proof: %w": "fresh WAA proof の準備: {0}", @@ -615,10 +621,7 @@ "参数值不能为空": "パラメータ値を空にすることはできません", "双引号值无效": "二重引用符の値が無効です", "发布 Camoufox 目录: %w": "Camoufox ディレクトリの公開: {0}", - "发行包 %s 的 SHA-256 与发行版本记录不一致": "リリース パッケージ {0} の SHA-256 がリリース レコードと一致しません", - "发行包 %s 缺少 SHA-256 摘要": "リリース パッケージ {0} に SHA-256 ダイジェストがありません", "发行包中没有 %s": "リリース パッケージに {0} が含まれていません", - "发行版本 %s 没有 %s": "リリース バージョン {0} に {1} がありません", "发送 AI Studio %s: %w": "AI Studio {0} の送信: {1}", "发送 AI Studio CreateInteraction: %w": "AI Studio CreateInteraction の送信: {0}", "发送 AI Studio CreateInteractionStream: %w": "AI Studio CreateInteractionStream の送信: {0}", @@ -637,6 +640,7 @@ "同步官网 prompt": "公式 prompt を同期", "同步配置: %w": "設定の同期: {0}", "后台下载 WebView2 引导程序失败,重新下载": "WebView2 ブートストラップのバックグラウンド ダウンロードに失敗しました。再ダウンロードします", + "后台读取 Drive discovery 失败": "バックグラウンドでの Drive discovery 読み込みに失敗しました", "启动 Camoufox": "Camoufox を起動中", "启动 Camoufox: %w": "Camoufox の起動: {0}", "启动 Xvfb: %w": "Xvfb の起動: {0}", @@ -650,6 +654,7 @@ "响应后存在第二个根值": "レスポンスの後に2つ目のルート値が存在します", "响应字节不是 Base64": "レスポンスのバイト列が Base64 ではありません", "响应角色不是 model": "レスポンスの role が model ではありません", + "回收未绑定内联附件失败": "未バインドのインライン添付ファイルの回収に失敗しました", "在 .env 的 PROXY 设置能访问 GitHub 的代理后重试,或手动下载 %s 解压到 %s": ".env の PROXY に GitHub へ接続できるプロキシを設定して再試行するか、{0} を手動でダウンロードして {1} に展開してください", "在前台为本机上传到 --remote 实例的 Chrome 导入账户按时续签,用于重启电脑后恢复续签": "このローカル PC から --remote インスタンスへアップロードした Chrome インポート済みアカウントをフォアグラウンドで定期的に更新します。PC 再起動後の更新再開に使用します", "在线更新": "オンライン更新", @@ -840,6 +845,7 @@ "根数组缺少响应列表": "ルート配列にレスポンス リストがありません", "检查隔离登录页面: %w": "分離ログイン ページの確認: {0}", "检测代理池": "プロキシプールを確認中", + "模型 %s 不接受 agent_config": "モデル {0} は agent_config を受け付けません", "模型 %s 不支持 %s": "モデル {0} は {1} に対応していません", "模型 %s 没有 %s 任务": "モデル {0} には {1} タスクがありません", "模型 %s 没有尾帧输入": "モデル {0} には末尾フレーム入力がありません", @@ -864,6 +870,7 @@ "每日限额": "1 日あたりの上限", "没有 DISPLAY 时 Camoufox 需要 Xvfb: %w": "DISPLAY がない場合、Camoufox には Xvfb が必要です: {0}", "没有 DISPLAY 时 Camoufox 需要 Xvfb,执行 %s 后重试: %w": "DISPLAY がない場合、Camoufox には Xvfb が必要です。{0} を実行してから再試行してください: {1}", + "没有其他工具,严禁调用或编造 `final` 以外的任何函数。": "他のツールはありません。`final` 以外の関数の呼び出しや捏造は固く禁じられています。", "没有可安装的新版本": "インストール可能な新しいバージョンはありません", "没有可预热的账户: %w": "ウォームアップ可能なアカウントがありません: {0}", "没有找到 WebView2 运行时,管理页面在默认浏览器中打开": "WebView2 ランタイムが見つかりません。管理ページをデフォルトのブラウザで開きます", @@ -1056,7 +1063,7 @@ "请求正文不存在": "リクエスト本文が存在しません", "请求账本写入失败": "リクエスト台帳への書き込みに失敗しました", "请求账本写入队列已满": "リクエスト台帳の書き込みキューがいっぱいです", - "请求账本已按服务器时区重建本地日汇总": "リクエスト台帳はサーバーのタイムゾーンに従ってローカルの日次集計を再構築しました", + "请求账本已从请求记录重建汇总": "リクエスト台帳はリクエストの記録から集計を再構築しました", "请求账本清理失败": "リクエスト台帳のクリーンアップに失敗しました", "请粘贴远程实例账户页生成的配对令牌: ": "リモート インスタンスのアカウント ページで生成されたペアリング トークンを貼り付けてください: ", "请输入逗号分隔的编号: ": "カンマ区切りの番号を入力してください: ", @@ -1094,6 +1101,8 @@ "读取 ListModels: %w": "ListModels の読み込み: {0}", "读取 OAuthMultilogin 响应: %w": "OAuthMultilogin レスポンスの読み込み: {0}", "Xvfb 在报告显示号前退出:%s": "Xvfb がディスプレイ番号を報告する前に終了しました:{0}", + "[DELIVERY RULE / 回复交付规则]": "[DELIVERY RULE / 応答配信ルール]", + "[DELIVERY RULE / 回复交付规则]\nYou MUST deliver 100%% of your user-facing reply through the `final` tool and NEVER output reply text directly outside `final`.\n`final` is a one-way streaming output sink and NEVER returns a tool result—there is NO follow-up turn. You MUST emit the ENTIRE complete reply in this single turn before stopping.\nSplit every multi-paragraph reply into consecutive parallel `final` calls within this SAME turn (~300–600 characters or 1–2 paragraphs per call): set `more: true` on each continuing chunk and immediately emit the next `final` call, and set `more: false` ONLY on the final chunk after the entire requested length and story beat are complete.\n": "[DELIVERY RULE / 応答配信ルール]\nYou MUST deliver 100% of your user-facing reply through the `final` tool and NEVER output reply text directly outside `final`.\n`final` is a one-way streaming output sink and NEVER returns a tool result—there is NO follow-up turn. You MUST emit the ENTIRE complete reply in this single turn before stopping.\nSplit every multi-paragraph reply into consecutive parallel `final` calls within this SAME turn (~300–600 characters or 1–2 paragraphs per call): set `more: true` on each continuing chunk and immediately emit the next `final` call, and set `more: false` ONLY on the final chunk after the entire requested length and story beat are complete.\n", "读取 bidi WebChannel ACK: %w": "bidi WebChannel ACK の読み込み: {0}", "读取 bidi WebChannel Cookie: %w": "bidi WebChannel Cookie の読み込み: {0}", "读取 bidi WebChannel frame: %w": "bidi WebChannel frame の読み込み: {0}", @@ -1106,6 +1115,7 @@ "读取官网日志上下文: %w": "公式サイトログコンテキストの読み込み: {0}", "读取收缩模式: %w": "自動バキュームモードの読み取り: {0}", "读取最新发行版本: %w": "最新リリースバージョンの読み込み: {0}", + "读取本地日汇总: %w": "ローカルの日次集計を読み込み: {0}", "读取权益与模型目录": "プランとモデルを読み込み中", "读取浏览器 Cookie: %w": "ブラウザ Cookie の読み込み: {0}", "读取浏览器 tab: %w": "ブラウザ タブの読み込み: {0}", @@ -1233,7 +1243,7 @@ "释放管理界面启动进程: %w": "管理コンソール起動プロセスの解放: {0}", "释放账户 %s 的模型目录租约: %w": "アカウント {0} のモデル一覧リースの解放: {1}", "释放账户浏览器缓存: %w": "アカウント ブラウザ キャッシュの解放: {0}", - "重建本地日汇总: %w": "ローカル日次集計の再構築: {0}", + "重建汇总: %w": "集計の再構築: {0}", "重置协议运行时": "プロトコル ランタイムをリセット中", "重置账户 %s runtime: %w": "アカウント {0} runtime のリセット: {1}", "重置转录文件: %w": "文字起こしファイルのリセット: {0}", @@ -1243,6 +1253,7 @@ "锁定账户浏览器缓存: %w": "アカウント ブラウザ キャッシュのロック: {0}", "锁定账户租约: %w": "アカウント リースのロック: {0}", "锁定账户运行状态: %w": "アカウント実行状態のロック: {0}", + "长回复必须在当前这一回合内连续并行发出全部段落的 `final` 调用(每段约 300–600 字),未写完前设 `more: true` 并紧接着发出下一个 `final`,只有整篇达到要求长度并彻底写完后的最后一段才设 `more: false` 并结束回合。": "長文の応答は、現在のターン内にすべての段落の `final` 呼び出し(各段落約 300〜600 文字)を連続して並行して発行する必要があります。書き終わる前は `more: true` に設定して直ちに次の `final` を発行し、全体が必要な長さに達して完全に書き終えた最後の段落でのみ `more: false` に設定してターンを終了してください。", "隔离浏览器没有可导出的 Cookie": "隔離ブラウザにエクスポート可能な Cookie がありません", "隔离登录 Camoufox 指纹为空": "隔離ログインの Camoufox フィンガープリントが空です", "隔离登录: aistudio2api setup --login": "隔離ログイン: aistudio2api setup --login", @@ -1328,6 +1339,7 @@ "页面应用没有发出 GenerateContent": "ページアプリが GenerateContent を送信しませんでした", "读取官网 Run 按钮状态: %w": "公式サイトの Run ボタンの状態の読み取り: {0}", "解析官网 Run 按钮状态: %w": "公式サイトの Run ボタンの状態の解析: {0}", + "解析对话媒体引用: %w": "チャットのメディア参照を解析: {0}", "Run 按钮不存在": "Run ボタンがありません", "对话框 %q": "ダイアログ {0}", "遮挡 Run 按钮的元素 %q": "Run ボタンを覆っている要素 {0}", @@ -1539,9 +1551,10 @@ "只能在本机访问时关闭管理登录": "管理ログインの無効化はローカルアクセスからのみ可能です", "最新发行版本跳转缺少版本号": "最新リリースのリダイレクトにバージョンタグがありません", "等待换号间隔": "アカウント切替間隔を待機中", - "读取校验摘要: %w": "チェックサムの読み込み: {0}", "读取账户历史使用记录失败": "アカウント使用履歴の読み込みに失敗しました", "模型 %s 需要 %s,本次请求可用的账户 %s 都不具备": "モデル {0} には {1} が必要ですが、このリクエストで使用できるアカウント({2})はいずれも備えていません", "模型 %s 需要以下任一权益,本次请求可用的账户 %s 都不具备:%s": "モデル {0} には次のいずれかの権限が必要ですが、このリクエストで使用できるアカウント({1})はいずれも備えていません: {2}", - "Interaction 模型的 contents[%d] 不接受服务端工具步骤 %s": "Interaction モデルの contents[{0}] はサーバー側ツールのステップ {1} を受け付けません" + "Interaction 模型的 contents[%d] 不接受服务端工具步骤 %s": "Interaction モデルの contents[{0}] はサーバー側ツールのステップ {1} を受け付けません", + "模型 %s 已在设置中隐藏": "モデル {0} は設定で非表示になっています", + "Build 对话模型 %s 已在设置中关闭": "Build チャットモデル {0} は設定でオフになっています" } diff --git a/internal/i18n/messages/ko.json b/internal/i18n/messages/ko.json index 98fa8154..c7a35f07 100644 --- a/internal/i18n/messages/ko.json +++ b/internal/i18n/messages/ko.json @@ -1,5 +1,6 @@ { "%s 不可用": "{0} 사용 불가", + "%s 不接受 %s 工具": "{0}에서 {1} 도구를 지원하지 않습니다", "%s 之后没有可监听的端口": "{0} 이후에 수신 대기할 수 있는 포트가 없습니다", "%s 已停用": "{0} 사용 중지됨", "%s 必须是 host:port": "{0}은(는) host:port 형식이어야 합니다", @@ -31,6 +32,7 @@ "%w: %s 已由另一个 AIStudio2API runtime 使用": "{0}: {1}은(는) 다른 AIStudio2API runtime에서 이미 사용 중입니다", "%w: CountTokens model 不能为空": "{0}: CountTokens model은 비어 있을 수 없습니다", "%w: GenerateContent model 不能为空": "{0}: GenerateContent model은 비어 있을 수 없습니다", + "%w: Waa/Create 未确认账户会话": "{0}: Waa/Create에서 계정 세션을 확인하지 못했습니다", "%w: audio 未在 setup input_modalities 中声明": "{0}: setup input_modalities에 audio가 선언되지 않았습니다", "%w: bidi function response 列表为空": "{0}: bidi function response 목록이 비어 있습니다", "%w: bidi function response 缺少函数名": "{0}: bidi function response에 함수 이름이 없습니다", @@ -249,6 +251,7 @@ "Google 多账号会话序号 (0..9,对应 /u/0、/u/1...)": "Google 다중 계정 세션 번호 (0..9, /u/0, /u/1... 에 해당)", "INIT_TIMEOUT 必须是正数时长": "INIT_TIMEOUT은(는) 양수 시간이어야 합니다", "INIT_TIMEOUT 无效: %w": "INIT_TIMEOUT이 유효하지 않습니다: {0}", + "Interaction 模型": "Interaction 모델", "Interaction 模型不接受 %s 消息": "Interaction 모델은 {0} 메시지를 허용하지 않습니다", "Interaction 模型的 %w": "Interaction 모델의 {0}", "Interaction 模型的 contents[%d] 不接受视频截取、采样、处理方式与处理步骤": "Interaction 모델의 contents[{0}]에는 동영상 클립, 샘플링, 처리 방법 및 처리 단계를 지정할 수 없습니다", @@ -363,7 +366,6 @@ "WebChannel envelope 字段不足": "WebChannel envelope 필드가 부족합니다", "WebView2 运行时安装失败": "WebView2 런타임 설치 실패", "WriteProcessMemory 失败: %w": "WriteProcessMemory 실패: {0}", - "agent 不接受 %s 工具": "agent는 {0} 도구를 지원하지 않습니다", "agent_config.type %q 与 agent %s 不匹配,应为 %q": "agent_config.type {0}이(가) agent {1}과(와) 일치하지 않습니다. {2}이어야 합니다", "app_bound_encrypted_key 缺少 APPB 前缀": "app_bound_encrypted_key에 APPB 접두사가 없습니다", "behavior %q 无效,可用 BLOCKING 或 NON_BLOCKING": "behavior {0}이(가) 잘못되었습니다. BLOCKING 또는 NON_BLOCKING을 사용할 수 있습니다", @@ -442,7 +444,7 @@ "smart transcription 不能同时启用 word timestamps 或 speaker labels": "smart transcription은 word timestamps 또는 speaker labels와 동시에 사용할 수 없습니다", "speech config mode 只能用于 multi-speaker": "speech config mode는 multi-speaker에만 사용할 수 있습니다", "speech config mode 必须是 VERBATIM 或 CONVERSATIONAL": "speech config mode는 VERBATIM 또는 CONVERSATIONAL이어야 합니다", - "stack 必须是 model、account、channel、protocol 或 state": "stack은 model, account, channel, protocol 또는 state여야 합니다", + "stack 必须是 model、account、channel、protocol、state 或 api_key": "stack은 model, account, channel, protocol, state 또는 api_key여야 합니다", "status 必须是 HTTP 状态码": "status는 HTTP 상태 코드여야 합니다", "storage state Cookie %d 缺少名称或域": "storage state Cookie {0}에 이름 또는 도메인이 없습니다", "storage state Cookie %s 的 SameSite 无效": "storage state Cookie {0}의 SameSite가 잘못되었습니다", @@ -462,6 +464,8 @@ "video endOffset %s 必须晚于 startOffset %s": "video endOffset {0}은(는) startOffset {1}보다 뒤여야 합니다", "video offset %q 必须是秒数加 s 的 Duration,例如 \"2.5s\"": "video offset {0}은(는) \"2.5s\"와 같이 초 단위 숫자에 s가 붙은 Duration 형식이어야 합니다", "video task 必须是 text_to_video、image_to_video、reference_to_video、edit 或 extend": "video task는 text_to_video, image_to_video, reference_to_video, edit 또는 extend여야 합니다", + "【回复交付硬性要求】必须完全通过 `final(content=..., more=...)` 交付全部正文,禁止在 `final` 外直接输出正文。`final` 为单向流式输出,不会返回结果也没有后续回合": "【응답 전달 필수 요건】모든 본문은 반드시 `final(content=..., more=...)`을 통해서만 전달해야 하며, `final` 외부로 본문을 직접 출력하는 것은 금지됩니다. `final`은 단방향 스트리밍 출력이므로 결과를 반환하지 않고 후속 턴도 없습니다", + "【回复交付硬性要求】必须完全通过 `final(content=..., more=...)` 交付全部正文,禁止在 `final` 外直接输出正文。`final` 为单向流式输出,不会返回结果也没有后续回合;长回复必须在当前这一回合内连续并行发出全部段落的 `final` 调用(每段约 300–600 字),未写完前设 `more: true` 并紧接着发出下一个 `final`,只有整篇达到要求长度并彻底写完后的最后一段才设 `more: false` 并结束回合。": "【응답 전달 필수 요건】모든 본문은 반드시 `final(content=..., more=...)`을 통해서만 전달해야 하며, `final` 외부로 본문을 직접 출력하는 것은 금지됩니다. `final`은 단방향 스트리밍 출력이므로 결과를 반환하지 않고 후속 턴도 없습니다. 긴 응답은 반드시 현재 턴 내에서 모든 단락의 `final` 호출을 연속적이고 병렬적으로 전송해야 하며(단락당 약 300–600자), 작성을 마치기 전에는 `more: true`로 설정하고 즉시 다음 `final`을 호출해야 합니다. 전체 글이 요구 길이에 도달하여 완전히 작성을 마친 마지막 단락에서만 `more: false`로 설정하고 턴을 종료합니다.", "一行 Cookie 请求头": "한 줄 Cookie 요청 헤더", "上传 Drive 文件: %w": "Drive 파일 업로드: {0}", "上传 Drive 文件块: %w": "Drive 파일 청크 업로드: {0}", @@ -537,6 +541,7 @@ "关闭标签页: %w": "탭 닫기: {0}", "关闭配置: %w": "설정 닫기: {0}", "内联附件处理完成": "인라인 첨부파일 처리 완료", + "内联附件处理失败": "인라인 첨부파일 처리 실패", "写入 ABE helper: %w": "ABE helper 쓰기: {0}", "写入 Camoufox profile: %w": "Camoufox Profile 쓰기: {0}", "写入 Camoufox 字体配置: %w": "Camoufox 글꼴 설정 쓰기: {0}", @@ -550,6 +555,7 @@ "冷却已手动清除": "쿨다운 수동 해제됨", "冷却期限必须在未来": "쿨다운 만료 시점은 미래여야 합니다", "冷却检查时间不能为空": "쿨다운 확인 시간은 비워 둘 수 없습니다", + "准备 Drive discovery 请求失败": "Drive discovery 요청 준비 실패", "准备 bidi fresh WAA proof: %w": "bidi fresh WAA proof 준비: {0}", "准备 bidi setup fresh WAA proof: %w": "bidi setup fresh WAA proof 준비: {0}", "准备 fresh WAA proof: %w": "fresh WAA proof 준비: {0}", @@ -615,10 +621,7 @@ "参数值不能为空": "매개변수 값은 비워 둘 수 없습니다", "双引号值无效": "큰따옴표 값이 잘못되었습니다", "发布 Camoufox 目录: %w": "Camoufox 디렉터리 게시: {0}", - "发行包 %s 的 SHA-256 与发行版本记录不一致": "릴리스 패키지 {0}의 SHA-256이 릴리스 버전 기록과 일치하지 않습니다", - "发行包 %s 缺少 SHA-256 摘要": "릴리스 패키지 {0}에 SHA-256 다이제스트가 없습니다", "发行包中没有 %s": "릴리스 패키지에 {0}이(가) 없습니다", - "发行版本 %s 没有 %s": "릴리스 버전 {0}에 {1}이(가) 없습니다", "发送 AI Studio %s: %w": "AI Studio {0} 보내기: {1}", "发送 AI Studio CreateInteraction: %w": "AI Studio CreateInteraction 보내기: {0}", "发送 AI Studio CreateInteractionStream: %w": "AI Studio CreateInteractionStream 보내기: {0}", @@ -637,6 +640,7 @@ "同步官网 prompt": "공식 prompt 동기화", "同步配置: %w": "설정 동기화: {0}", "后台下载 WebView2 引导程序失败,重新下载": "WebView2 부트스트래퍼 백그라운드 다운로드 실패, 다시 다운로드합니다", + "后台读取 Drive discovery 失败": "백그라운드 Drive discovery 읽기 실패", "启动 Camoufox": "Camoufox 실행 중", "启动 Camoufox: %w": "Camoufox 시작: {0}", "启动 Xvfb: %w": "Xvfb 시작: {0}", @@ -650,6 +654,7 @@ "响应后存在第二个根值": "응답 뒤에 두 번째 루트 값이 있음", "响应字节不是 Base64": "응답 바이트가 Base64가 아님", "响应角色不是 model": "응답 역할이 model이 아님", + "回收未绑定内联附件失败": "연결되지 않은 인라인 첨부 파일 회수 실패", "在 .env 的 PROXY 设置能访问 GitHub 的代理后重试,或手动下载 %s 解压到 %s": ".env의 PROXY에 GitHub에 접속할 수 있는 프록시를 설정한 뒤 다시 시도하거나, {0}을(를) 직접 다운로드해 {1}에 압축을 푸세요", "在前台为本机上传到 --remote 实例的 Chrome 导入账户按时续签,用于重启电脑后恢复续签": "포그라운드에서 이 컴퓨터가 --remote 인스턴스에 업로드한 Chrome 가져오기 계정을 제때 갱신합니다(컴퓨터 재부팅 후 갱신 복원용)", "在线更新": "온라인 업데이트", @@ -840,6 +845,7 @@ "根数组缺少响应列表": "루트 배열에 응답 목록이 없습니다", "检查隔离登录页面: %w": "격리 로그인 페이지 확인: {0}", "检测代理池": "프록시 풀 확인 중", + "模型 %s 不接受 agent_config": "모델 {0}에서 agent_config를 지원하지 않습니다", "模型 %s 不支持 %s": "모델 {0}에서 {1}을(를) 지원하지 않습니다", "模型 %s 没有 %s 任务": "모델 {0}에 {1} 작업이 없습니다", "模型 %s 没有尾帧输入": "모델 {0}에 마지막 프레임 입력이 없습니다", @@ -864,6 +870,7 @@ "每日限额": "일일 한도", "没有 DISPLAY 时 Camoufox 需要 Xvfb: %w": "DISPLAY가 없을 때 Camoufox에는 Xvfb가 필요합니다: {0}", "没有 DISPLAY 时 Camoufox 需要 Xvfb,执行 %s 后重试: %w": "DISPLAY가 없을 때 Camoufox에는 Xvfb가 필요합니다. {0}을(를) 실행한 뒤 다시 시도하세요: {1}", + "没有其他工具,严禁调用或编造 `final` 以外的任何函数。": "다른 도구가 없으므로 `final` 이외의 함수를 호출하거나 지어내는 것을 엄격히 금지합니다.", "没有可安装的新版本": "설치 가능한 최신 버전이 없습니다", "没有可预热的账户: %w": "웜업할 수 있는 계정이 없습니다: {0}", "没有找到 WebView2 运行时,管理页面在默认浏览器中打开": "WebView2 런타임을 찾을 수 없어 기본 브라우저에서 관리 페이지를 엽니다", @@ -1056,7 +1063,7 @@ "请求正文不存在": "요청 본문이 없습니다", "请求账本写入失败": "요청 원장 쓰기 실패", "请求账本写入队列已满": "요청 원장 쓰기 대기열 가득 참", - "请求账本已按服务器时区重建本地日汇总": "요청 원장이 서버 시간대에 따라 로컬 일별 요약을 재구성했습니다", + "请求账本已从请求记录重建汇总": "요청 기록에서 요청 원장 요약을 재구성했습니다", "请求账本清理失败": "요청 원장 정리 실패", "请粘贴远程实例账户页生成的配对令牌: ": "원격 인스턴스 계정 페이지에서 생성된 페어링 토큰을 붙여넣으세요: ", "请输入逗号分隔的编号: ": "쉼표로 구분된 번호를 입력하세요: ", @@ -1094,6 +1101,8 @@ "读取 ListModels: %w": "ListModels 읽기: {0}", "读取 OAuthMultilogin 响应: %w": "OAuthMultilogin 응답 읽기: {0}", "Xvfb 在报告显示号前退出:%s": "Xvfb가 디스플레이 번호를 보고하기 전에 종료되었습니다: {0}", + "[DELIVERY RULE / 回复交付规则]": "[DELIVERY RULE / 응답 전달 규칙]", + "[DELIVERY RULE / 回复交付规则]\nYou MUST deliver 100%% of your user-facing reply through the `final` tool and NEVER output reply text directly outside `final`.\n`final` is a one-way streaming output sink and NEVER returns a tool result—there is NO follow-up turn. You MUST emit the ENTIRE complete reply in this single turn before stopping.\nSplit every multi-paragraph reply into consecutive parallel `final` calls within this SAME turn (~300–600 characters or 1–2 paragraphs per call): set `more: true` on each continuing chunk and immediately emit the next `final` call, and set `more: false` ONLY on the final chunk after the entire requested length and story beat are complete.\n": "[DELIVERY RULE / 응답 전달 규칙]\nYou MUST deliver 100% of your user-facing reply through the `final` tool and NEVER output reply text directly outside `final`.\n`final` is a one-way streaming output sink and NEVER returns a tool result—there is NO follow-up turn. You MUST emit the ENTIRE complete reply in this single turn before stopping.\nSplit every multi-paragraph reply into consecutive parallel `final` calls within this SAME turn (~300–600 characters or 1–2 paragraphs per call): set `more: true` on each continuing chunk and immediately emit the next `final` call, and set `more: false` ONLY on the final chunk after the entire requested length and story beat are complete.\n", "读取 bidi WebChannel ACK: %w": "bidi WebChannel ACK 읽기: {0}", "读取 bidi WebChannel Cookie: %w": "bidi WebChannel 쿠키 읽기: {0}", "读取 bidi WebChannel frame: %w": "bidi WebChannel frame 읽기: {0}", @@ -1106,6 +1115,7 @@ "读取官网日志上下文: %w": "공식 사이트 로그 컨텍스트 읽기: {0}", "读取收缩模式: %w": "자동 정리 모드 읽기: {0}", "读取最新发行版本: %w": "최신 릴리스 버전 읽기: {0}", + "读取本地日汇总: %w": "로컬 일일 요약 읽기: {0}", "读取权益与模型目录": "요금제와 모델을 읽는 중", "读取浏览器 Cookie: %w": "브라우저 쿠키 읽기: {0}", "读取浏览器 tab: %w": "브라우저 tab 읽기: {0}", @@ -1233,7 +1243,7 @@ "释放管理界面启动进程: %w": "콘솔 시작 프로세스 해제: {0}", "释放账户 %s 的模型目录租约: %w": "계정 {0}의 모델 목록 임대 해제: {1}", "释放账户浏览器缓存: %w": "계정 브라우저 캐시 해제: {0}", - "重建本地日汇总: %w": "로컬 일별 요약 다시 빌드: {0}", + "重建汇总: %w": "요약 재구성: {0}", "重置协议运行时": "프로토콜 런타임 재설정 중", "重置账户 %s runtime: %w": "계정 {0} runtime 재설정: {1}", "重置转录文件: %w": "전사 파일 재설정: {0}", @@ -1243,6 +1253,7 @@ "锁定账户浏览器缓存: %w": "계정 브라우저 캐시 잠금: {0}", "锁定账户租约: %w": "계정 임대 잠금: {0}", "锁定账户运行状态: %w": "계정 실행 상태 잠금: {0}", + "长回复必须在当前这一回合内连续并行发出全部段落的 `final` 调用(每段约 300–600 字),未写完前设 `more: true` 并紧接着发出下一个 `final`,只有整篇达到要求长度并彻底写完后的最后一段才设 `more: false` 并结束回合。": "긴 응답은 반드시 현재 턴 내에서 모든 단락의 `final` 호출을 연속적이고 병렬적으로 전송해야 하며(단락당 약 300–600자), 작성을 마치기 전에는 `more: true`로 설정하고 즉시 다음 `final`을 호출해야 합니다. 전체 글이 요구 길이에 도달하여 완전히 작성을 마친 마지막 단락에서만 `more: false`로 설정하고 턴을 종료합니다.", "隔离浏览器没有可导出的 Cookie": "격리 브라우저에 내보낼 쿠키가 없습니다", "隔离登录 Camoufox 指纹为空": "격리 로그인 Camoufox 지문이 비어 있습니다", "隔离登录: aistudio2api setup --login": "격리 로그인: aistudio2api setup --login", @@ -1328,6 +1339,7 @@ "页面应用没有发出 GenerateContent": "페이지 앱이 GenerateContent를 전송하지 않았습니다", "读取官网 Run 按钮状态: %w": "공식 사이트 Run 버튼 상태 읽기: {0}", "解析官网 Run 按钮状态: %w": "공식 사이트 Run 버튼 상태 파싱: {0}", + "解析对话媒体引用: %w": "채팅 미디어 참조 구문 분석: {0}", "Run 按钮不存在": "Run 버튼이 없습니다", "对话框 %q": "대화상자 {0}", "遮挡 Run 按钮的元素 %q": "Run 버튼을 가리는 요소 {0}", @@ -1539,9 +1551,10 @@ "只能在本机访问时关闭管理登录": "관리 로그인은 로컬 접속에서만 비활성화할 수 있습니다", "最新发行版本跳转缺少版本号": "최신 릴리스 리디렉션에 버전 태그가 없습니다", "等待换号间隔": "계정 전환 간격 대기 중", - "读取校验摘要: %w": "체크섬 읽기: {0}", "读取账户历史使用记录失败": "계정 사용 기록 읽기 실패", "模型 %s 需要 %s,本次请求可用的账户 %s 都不具备": "모델 {0}에는 {1}이(가) 필요하지만 이 요청에서 사용할 수 있는 계정({2})에 없습니다", "模型 %s 需要以下任一权益,本次请求可用的账户 %s 都不具备:%s": "모델 {0}에는 다음 권한 중 하나가 필요하지만 이 요청에서 사용할 수 있는 계정({1})에 없습니다: {2}", - "Interaction 模型的 contents[%d] 不接受服务端工具步骤 %s": "Interaction 모델의 contents[{0}]은(는) 서버 측 도구 단계 {1}을(를) 허용하지 않습니다" + "Interaction 模型的 contents[%d] 不接受服务端工具步骤 %s": "Interaction 모델의 contents[{0}]은(는) 서버 측 도구 단계 {1}을(를) 허용하지 않습니다", + "模型 %s 已在设置中隐藏": "모델 {0}은(는) 설정에서 숨겨져 있습니다", + "Build 对话模型 %s 已在设置中关闭": "Build 대화 모델 {0}이(가) 설정에서 꺼져 있습니다" } diff --git a/internal/i18n/messages/zh-TW.json b/internal/i18n/messages/zh-TW.json index a60f5c95..b4628622 100644 --- a/internal/i18n/messages/zh-TW.json +++ b/internal/i18n/messages/zh-TW.json @@ -1,5 +1,6 @@ { "%s 不可用": "{0} 無法使用", + "%s 不接受 %s 工具": "{0} 不接受 {1} 工具", "%s 之后没有可监听的端口": "{0} 之後沒有可監聽的連接埠", "%s 已停用": "{0} 已停用", "%s 必须是 host:port": "{0} 必須是 host:port", @@ -31,6 +32,7 @@ "%w: %s 已由另一个 AIStudio2API runtime 使用": "{0}: {1} 已由另一個 AIStudio2API runtime 使用", "%w: CountTokens model 不能为空": "{0}: CountTokens model 不能為空", "%w: GenerateContent model 不能为空": "{0}: GenerateContent model 不能為空", + "%w: Waa/Create 未确认账户会话": "{0}: Waa/Create 未確認帳號工作階段", "%w: audio 未在 setup input_modalities 中声明": "{0}: audio 未在 setup input_modalities 中宣告", "%w: bidi function response 列表为空": "{0}: bidi function response 清單為空", "%w: bidi function response 缺少函数名": "{0}: bidi function response 缺少函式名稱", @@ -249,6 +251,7 @@ "Google 多账号会话序号 (0..9,对应 /u/0、/u/1...)": "Google 多帳號工作階段序號 (0..9,對應 /u/0、/u/1...)", "INIT_TIMEOUT 必须是正数时长": "INIT_TIMEOUT 必須是正數時間長度", "INIT_TIMEOUT 无效: %w": "INIT_TIMEOUT 無效: {0}", + "Interaction 模型": "Interaction 模型", "Interaction 模型不接受 %s 消息": "Interaction 模型不接受 {0} 訊息", "Interaction 模型的 %w": "Interaction 模型的 {0}", "Interaction 模型的 contents[%d] 不接受视频截取、采样、处理方式与处理步骤": "Interaction 模型的 contents[{0}] 不接受影片擷取、取樣、處理方式與處理步驟", @@ -363,7 +366,6 @@ "WebChannel envelope 字段不足": "WebChannel envelope 欄位不足", "WebView2 运行时安装失败": "WebView2 執行階段安裝失敗", "WriteProcessMemory 失败: %w": "WriteProcessMemory 失敗: {0}", - "agent 不接受 %s 工具": "agent 不接受 {0} 工具", "agent_config.type %q 与 agent %s 不匹配,应为 %q": "agent_config.type {0} 與 agent {1} 不相符,應為 {2}", "app_bound_encrypted_key 缺少 APPB 前缀": "app_bound_encrypted_key 缺少 APPB 字首", "behavior %q 无效,可用 BLOCKING 或 NON_BLOCKING": "behavior {0} 無效,可用 BLOCKING 或 NON_BLOCKING", @@ -442,7 +444,7 @@ "smart transcription 不能同时启用 word timestamps 或 speaker labels": "smart transcription 不能同時啟用 word timestamps 或 speaker labels", "speech config mode 只能用于 multi-speaker": "speech config mode 只能用於 multi-speaker", "speech config mode 必须是 VERBATIM 或 CONVERSATIONAL": "speech config mode 必須是 VERBATIM 或 CONVERSATIONAL", - "stack 必须是 model、account、channel、protocol 或 state": "stack 必須是 model、account、channel、protocol 或 state", + "stack 必须是 model、account、channel、protocol、state 或 api_key": "stack 必須是 model、account、channel、protocol、state 或 api_key", "status 必须是 HTTP 状态码": "status 必須是 HTTP 狀態碼", "storage state Cookie %d 缺少名称或域": "storage state Cookie {0} 缺少名稱或網域", "storage state Cookie %s 的 SameSite 无效": "storage state Cookie {0} 的 SameSite 無效", @@ -462,6 +464,8 @@ "video endOffset %s 必须晚于 startOffset %s": "video endOffset {0} 必須晚於 startOffset {1}", "video offset %q 必须是秒数加 s 的 Duration,例如 \"2.5s\"": "video offset {0} 必須是秒數加 s 的 Duration,例如 \"2.5s\"", "video task 必须是 text_to_video、image_to_video、reference_to_video、edit 或 extend": "video task 必須是 text_to_video、image_to_video、reference_to_video、edit 或 extend", + "【回复交付硬性要求】必须完全通过 `final(content=..., more=...)` 交付全部正文,禁止在 `final` 外直接输出正文。`final` 为单向流式输出,不会返回结果也没有后续回合": "【回覆交付硬性要求】必須完全透過 `final(content=..., more=...)` 交付全部內文,禁止在 `final` 外直接輸出內文。`final` 為單向串流輸出,不會返回結果也沒有後續回合", + "【回复交付硬性要求】必须完全通过 `final(content=..., more=...)` 交付全部正文,禁止在 `final` 外直接输出正文。`final` 为单向流式输出,不会返回结果也没有后续回合;长回复必须在当前这一回合内连续并行发出全部段落的 `final` 调用(每段约 300–600 字),未写完前设 `more: true` 并紧接着发出下一个 `final`,只有整篇达到要求长度并彻底写完后的最后一段才设 `more: false` 并结束回合。": "【回覆交付硬性要求】必須完全透過 `final(content=..., more=...)` 交付全部內文,禁止在 `final` 外直接輸出內文。`final` 為單向串流輸出,不會返回結果也沒有後續回合;長回覆必須在目前這一回合內連續並行發出全部段落的 `final` 呼叫(每段約 300–600 字),未寫完前設 `more: true` 並緊接著發出下一個 `final`,只有整篇達到要求長度並徹底寫完後的最後一段才設 `more: false` 並結束回合。", "一行 Cookie 请求头": "一行 Cookie 請求標頭", "上传 Drive 文件: %w": "上傳 Drive 檔案: {0}", "上传 Drive 文件块: %w": "上傳 Drive 檔案區塊: {0}", @@ -537,6 +541,7 @@ "关闭标签页: %w": "關閉分頁: {0}", "关闭配置: %w": "關閉設定: {0}", "内联附件处理完成": "內嵌附件處理完成", + "内联附件处理失败": "內嵌附件處理失敗", "写入 ABE helper: %w": "寫入 ABE helper: {0}", "写入 Camoufox profile: %w": "寫入 Camoufox profile: {0}", "写入 Camoufox 字体配置: %w": "寫入 Camoufox 字型設定: {0}", @@ -550,6 +555,7 @@ "冷却已手动清除": "冷卻已手動清除", "冷却期限必须在未来": "冷卻期限必須在未來", "冷却检查时间不能为空": "冷卻檢查時間不能為空", + "准备 Drive discovery 请求失败": "準備 Drive discovery 請求失敗", "准备 bidi fresh WAA proof: %w": "準備 bidi fresh WAA proof: {0}", "准备 bidi setup fresh WAA proof: %w": "準備 bidi setup fresh WAA proof: {0}", "准备 fresh WAA proof: %w": "準備 fresh WAA proof: {0}", @@ -615,10 +621,7 @@ "参数值不能为空": "參數值不能為空", "双引号值无效": "雙引號值無效", "发布 Camoufox 目录: %w": "發布 Camoufox 目錄: {0}", - "发行包 %s 的 SHA-256 与发行版本记录不一致": "發行套件 {0} 的 SHA-256 與發行版本記錄不一致", - "发行包 %s 缺少 SHA-256 摘要": "發行套件 {0} 缺少 SHA-256 摘要", "发行包中没有 %s": "發行套件中沒有 {0}", - "发行版本 %s 没有 %s": "發行版本 {0} 沒有 {1}", "发送 AI Studio %s: %w": "傳送 AI Studio {0}: {1}", "发送 AI Studio CreateInteraction: %w": "傳送 AI Studio CreateInteraction: {0}", "发送 AI Studio CreateInteractionStream: %w": "傳送 AI Studio CreateInteractionStream: {0}", @@ -637,6 +640,7 @@ "同步官网 prompt": "同步官網 prompt", "同步配置: %w": "同步設定: {0}", "后台下载 WebView2 引导程序失败,重新下载": "背景下載 WebView2 引導程式失敗,重新下載", + "后台读取 Drive discovery 失败": "後台讀取 Drive discovery 失敗", "启动 Camoufox": "啟動 Camoufox", "启动 Camoufox: %w": "啟動 Camoufox: {0}", "启动 Xvfb: %w": "啟動 Xvfb: {0}", @@ -650,6 +654,7 @@ "响应后存在第二个根值": "回應後存在第二個根值", "响应字节不是 Base64": "回應位元組不是 Base64", "响应角色不是 model": "回應角色不是 model", + "回收未绑定内联附件失败": "回收未綁定內嵌附件失敗", "在 .env 的 PROXY 设置能访问 GitHub 的代理后重试,或手动下载 %s 解压到 %s": "在 .env 的 PROXY 設定能存取 GitHub 的代理伺服器後重試,或手動下載 {0} 解壓縮到 {1}", "在前台为本机上传到 --remote 实例的 Chrome 导入账户按时续签,用于重启电脑后恢复续签": "在前景為本機上傳到 --remote 執行個體的 Chrome 匯入帳號按時續簽,用於重開機後恢復續簽", "在线更新": "線上更新", @@ -840,6 +845,7 @@ "根数组缺少响应列表": "根陣列缺少回應清單", "检查隔离登录页面: %w": "檢查隔離登入頁面: {0}", "检测代理池": "檢測代理池", + "模型 %s 不接受 agent_config": "模型 {0} 不接受 agent_config", "模型 %s 不支持 %s": "模型 {0} 不支援 {1}", "模型 %s 没有 %s 任务": "模型 {0} 沒有 {1} 任務", "模型 %s 没有尾帧输入": "模型 {0} 沒有結尾影格輸入", @@ -864,6 +870,7 @@ "每日限额": "每日限額", "没有 DISPLAY 时 Camoufox 需要 Xvfb: %w": "沒有 DISPLAY 時 Camoufox 需要 Xvfb: {0}", "没有 DISPLAY 时 Camoufox 需要 Xvfb,执行 %s 后重试: %w": "沒有 DISPLAY 時 Camoufox 需要 Xvfb,執行 {0} 後重試: {1}", + "没有其他工具,严禁调用或编造 `final` 以外的任何函数。": "沒有其他工具,嚴禁呼叫或編造 `final` 以外的任何函式。", "没有可安装的新版本": "沒有可安裝的新版本", "没有可预热的账户: %w": "沒有可預熱的帳號: {0}", "没有找到 WebView2 运行时,管理页面在默认浏览器中打开": "沒有找到 WebView2 執行階段,管理頁面在預設瀏覽器中開啟", @@ -1056,7 +1063,7 @@ "请求正文不存在": "請求內文不存在", "请求账本写入失败": "請求帳本寫入失敗", "请求账本写入队列已满": "請求帳本寫入佇列已滿", - "请求账本已按服务器时区重建本地日汇总": "請求帳本已按伺服器時區重建本機日彙總", + "请求账本已从请求记录重建汇总": "請求帳本已從請求記錄重建彙總", "请求账本清理失败": "請求帳本清理失敗", "请粘贴远程实例账户页生成的配对令牌: ": "請貼上遠端執行個體帳號頁產生的配對權杖: ", "请输入逗号分隔的编号: ": "請輸入逗號分隔的編號: ", @@ -1094,6 +1101,8 @@ "读取 ListModels: %w": "讀取 ListModels: {0}", "读取 OAuthMultilogin 响应: %w": "讀取 OAuthMultilogin 回應: {0}", "Xvfb 在报告显示号前退出:%s": "Xvfb 在回報顯示號前結束:{0}", + "[DELIVERY RULE / 回复交付规则]": "[DELIVERY RULE / 回覆交付規則]", + "[DELIVERY RULE / 回复交付规则]\nYou MUST deliver 100%% of your user-facing reply through the `final` tool and NEVER output reply text directly outside `final`.\n`final` is a one-way streaming output sink and NEVER returns a tool result—there is NO follow-up turn. You MUST emit the ENTIRE complete reply in this single turn before stopping.\nSplit every multi-paragraph reply into consecutive parallel `final` calls within this SAME turn (~300–600 characters or 1–2 paragraphs per call): set `more: true` on each continuing chunk and immediately emit the next `final` call, and set `more: false` ONLY on the final chunk after the entire requested length and story beat are complete.\n": "[DELIVERY RULE / 回覆交付規則]\nYou MUST deliver 100% of your user-facing reply through the `final` tool and NEVER output reply text directly outside `final`.\n`final` is a one-way streaming output sink and NEVER returns a tool result—there is NO follow-up turn. You MUST emit the ENTIRE complete reply in this single turn before stopping.\nSplit every multi-paragraph reply into consecutive parallel `final` calls within this SAME turn (~300–600 characters or 1–2 paragraphs per call): set `more: true` on each continuing chunk and immediately emit the next `final` call, and set `more: false` ONLY on the final chunk after the entire requested length and story beat are complete.\n", "读取 bidi WebChannel ACK: %w": "讀取 bidi WebChannel ACK: {0}", "读取 bidi WebChannel Cookie: %w": "讀取 bidi WebChannel Cookie: {0}", "读取 bidi WebChannel frame: %w": "讀取 bidi WebChannel frame: {0}", @@ -1106,6 +1115,7 @@ "读取官网日志上下文: %w": "讀取官網記錄上下文: {0}", "读取收缩模式: %w": "讀取收縮模式: {0}", "读取最新发行版本: %w": "讀取最新發行版本: {0}", + "读取本地日汇总: %w": "讀取本地日彙總: {0}", "读取权益与模型目录": "讀取方案與模型目錄", "读取浏览器 Cookie: %w": "讀取瀏覽器 Cookie: {0}", "读取浏览器 tab: %w": "讀取瀏覽器分頁: {0}", @@ -1233,7 +1243,7 @@ "释放管理界面启动进程: %w": "釋放管理介面啟動程序: {0}", "释放账户 %s 的模型目录租约: %w": "釋放帳號 {0} 的模型目錄租約: {1}", "释放账户浏览器缓存: %w": "釋放帳號瀏覽器快取: {0}", - "重建本地日汇总: %w": "重建本機日彙總: {0}", + "重建汇总: %w": "重建彙總: {0}", "重置协议运行时": "重設協定執行階段", "重置账户 %s runtime: %w": "重設帳號 {0} runtime: {1}", "重置转录文件: %w": "重設轉錄檔案: {0}", @@ -1243,6 +1253,7 @@ "锁定账户浏览器缓存: %w": "鎖定帳號瀏覽器快取: {0}", "锁定账户租约: %w": "鎖定帳號租約: {0}", "锁定账户运行状态: %w": "鎖定帳號執行狀態: {0}", + "长回复必须在当前这一回合内连续并行发出全部段落的 `final` 调用(每段约 300–600 字),未写完前设 `more: true` 并紧接着发出下一个 `final`,只有整篇达到要求长度并彻底写完后的最后一段才设 `more: false` 并结束回合。": "長回覆必須在目前這一回合內連續並行發出全部段落的 `final` 呼叫(每段約 300–600 字),未寫完前設 `more: true` 並緊接著發出下一個 `final`,只有整篇達到要求長度並徹底寫完後的最後一段才設 `more: false` 並結束回合。", "隔离浏览器没有可导出的 Cookie": "隔離瀏覽器沒有可匯出的 Cookie", "隔离登录 Camoufox 指纹为空": "隔離登入 Camoufox 指紋為空", "隔离登录: aistudio2api setup --login": "隔離登入: aistudio2api setup --login", @@ -1328,6 +1339,7 @@ "页面应用没有发出 GenerateContent": "頁面應用程式沒有發出 GenerateContent", "读取官网 Run 按钮状态: %w": "讀取官網 Run 按鈕狀態: {0}", "解析官网 Run 按钮状态: %w": "解析官網 Run 按鈕狀態: {0}", + "解析对话媒体引用: %w": "解析對話媒體引用: {0}", "Run 按钮不存在": "Run 按鈕不存在", "对话框 %q": "對話方塊 {0}", "遮挡 Run 按钮的元素 %q": "遮住 Run 按鈕的元素 {0}", @@ -1539,9 +1551,10 @@ "只能在本机访问时关闭管理登录": "只能在本機存取時關閉管理登入", "最新发行版本跳转缺少版本号": "最新發行版本跳轉缺少版本號", "等待换号间隔": "等待換號間隔", - "读取校验摘要: %w": "讀取校驗摘要: {0}", "读取账户历史使用记录失败": "讀取帳號歷史使用記錄失敗", "模型 %s 需要 %s,本次请求可用的账户 %s 都不具备": "模型 {0} 需要 {1},本次請求可用的帳號 {2} 都不具備", "模型 %s 需要以下任一权益,本次请求可用的账户 %s 都不具备:%s": "模型 {0} 需要以下任一權益,本次請求可用的帳號 {1} 都不具備:{2}", - "Interaction 模型的 contents[%d] 不接受服务端工具步骤 %s": "Interaction 模型的 contents[{0}] 不接受伺服器端工具步驟 {1}" + "Interaction 模型的 contents[%d] 不接受服务端工具步骤 %s": "Interaction 模型的 contents[{0}] 不接受伺服器端工具步驟 {1}", + "模型 %s 已在设置中隐藏": "模型 {0} 已在設定中隱藏", + "Build 对话模型 %s 已在设置中关闭": "Build 對話模型 {0} 已在設定中關閉" } diff --git a/internal/promptdb/promptdb.go b/internal/promptdb/promptdb.go index 29216b33..95dd8260 100644 --- a/internal/promptdb/promptdb.go +++ b/internal/promptdb/promptdb.go @@ -63,7 +63,7 @@ func Open(path string) (*Store, error) { if err := os.MkdirAll(dir, 0o755); err != nil { return nil, err } - db, err := sqlitedb.Open(path, schema, 0) + db, _, err := sqlitedb.Open(path, schema, 0) if err != nil { return nil, fmt.Errorf("初始化对话库: %w", err) } diff --git a/internal/requestdb/records.go b/internal/requestdb/records.go index 50b54b15..4a430c8c 100644 --- a/internal/requestdb/records.go +++ b/internal/requestdb/records.go @@ -15,7 +15,7 @@ import ( ) // recordColumns 是请求记录查询读取的列,最后一列表示是否保存了正文 -const recordColumns = `r.id, r.time, r.protocol, r.path, r.model, r.account, r.channel, r.status, r.state, +const recordColumns = `r.id, r.time, r.protocol, r.path, r.model, r.account, r.channel, r.api_key, r.status, r.state, r.duration_ms, r.first_event_ms, r.queue_ms, r.input_tokens, r.cached_tokens, r.reasoning_tokens, r.reply_tokens, r.total_tokens, r.tool_calls, r.reply_tool, r.reply_tool_calls, r.reply_tool_continuations, r.error, r.attempts, r.proof_ms, r.proof_lock_ms, r.proof_interaction_ms, r.proof_refresh_ms, r.proof_compute_ms, EXISTS(SELECT 1 FROM request_bodies b WHERE b.id = r.id)` @@ -43,7 +43,7 @@ func scanRecord(rows *sql.Rows) (api.UsageRecord, error) { var at int64 var replyTool int var attempts string - err := rows.Scan(&record.ID, &at, &record.Protocol, &record.Path, &record.Model, &record.Account, &record.Channel, + err := rows.Scan(&record.ID, &at, &record.Protocol, &record.Path, &record.Model, &record.Account, &record.Channel, &record.APIKey, &record.Status, &record.State, &record.DurationMS, &record.FirstEventMS, &record.QueueMS, &record.InputTokens, &record.CachedTokens, &record.ReasoningTokens, &record.ReplyTokens, &record.TotalTokens, &record.ToolCalls, &replyTool, &record.ReplyToolCalls, &record.ReplyToolContinuations, &record.Error, &attempts, @@ -93,7 +93,7 @@ func (store *Store) Records(ctx context.Context, query api.UsageRecordQuery) (ap // csvHeader 是导出文件的列名 var csvHeader = []string{ - "time", "id", "protocol", "path", "model", "account", "channel", "status", "state", "duration_ms", "first_event_ms", + "time", "id", "protocol", "path", "model", "account", "channel", "api_key", "status", "state", "duration_ms", "first_event_ms", "queue_ms", "input_tokens", "cached_tokens", "reasoning_tokens", "reply_tokens", "total_tokens", "tool_calls", "reply_tool", "reply_tool_calls", "reply_tool_continuations", "error", "attempts", "proof_ms", "proof_lock_ms", "proof_interaction_ms", "proof_refresh_ms", "proof_compute_ms", } @@ -137,7 +137,7 @@ func (store *Store) ExportRecords(ctx context.Context, query api.UsageRecordQuer integer := func(value int64) string { return strconv.FormatInt(value, 10) } if err := writer.Write([]string{ record.Time.Format(time.RFC3339Nano), record.ID, record.Protocol, csvText(record.Path), csvText(record.Model), - csvText(record.Account), record.Channel, strconv.Itoa(record.Status), record.State, integer(record.DurationMS), + csvText(record.Account), record.Channel, record.APIKey, strconv.Itoa(record.Status), record.State, integer(record.DurationMS), integer(record.FirstEventMS), integer(record.QueueMS), integer(record.InputTokens), integer(record.CachedTokens), integer(record.ReasoningTokens), integer(record.ReplyTokens), integer(record.TotalTokens), strconv.Itoa(record.ToolCalls), strconv.FormatBool(record.ReplyTool), strconv.Itoa(record.ReplyToolCalls), strconv.Itoa(record.ReplyToolContinuations), csvText(record.Error), string(attempts), integer(record.ProofMS), milliseconds(record.ProofPhases.LockMS), milliseconds(record.ProofPhases.InteractionMS), diff --git a/internal/requestdb/requestdb.go b/internal/requestdb/requestdb.go index 70f37a86..22451eb0 100644 --- a/internal/requestdb/requestdb.go +++ b/internal/requestdb/requestdb.go @@ -11,6 +11,7 @@ import ( "io" "os" "path/filepath" + "slices" "sync" "sync/atomic" "time" @@ -41,11 +42,14 @@ const hourMS = int64(time.Hour / time.Millisecond) // rollupColumns 是小时与本地日汇总表的列,start 是分段起点 const rollupColumns = ` start INTEGER NOT NULL, model TEXT NOT NULL, account TEXT NOT NULL, channel TEXT NOT NULL, protocol TEXT NOT NULL, - state TEXT NOT NULL, status INTEGER NOT NULL, requests INTEGER NOT NULL, - input_tokens INTEGER NOT NULL, reasoning_tokens INTEGER NOT NULL, reply_tokens INTEGER NOT NULL, total_tokens INTEGER NOT NULL, - duration_ms INTEGER NOT NULL, first_event_ms INTEGER NOT NULL, first_events INTEGER NOT NULL, queue_ms INTEGER NOT NULL, - duration_hist BLOB NOT NULL, first_event_hist BLOB NOT NULL, last_time INTEGER NOT NULL, cached_tokens INTEGER NOT NULL DEFAULT 0, - PRIMARY KEY (start, model, account, channel, protocol, state, status)` + api_key TEXT NOT NULL, state TEXT NOT NULL, status INTEGER NOT NULL, requests INTEGER NOT NULL, + input_tokens INTEGER NOT NULL, cached_tokens INTEGER NOT NULL, reasoning_tokens INTEGER NOT NULL, reply_tokens INTEGER NOT NULL, + total_tokens INTEGER NOT NULL, duration_ms INTEGER NOT NULL, first_event_ms INTEGER NOT NULL, first_events INTEGER NOT NULL, + queue_ms INTEGER NOT NULL, duration_hist BLOB NOT NULL, first_event_hist BLOB NOT NULL, last_time INTEGER NOT NULL, + PRIMARY KEY (start, model, account, channel, protocol, api_key, state, status)` + +// rollupTables 是可由 requests 重建的汇总表 +var rollupTables = []string{"hours", "days"} const schema = ` CREATE TABLE IF NOT EXISTS requests ( @@ -56,9 +60,10 @@ CREATE TABLE IF NOT EXISTS requests ( total_tokens INTEGER NOT NULL, tool_calls INTEGER NOT NULL, error TEXT NOT NULL, attempts TEXT NOT NULL, cached_tokens INTEGER NOT NULL DEFAULT 0, proof_ms INTEGER NOT NULL DEFAULT 0, proof_lock_ms INTEGER NOT NULL DEFAULT 0, proof_interaction_ms INTEGER NOT NULL DEFAULT 0, proof_refresh_ms INTEGER NOT NULL DEFAULT 0, proof_compute_ms INTEGER NOT NULL DEFAULT 0, - reply_tool INTEGER NOT NULL DEFAULT 0, reply_tool_calls INTEGER NOT NULL DEFAULT 0, reply_tool_continuations INTEGER NOT NULL DEFAULT 0); + reply_tool INTEGER NOT NULL DEFAULT 0, reply_tool_calls INTEGER NOT NULL DEFAULT 0, reply_tool_continuations INTEGER NOT NULL DEFAULT 0, + api_key TEXT NOT NULL DEFAULT ''); CREATE INDEX IF NOT EXISTS requests_time ON requests(time); -CREATE INDEX IF NOT EXISTS requests_cost ON requests(time, model, input_tokens, cached_tokens, reasoning_tokens, reply_tokens); +CREATE INDEX IF NOT EXISTS requests_cost ON requests(time, model, input_tokens, cached_tokens, reasoning_tokens, reply_tokens, api_key); CREATE INDEX IF NOT EXISTS requests_model_time ON requests(model, time); CREATE INDEX IF NOT EXISTS requests_account_time ON requests(account, time); CREATE INDEX IF NOT EXISTS requests_state_time ON requests(state, time); @@ -77,6 +82,7 @@ type Row struct { Model string Account string Channel string + APIKey string Status int State string Duration time.Duration @@ -122,14 +128,32 @@ func Open(path string, log Logger) (*Store, error) { if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { return nil, err } - db, err := sqlitedb.Open(path, schema, statementCache) + db, stale, err := sqlitedb.Open(path, schema, statementCache, rollupTables...) if err != nil { return nil, fmt.Errorf("初始化请求账本: %w", err) } db.SetMaxOpenConns(4) store := &Store{db: db, writes: make(chan write, queueLimit), done: make(chan struct{}), log: log} - if err := store.alignDays(); err != nil { - return nil, errors.Join(fmt.Errorf("重建本地日汇总: %w", err), db.Close()) + misaligned, err := store.daysMisaligned() + if err != nil { + return nil, errors.Join(fmt.Errorf("读取本地日汇总: %w", err), db.Close()) + } + if misaligned { + stale = append(stale, "days") + } + empty, err := store.emptyRollups() + if err != nil { + return nil, errors.Join(fmt.Errorf("重建汇总: %w", err), db.Close()) + } + for _, table := range empty { + if !slices.Contains(stale, table) { + stale = append(stale, table) + } + } + if len(stale) > 0 { + if err := store.rebuildRollups(stale); err != nil { + return nil, errors.Join(fmt.Errorf("重建汇总: %w", err), db.Close()) + } } go store.run() return store, nil @@ -240,6 +264,7 @@ type rollupKey struct { account string channel string protocol string + apiKey string state string status int } @@ -248,7 +273,7 @@ type rollupKey struct { func keyOf(start int64, value *entry) rollupKey { return rollupKey{ start: start, model: value.model, account: value.account, channel: value.channel, - protocol: value.protocol, state: value.state, status: value.status, + protocol: value.protocol, apiKey: value.apiKey, state: value.state, status: value.status, } } @@ -290,12 +315,12 @@ func (store *Store) write(batch []write) (err error) { if row.ReplyTool { replyTool = 1 } - result, err := tx.Exec(`INSERT OR IGNORE INTO requests VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, + result, err := tx.Exec(`INSERT OR IGNORE INTO requests VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, row.ID, row.Time.UnixMilli(), row.Protocol, row.Path, row.Model, row.Account, row.Channel, row.Status, row.State, row.Duration.Milliseconds(), row.FirstEvent.Milliseconds(), row.Queue.Milliseconds(), row.InputTokens, row.ReasoningTokens, row.ReplyTokens, row.TotalTokens, row.ToolCalls, row.Error, string(encoded), row.CachedTokens, row.Proof.Total.Milliseconds(), row.Proof.Lock.Milliseconds(), row.Proof.Interaction.Milliseconds(), - row.Proof.Refresh.Milliseconds(), row.Proof.Compute.Milliseconds(), replyTool, row.ReplyToolCalls, row.ReplyToolContinuations) + row.Proof.Refresh.Milliseconds(), row.Proof.Compute.Milliseconds(), replyTool, row.ReplyToolCalls, row.ReplyToolContinuations, row.APIKey) if err != nil { return err } @@ -346,13 +371,13 @@ func (store *Store) write(batch []write) (err error) { func mergeRollup(tx *sql.Tx, table string, key rollupKey, value *entry) error { existing := &entry{} var durations, firstEvents []byte - err := tx.QueryRow(`SELECT requests, input_tokens, reasoning_tokens, reply_tokens, total_tokens, duration_ms, first_event_ms, - first_events, queue_ms, duration_hist, first_event_hist, last_time, cached_tokens FROM `+table+` - WHERE start=? AND model=? AND account=? AND channel=? AND protocol=? AND state=? AND status=?`, - key.start, key.model, key.account, key.channel, key.protocol, key.state, key.status).Scan( - &existing.requests, &existing.inputTokens, &existing.reasoningTokens, &existing.replyTokens, &existing.totalTokens, - &existing.durationMS, &existing.firstEventMS, &existing.firstEvents, &existing.queueMS, &durations, &firstEvents, &existing.lastTime, - &existing.cachedTokens) + err := tx.QueryRow(`SELECT requests, input_tokens, cached_tokens, reasoning_tokens, reply_tokens, total_tokens, duration_ms, + first_event_ms, first_events, queue_ms, duration_hist, first_event_hist, last_time FROM `+table+` + WHERE start=? AND model=? AND account=? AND channel=? AND protocol=? AND api_key=? AND state=? AND status=?`, + key.start, key.model, key.account, key.channel, key.protocol, key.apiKey, key.state, key.status).Scan( + &existing.requests, &existing.inputTokens, &existing.cachedTokens, &existing.reasoningTokens, &existing.replyTokens, + &existing.totalTokens, &existing.durationMS, &existing.firstEventMS, &existing.firstEvents, &existing.queueMS, &durations, + &firstEvents, &existing.lastTime) switch { case errors.Is(err, sql.ErrNoRows): case err != nil: @@ -366,11 +391,11 @@ func mergeRollup(tx *sql.Tx, table string, key rollupKey, value *entry) error { } value.combine(existing) } - _, err = tx.Exec(`INSERT OR REPLACE INTO `+table+` VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, - key.start, key.model, key.account, key.channel, key.protocol, key.state, key.status, value.requests, - value.inputTokens, value.reasoningTokens, value.replyTokens, value.totalTokens, + _, err = tx.Exec(`INSERT OR REPLACE INTO `+table+` VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)`, + key.start, key.model, key.account, key.channel, key.protocol, key.apiKey, key.state, key.status, value.requests, + value.inputTokens, value.cachedTokens, value.reasoningTokens, value.replyTokens, value.totalTokens, value.durationMS, value.firstEventMS, value.firstEvents, value.queueMS, - value.duration.encode(), value.firstEvent.encode(), value.lastTime, value.cachedTokens) + value.duration.encode(), value.firstEvent.encode(), value.lastTime) return err } @@ -387,27 +412,48 @@ func (store *Store) prune() { } } -// alignDays 在本地日汇总的起点与当前服务器时区不一致时,从小时汇总与原始记录重建全部本地日汇总 -func (store *Store) alignDays() (err error) { +// daysMisaligned 判断本地日汇总中有起点不是当前服务器时区零点的分段 +func (store *Store) daysMisaligned() (misaligned bool, err error) { rows, err := store.db.Query(`SELECT start FROM days GROUP BY start`) if err != nil { - return err + return false, err } - aligned := true for rows.Next() { var start int64 if err := rows.Scan(&start); err != nil { - return errors.Join(err, rows.Close()) + return false, errors.Join(err, rows.Close()) } if day, _ := localDay(start); day != start { - aligned = false + misaligned = true } } - if err := errors.Join(rows.Err(), rows.Close()); err != nil || aligned { - return err + return misaligned, errors.Join(rows.Err(), rows.Close()) +} + +// emptyRollups 返回原始记录不为空而自身为空的汇总表 +func (store *Store) emptyRollups() ([]string, error) { + var requests bool + if err := store.db.QueryRow(`SELECT EXISTS (SELECT 1 FROM requests)`).Scan(&requests); err != nil || !requests { + return nil, err } - var earliest sql.NullInt64 - if err := store.db.QueryRow(`SELECT MIN(start) FROM hours`).Scan(&earliest); err != nil { + var empty []string + for _, table := range rollupTables { + var rows bool + if err := store.db.QueryRow(`SELECT EXISTS (SELECT 1 FROM ` + table + `)`).Scan(&rows); err != nil { + return nil, err + } + if !rows { + empty = append(empty, table) + } + } + return empty, nil +} + +// rebuildRollups 在一个事务内清空指定的汇总表,再按服务器本地日逐日从原始记录重新累加 +func (store *Store) rebuildRollups(tables []string) (err error) { + began := time.Now() + var earliest, latest sql.NullInt64 + if err := store.db.QueryRow(`SELECT MIN(time), MAX(time) FROM requests`).Scan(&earliest, &latest); err != nil { return err } tx, err := store.db.Begin() @@ -419,20 +465,30 @@ func (store *Store) alignDays() (err error) { err = errors.Join(err, tx.Rollback()) } }() - if _, err := tx.Exec(`DELETE FROM days`); err != nil { - return err + for _, table := range tables { + if _, err := tx.Exec(`DELETE FROM ` + table); err != nil { + return err + } } - rebuilt, now := 0, time.Now().UnixMilli() - for start, end := localDay(earliest.Int64); earliest.Valid && start <= now; start, end = localDay(end) { - days := map[rollupKey]*entry{} - for _, part := range planHours(start, end, nil) { - if err := store.scan(context.Background(), part, nil, func(value *entry) { collect(days, keyOf(start, value), value) }); err != nil { - return err + hours, days := slices.Contains(tables, "hours"), slices.Contains(tables, "days") + rebuilt := 0 + for start, end := localDay(earliest.Int64); earliest.Valid && start <= latest.Int64; start, end = localDay(end) { + rollups := map[string]map[rollupKey]*entry{"hours": {}, "days": {}} + if err := store.scan(context.Background(), segment{from: start, to: end}, nil, func(value *entry) { + if hours { + collect(rollups["hours"], keyOf(floorDiv(value.time, hourMS)*hourMS, value), value) + } + if days { + collect(rollups["days"], keyOf(start, value), value) } + }); err != nil { + return err } - for key, value := range days { - if err := mergeRollup(tx, "days", key, value); err != nil { - return err + for table, values := range rollups { + for key, value := range values { + if err := mergeRollup(tx, table, key, value); err != nil { + return err + } } } rebuilt++ @@ -440,7 +496,7 @@ func (store *Store) alignDays() (err error) { if err := tx.Commit(); err != nil { return err } - store.log("INFO", "请求账本已按服务器时区重建本地日汇总", "days", rebuilt) + store.log("INFO", "请求账本已从请求记录重建汇总", "tables", tables, "days", rebuilt, "elapsed", time.Since(began).Round(time.Millisecond)) return nil } diff --git a/internal/requestdb/usage.go b/internal/requestdb/usage.go index 63c2b1a5..31a771ba 100644 --- a/internal/requestdb/usage.go +++ b/internal/requestdb/usage.go @@ -29,6 +29,7 @@ type entry struct { account string channel string protocol string + apiKey string state string status int requests int64 @@ -50,7 +51,7 @@ type entry struct { func rowEntry(row *Row) *entry { value := &entry{ time: row.Time.UnixMilli(), model: row.Model, account: row.Account, channel: row.Channel, protocol: row.Protocol, - state: row.State, status: row.Status, requests: 1, inputTokens: row.InputTokens, cachedTokens: row.CachedTokens, reasoningTokens: row.ReasoningTokens, + apiKey: row.APIKey, state: row.State, status: row.Status, requests: 1, inputTokens: row.InputTokens, cachedTokens: row.CachedTokens, reasoningTokens: row.ReasoningTokens, replyTokens: row.ReplyTokens, totalTokens: row.TotalTokens, durationMS: row.Duration.Milliseconds(), queueMS: row.Queue.Milliseconds(), duration: single(row.Duration.Milliseconds()), lastTime: row.Time.UnixMilli(), } @@ -95,6 +96,8 @@ func (value *entry) dimension(name string) string { return value.channel case "protocol": return value.protocol + case "api_key": + return value.apiKey case "state": return value.state case "status": @@ -310,18 +313,18 @@ func (store *Store) scan(ctx context.Context, part segment, filters api.UsageFil table, column := part.source.table() value := &entry{} if part.source != fromRequests { - rows, err := store.db.QueryContext(ctx, `SELECT start, model, account, channel, protocol, state, status, requests, - input_tokens, reasoning_tokens, reply_tokens, total_tokens, duration_ms, first_event_ms, first_events, queue_ms, - duration_hist, first_event_hist, last_time, cached_tokens FROM `+table+` WHERE `+column+` >= ? AND `+column+` < ?`+clause, args...) + rows, err := store.db.QueryContext(ctx, `SELECT start, model, account, channel, protocol, api_key, state, status, requests, + input_tokens, cached_tokens, reasoning_tokens, reply_tokens, total_tokens, duration_ms, first_event_ms, first_events, queue_ms, + duration_hist, first_event_hist, last_time FROM `+table+` WHERE `+column+` >= ? AND `+column+` < ?`+clause, args...) if err != nil { return err } var durations, firstEvents []byte for rows.Next() { - if err := rows.Scan(&value.time, &value.model, &value.account, &value.channel, &value.protocol, &value.state, - &value.status, &value.requests, &value.inputTokens, &value.reasoningTokens, &value.replyTokens, &value.totalTokens, - &value.durationMS, &value.firstEventMS, &value.firstEvents, &value.queueMS, &durations, &firstEvents, &value.lastTime, - &value.cachedTokens); err != nil { + if err := rows.Scan(&value.time, &value.model, &value.account, &value.channel, &value.protocol, &value.apiKey, &value.state, + &value.status, &value.requests, &value.inputTokens, &value.cachedTokens, &value.reasoningTokens, &value.replyTokens, + &value.totalTokens, &value.durationMS, &value.firstEventMS, &value.firstEvents, &value.queueMS, &durations, &firstEvents, + &value.lastTime); err != nil { return errors.Join(err, rows.Close()) } if value.duration, err = decodeCounts(durations); err != nil { @@ -334,7 +337,7 @@ func (store *Store) scan(ctx context.Context, part segment, filters api.UsageFil } return errors.Join(rows.Err(), rows.Close()) } - rows, err := store.db.QueryContext(ctx, `SELECT time, model, account, channel, protocol, state, status, + rows, err := store.db.QueryContext(ctx, `SELECT time, model, account, channel, protocol, api_key, state, status, duration_ms, first_event_ms, queue_ms, input_tokens, reasoning_tokens, reply_tokens, total_tokens, cached_tokens FROM requests WHERE time >= ? AND time < ?`+clause, args...) if err != nil { @@ -343,8 +346,8 @@ func (store *Store) scan(ctx context.Context, part segment, filters api.UsageFil var duration, firstEvent [1]bucketCount value.requests = 1 for rows.Next() { - if err := rows.Scan(&value.time, &value.model, &value.account, &value.channel, &value.protocol, &value.state, &value.status, - &value.durationMS, &value.firstEventMS, &value.queueMS, &value.inputTokens, &value.reasoningTokens, &value.replyTokens, + if err := rows.Scan(&value.time, &value.model, &value.account, &value.channel, &value.protocol, &value.apiKey, &value.state, + &value.status, &value.durationMS, &value.firstEventMS, &value.queueMS, &value.inputTokens, &value.reasoningTokens, &value.replyTokens, &value.totalTokens, &value.cachedTokens); err != nil { return errors.Join(err, rows.Close()) } @@ -360,14 +363,15 @@ func (store *Store) scan(ctx context.Context, part segment, filters api.UsageFil return errors.Join(rows.Err(), rows.Close()) } -// cost 是一段时间内按 API 单价估算的美元费用、各分桶费用与有 token 但没有单价的模型 +// cost 是一段时间内按 API 单价估算的美元费用、各分桶与各 API key 的费用,以及有 token 但没有单价的模型 type cost struct { total float64 buckets []float64 + keys map[string]float64 unpriced map[string]bool } -// scanCost 在 SQL 中按分桶、单价分段、模型与长上下文分档汇总 [from, to) 内符合筛选的原始记录 token,再按单价累加费用,starts 非空时同时累加到各分桶 +// scanCost 在 SQL 中按分桶、单价分段、模型、长上下文分档与 API key 汇总 [from, to) 内符合筛选的原始记录 token,再按单价累加费用,starts 非空时同时累加到各分桶 func (store *Store) scanCost(ctx context.Context, from, to int64, starts []int64, filters api.UsageFilters) (cost, error) { clause, filterArgs := filterSQL(filters) boundaries := pricing.Boundaries(time.UnixMilli(from), time.UnixMilli(to)) @@ -407,15 +411,15 @@ func (store *Store) scanCost(ctx context.Context, from, to int64, starts []int64 } addSlot(index, start, stop) } - result := cost{buckets: make([]float64, len(starts)), unpriced: map[string]bool{}} + result := cost{buckets: make([]float64, len(starts)), keys: map[string]float64{}, unpriced: map[string]bool{}} if len(args) == 0 { return result, nil } tier := "input_tokens > " + strconv.Itoa(pricing.LongContext) rows, err := store.db.QueryContext(ctx, `WITH slots(slot, start, stop) AS (VALUES `+slots.String()+`) - SELECT slot, start, model, `+tier+`, SUM(input_tokens), SUM(cached_tokens), SUM(reasoning_tokens + reply_tokens) + SELECT slot, start, model, `+tier+`, api_key, SUM(input_tokens), SUM(cached_tokens), SUM(reasoning_tokens + reply_tokens) FROM slots JOIN requests INDEXED BY requests_cost ON time >= start AND time < stop`+clause+` - GROUP BY slot, start, model, `+tier, append(args, filterArgs...)...) + GROUP BY slot, start, model, `+tier+`, api_key`, append(args, filterArgs...)...) if err != nil { return cost{}, err } @@ -423,9 +427,9 @@ func (store *Store) scanCost(ctx context.Context, from, to int64, starts []int64 var start int64 var long bool var input, cached, output int64 - var model string + var model, key string for rows.Next() { - if err := rows.Scan(&slot, &start, &model, &long, &input, &cached, &output); err != nil { + if err := rows.Scan(&slot, &start, &model, &long, &key, &input, &cached, &output); err != nil { return cost{}, errors.Join(err, rows.Close()) } if input+output > 0 && !pricing.Priced(model) { @@ -433,6 +437,7 @@ func (store *Store) scanCost(ctx context.Context, from, to int64, starts []int64 } value := pricing.TierCost(model, time.UnixMilli(start), long, input, cached, output) result.total += value + result.keys[key] += value if starts != nil { result.buckets[slot] += value } @@ -506,7 +511,8 @@ func (store *Store) Usage(ctx context.Context, query api.UsageQuery) (api.UsageR slices.Sort(unpriced) report := api.UsageReport{ From: query.From.UTC(), To: query.To.UTC(), BucketSeconds: int64(query.Bucket / time.Second), GeneratedAt: now.UTC(), - Totals: totals.stats(), Previous: previous.stats(), Cost: current.total, PreviousCost: before.total, UnpricedModels: unpriced, StackBy: query.Stack, + Totals: totals.stats(), Previous: previous.stats(), Cost: current.total, PreviousCost: before.total, APIKeyCost: current.keys, + UnpricedModels: unpriced, StackBy: query.Stack, Recent: api.UsageRecent{Minutes: int(recentWindow / time.Minute), Requests: recent.requests, Tokens: recent.totalTokens}, Buckets: make([]api.UsageBucket, len(starts)), Groups: map[string][]api.UsageGroup{}, } diff --git a/internal/sqlitedb/sqlitedb.go b/internal/sqlitedb/sqlitedb.go index 4f2e7291..9abffece 100644 --- a/internal/sqlitedb/sqlitedb.go +++ b/internal/sqlitedb/sqlitedb.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "path/filepath" + "slices" "strings" "github.com/mattn/go-sqlite3" @@ -31,19 +32,20 @@ func init() { }}) } -// Open 打开或创建数据库,每个连接缓存最近用过的 statements 条预编译语句;新库与非增量收缩的已有库先整理为增量收缩,再为已有表补上缺少的列、执行 schema 并删除 schema 没有定义的对象 -func Open(path string, schema string, statements int) (*sql.DB, error) { +// Open 打开或创建数据库,每个连接缓存最近用过的 statements 条预编译语句;新库与非增量收缩的已有库先整理为增量收缩,再按 schema 同步表结构;derived 是内容可由其他表重建的表,返回其中因定义改变而重建为空表的表名 +func Open(path string, schema string, statements int, derived ...string) (*sql.DB, []string, error) { db, err := sql.Open(driverName, fmt.Sprintf("file:%s?_stmt_cache_size=%d", filepath.ToSlash(path), statements)) if err != nil { - return nil, err + return nil, nil, err } if err := useIncrementalVacuum(db); err != nil { - return nil, errors.Join(err, db.Close()) + return nil, nil, errors.Join(err, db.Close()) } - if err := applySchema(db, schema); err != nil { - return nil, errors.Join(fmt.Errorf("同步表结构: %w", err), db.Close()) + recreated, err := applySchema(db, schema, derived) + if err != nil { + return nil, nil, errors.Join(fmt.Errorf("同步表结构: %w", err), db.Close()) } - return db, nil + return db, recreated, nil } // useIncrementalVacuum 在同一连接上把不是增量收缩的库设为增量收缩并整理一次 @@ -70,43 +72,75 @@ func useIncrementalVacuum(db *sql.DB) error { return nil } -// applySchema 为已有表补上 schema 定义而缺少的列,执行 schema,再删除 schema 没有定义的表、索引、视图与触发器 -func applySchema(db *sql.DB, schema string) error { +// applySchema 删去定义与 schema 不同的索引和 derived 中的表,为其余已有表补上缺少的列,执行 schema,再删除 schema 没有定义的表、索引、视图与触发器;返回重建为空表的 derived 表名 +func applySchema(db *sql.DB, schema string, derived []string) ([]string, error) { defined, err := sql.Open(driverName, ":memory:") if err != nil { - return err + return nil, err } defer defined.Close() defined.SetMaxOpenConns(1) if _, err := defined.Exec(schema); err != nil { - return err + return nil, err } want, err := schemaObjects(defined) if err != nil { - return err + return nil, err } have, err := schemaObjects(db) if err != nil { - return err + return nil, err } + var recreated []string for name, kind := range want { - if kind == "table" && have[name] == "table" { + if have[name] != kind { + continue + } + if kind == "index" || kind == "table" && slices.Contains(derived, name) { + changed, err := definitionChanged(defined, db, name) + if err != nil { + return nil, err + } + if changed { + if _, err := db.Exec(`DROP ` + strings.ToUpper(kind) + ` IF EXISTS ` + quoteIdentifier(name)); err != nil { + return nil, err + } + if kind == "table" { + recreated = append(recreated, name) + } + continue + } + } + if kind == "table" { if err := addMissingColumns(defined, db, name); err != nil { - return err + return nil, err } } } if _, err := db.Exec(schema); err != nil { - return err + return nil, err } for name, kind := range have { if _, ok := want[name]; !ok { if _, err := db.Exec(`DROP ` + strings.ToUpper(kind) + ` IF EXISTS ` + quoteIdentifier(name)); err != nil { - return err + return nil, err } } } - return nil + slices.Sort(recreated) + return recreated, nil +} + +// definitionChanged 判断 db 中对象的建立语句与 defined 中的同名对象不同 +func definitionChanged(defined *sql.DB, db *sql.DB, name string) (bool, error) { + var want, have string + if err := defined.QueryRow(`SELECT sql FROM sqlite_master WHERE name = ?`, name).Scan(&want); err != nil { + return false, err + } + if err := db.QueryRow(`SELECT sql FROM sqlite_master WHERE name = ?`, name).Scan(&have); err != nil { + return false, err + } + return want != have, nil } // schemaObjects 返回库中除 SQLite 内部对象外的表、索引、视图与触发器的名称与类型 diff --git a/internal/sqlitedb/sqlitedb_test.go b/internal/sqlitedb/sqlitedb_test.go index 92b6d41c..0e90a73c 100644 --- a/internal/sqlitedb/sqlitedb_test.go +++ b/internal/sqlitedb/sqlitedb_test.go @@ -28,7 +28,7 @@ INSERT INTO legacy SELECT zeroblob(4096) FROM (WITH RECURSIVE n(i) AS (SELECT 1 } schema := `CREATE TABLE IF NOT EXISTS items (id TEXT PRIMARY KEY, name TEXT NOT NULL, size INTEGER NOT NULL DEFAULT 0); CREATE INDEX IF NOT EXISTS items_size ON items(size);` - db, err := Open(path, schema, 0) + db, _, err := Open(path, schema, 0) if err != nil { t.Fatal(err) } diff --git a/internal/statedb/statedb.go b/internal/statedb/statedb.go index 01d5fa0e..5c315321 100644 --- a/internal/statedb/statedb.go +++ b/internal/statedb/statedb.go @@ -29,7 +29,7 @@ func Open(path string, log func(level, message string, attrs ...any)) (*Store, e if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { return nil, err } - db, err := sqlitedb.Open(path, schema, 0) + db, _, err := sqlitedb.Open(path, schema, 0) if err != nil { return nil, fmt.Errorf("初始化续接状态库: %w", err) } diff --git a/internal/waa/url.go b/internal/waa/url.go index a824ebc3..1b785a3c 100644 --- a/internal/waa/url.go +++ b/internal/waa/url.go @@ -4,7 +4,7 @@ import ( cryptorand "crypto/rand" "fmt" - whatwgurl "github.com/nlnwa/whatwg-url/url" + whatwgurl "github.com/nationallibraryofnorway/whatwg-url/url" ) // urlParser 按 WHATWG URL 标准解析地址 diff --git a/web/package-lock.json b/web/package-lock.json index b618f544..d676f7f5 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -8,43 +8,43 @@ "name": "aistudio2api-web", "version": "0.1.0", "dependencies": { - "@fontsource-variable/google-sans-code": "5.3.1", + "@fontsource-variable/google-sans-code": "5.3.2", "@fontsource-variable/inter": "5.3.0", "@fontsource-variable/inter-tight": "5.3.0", - "@lobehub/icons-static-svg": "1.102.0", - "@lucide/vue": "1.52.0", - "@material-symbols/svg-300": "0.47.6", + "@lobehub/icons-static-svg": "1.106.0", + "@lucide/vue": "1.84.0", + "@material-symbols/svg-300": "0.49.0", "@vscode/markdown-it-katex": "1.1.2", - "@wailsio/runtime": "3.0.0-beta.29", + "@wailsio/runtime": "3.1.0", "beautiful-mermaid": "1.1.3", "echarts": "6.1.0", - "eventsource-parser": "4.1.0", + "eventsource-parser": "4.1.3", "highlight.js": "11.12.0", "katex": "0.16.47", - "markdown-it": "15.0.2", - "pdfjs-dist": "6.4.299", - "reka-ui": "2.11.0", - "thinking-orbs": "0.3.1", - "vue": "3.5.41", - "vue-echarts": "8.3.1", - "vue-router": "5.3.1" + "markdown-it": "15.0.3", + "pdfjs-dist": "6.5.438", + "reka-ui": "2.12.0", + "thinking-orbs": "0.3.2", + "vue": "3.5.46", + "vue-echarts": "8.3.2", + "vue-router": "5.5.3" }, "devDependencies": { - "@tailwindcss/vite": "4.3.3", - "@types/node": "24.10.13", - "@typescript-eslint/parser": "8.67.0", - "@vitejs/plugin-vue": "6.0.8", - "eslint": "10.9.0", - "eslint-config-prettier": "10.1.8", - "eslint-plugin-oxlint": "1.88.0", - "eslint-plugin-vue": "10.10.0", - "sass-embedded": "1.105.1", - "tailwindcss": "4.3.3", + "@tailwindcss/vite": "4.3.5", + "@types/node": "24.19.4", + "@typescript-eslint/parser": "8.74.0", + "@vitejs/plugin-vue": "6.0.11", + "eslint": "10.16.0", + "eslint-config-prettier": "10.1.9", + "eslint-plugin-oxlint": "1.95.0", + "eslint-plugin-vue": "10.12.1", + "sass-embedded": "1.108.2", + "tailwindcss": "4.3.5", "typescript": "6.0.3", - "vite": "npm:@voidzero-dev/vite-plus-core@1.3.0", - "vite-plugin-compression2": "2.5.3", - "vite-plus": "1.3.0", - "vue-tsc": "3.3.11" + "vite": "npm:@voidzero-dev/vite-plus-core@8.3.8001", + "vite-plugin-compression2": "2.5.4", + "vite-plus": "1.8.0", + "vue-tsc": "3.3.14" }, "engines": { "node": "^22.18.0 || ^24.11.0 || >=26.0.0" @@ -66,9 +66,9 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", - "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", + "version": "7.29.15", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.15.tgz", + "integrity": "sha512-C2FuapQ2Kh1OnVHAoLi5rD3GBJ8COb9Q609T6HEpLqaBAo560PDP5OxBE5dCI/h951MBO/+bCUYU5SZ+8ZlV+w==", "license": "MIT", "engines": { "node": ">=6.9.0" @@ -99,9 +99,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.29.10", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.10.tgz", - "integrity": "sha512-NpugTzbKgGrNe45Ui32cN8vCFFMxVtP/9rtfwv0nP5FRDAjvYBxJcLVpYA9mr1jxP6cnIT7x9LUzuDTbWYYNRA==", + "version": "7.29.16", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.16.tgz", + "integrity": "sha512-LKBjGopxrQE0aFucNL69OyyyF143MOWUULEOftU3oCgyD35Sy84UUpVnt/sNvTb7ZmCyALSt7om+fojlW35zYQ==", "dev": true, "license": "MIT", "engines": { @@ -109,12 +109,12 @@ } }, "node_modules/@babel/types": { - "version": "7.29.8", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz", - "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==", + "version": "7.29.15", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.15.tgz", + "integrity": "sha512-/XKpKDakL//LZ66bq1XsZOswuqeI5MZqPLDu18o3XdkU1fNJ7bdPtzgnc4ZNS+bBGHV0FJG8jjb8SwcC3nNVQQ==", "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-string-parser": "^7.29.15", "@babel/helper-validator-identifier": "^7.29.7" }, "engines": { @@ -129,12 +129,36 @@ "license": "MIT" }, "node_modules/@bufbuild/protobuf": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.16.0.tgz", - "integrity": "sha512-FWa0sPlqYGJgpTs6OxBRcL/AW4JT0OIO+W1ajerluoTVh8CV0B7XM1qsNCRgnkSCkRCgOICKHRQlY17jrsm0+Q==", + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.17.0.tgz", + "integrity": "sha512-hcPkSz6D7MiTU/5VBBhK+kxaYDoOdQ6yJRFJ3kS8Nydp+VZXfg1vrpABKPNod8bXMufsVCmiUJVIKFzCzta4uw==", "devOptional": true, "license": "(Apache-2.0 AND BSD-3-Clause)" }, + "node_modules/@cacheable/memory": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.2.0.tgz", + "integrity": "sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/utils": "^2.5.0", + "@keyv/bigmap": "^1.3.1", + "hookified": "^1.15.1", + "keyv": "^5.6.0" + } + }, + "node_modules/@cacheable/utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.5.0.tgz", + "integrity": "sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.5.1", + "keyv": "^5.6.0" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.10.1", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", @@ -178,15 +202,15 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.23.5", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", - "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", + "version": "0.23.7", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.7.tgz", + "integrity": "sha512-Ix1tmZjA7/OmE7ROAfORe83hVnqlDzLpZVHFjHQt5mvLm1U03qMexpaxKqFIL362QV32SoPaZqmKQr3tdqFY2w==", "dev": true, "license": "Apache-2.0", "dependencies": { "@eslint/object-schema": "^3.0.5", "debug": "^4.3.1", - "minimatch": "^10.2.4" + "minimatch": "^11.0.5" }, "engines": { "node": "^20.19.0 || ^22.13.0 || >=24" @@ -281,9 +305,9 @@ } }, "node_modules/@fontsource-variable/google-sans-code": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/@fontsource-variable/google-sans-code/-/google-sans-code-5.3.1.tgz", - "integrity": "sha512-yY7wGZK9u3DUoqSMpHUoAJfnB+DMX6SfNPQvtlVeyDfua92X42Wc84gqqQOLpiamrszbDdChp2wQOj6oPfY5Nw==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/@fontsource-variable/google-sans-code/-/google-sans-code-5.3.2.tgz", + "integrity": "sha512-kW4RcfoTTObtUWAhlh6hzs8LCDsBNLwVRPqjUIKMkEiabfR3SRGP0Y6erFKd9k1yaRppTSCLSVkxhPKpEW3QPg==", "license": "OFL-1.1", "funding": { "url": "https://github.com/sponsors/ayuhito" @@ -391,6 +415,13 @@ "@swc/helpers": "^0.5.0" } }, + "node_modules/@isaacs/nonrecursive-glob-match": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@isaacs/nonrecursive-glob-match/-/nonrecursive-glob-match-1.1.0.tgz", + "integrity": "sha512-GPm/Dbvk5RLmhRnxXIa7nTpK0xtl4E0wj0MslsuNiJ1FIROU+2+9lgUC/dgF7Ey4QCWhfEsgxilMRMCdHPfDfw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.13", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", @@ -412,9 +443,9 @@ } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.3.tgz", + "integrity": "sha512-lhTtjtoEArWBjismtfS761S9Hlyn+nIZqOZVYoZ1Xn82PMNMVnk+jj/NhC4fAXGTs7ydONcJiR5vyQBTMDu27g==", "license": "MIT", "engines": { "node": ">=6.0.0" @@ -436,25 +467,49 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@keyv/bigmap": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.3.1.tgz", + "integrity": "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.4.0", + "hookified": "^1.15.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "keyv": "^5.6.0" + } + }, + "node_modules/@keyv/serialize": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.1.1.tgz", + "integrity": "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==", + "dev": true, + "license": "MIT" + }, "node_modules/@lobehub/icons-static-svg": { - "version": "1.102.0", - "resolved": "https://registry.npmjs.org/@lobehub/icons-static-svg/-/icons-static-svg-1.102.0.tgz", - "integrity": "sha512-3Na6S2kdslmsfnBjuL0PQWQClrmuWe/pWThRN/3J2VzPg5MhVghy8knVu7kd1/lqA9ydZBvwmnKLzuBo0Wm6Qw==", + "version": "1.106.0", + "resolved": "https://registry.npmjs.org/@lobehub/icons-static-svg/-/icons-static-svg-1.106.0.tgz", + "integrity": "sha512-yRLkEGfCsOh6ZDSIPsA6HrI1ynh9gI1LECZaeFIzpuEHv9ON2i+SzwLnE2iYfW/agsms54QL+OhPde9WpEi/uA==", "license": "MIT" }, "node_modules/@lucide/vue": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/@lucide/vue/-/vue-1.52.0.tgz", - "integrity": "sha512-Gwr6c14jhY6BscoFU+B9OKsr7lg8RTAKOLgW0e61kkFwkt9Q7CZmB9AyJcvhoqapEJgRg2bFoeAcO+cqpgKzEQ==", + "version": "1.84.0", + "resolved": "https://registry.npmjs.org/@lucide/vue/-/vue-1.84.0.tgz", + "integrity": "sha512-vZ3zqp8djXeuphloLxcFuQ2ehHdorPBIHXUy6H70Z62zxUoufQOqqo+pFyQRgMiZSvVtr5oCUeF45WynvBJfbw==", "license": "ISC", "peerDependencies": { "vue": ">=3.0.1" } }, "node_modules/@material-symbols/svg-300": { - "version": "0.47.6", - "resolved": "https://registry.npmjs.org/@material-symbols/svg-300/-/svg-300-0.47.6.tgz", - "integrity": "sha512-19gzRxeQzUwbR8WAPfAz/wb1r0Gu4Xt65BYgHzL44NfvUEZ157YxqaGIoRm4IkMZfy5Eem+hnCyiI+EX7+TG7w==", + "version": "0.49.0", + "resolved": "https://registry.npmjs.org/@material-symbols/svg-300/-/svg-300-0.49.0.tgz", + "integrity": "sha512-ye+TRO6shI970mJdeDRoYA6a1sJ2z/nK4ZmMk8bD3nwWz6QtzZBTB1G3A9WgFV+Sr4IfsGEdLrYILl7cUZ9hFQ==", "license": "Apache-2.0" }, "node_modules/@napi-rs/canvas": { @@ -723,19 +778,29 @@ } }, "node_modules/@oxc-project/runtime": { - "version": "0.154.0", - "resolved": "https://registry.npmjs.org/@oxc-project/runtime/-/runtime-0.154.0.tgz", - "integrity": "sha512-cBQNGoh659BNgvA8OC/e4BNDtFkv03dJaYdkp2adgOQNtISNAPQ+nB4S8XvWtNk7Xl+0g+7aa+iRGR25Xycd1Q==", + "version": "0.159.0", + "resolved": "https://registry.npmjs.org/@oxc-project/runtime/-/runtime-0.159.0.tgz", + "integrity": "sha512-z+wJlHpqB2rsnQ5PbQlWKC7lYISlHrniQ3N5JF4LGaa+kOopx5u5DMT2P7pN12fsXFg1gVcoLdRXPRyIS61OKQ==", "devOptional": true, "license": "MIT", "engines": { "node": "^20.19.0 || >=22.12.0" } }, + "node_modules/@oxc-project/types": { + "version": "0.159.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.159.0.tgz", + "integrity": "sha512-QWjWhxheluOJ82kDHNyps00UvRpQCtI34B5A/SzpgQycUD/79FuvT4I0aQIfE/bdPwKmX4QPftnywFBH6FxJhQ==", + "devOptional": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, "node_modules/@oxfmt/binding-android-arm-eabi": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm-eabi/-/binding-android-arm-eabi-0.73.0.tgz", - "integrity": "sha512-dhunAdMbi/4o0Y66/+Wl6rpsNqpvE4i26Qw6bB77A97L2lJoktWg6m+X9QOon8iOEEqzD9rEZqFi5uZ4oIzhCA==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm-eabi/-/binding-android-arm-eabi-0.79.0.tgz", + "integrity": "sha512-xOCQ/rvokUXs8SxOQY5Wy2ukPaZJZ0PmdJovN0ryB1c8DVEtbcvliLdYtINUYh8QOTpmBOctIisSJk9tvh+J6w==", "cpu": [ "arm" ], @@ -750,9 +815,9 @@ } }, "node_modules/@oxfmt/binding-android-arm64": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm64/-/binding-android-arm64-0.73.0.tgz", - "integrity": "sha512-dBoypjC2/xeyKyIhN2waX0/XeoccH9k0lVVe+sGRc4X8HSJVRtqyZDoXdr7bGY9A75c51dX0z0dLDpGQKwCdCg==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm64/-/binding-android-arm64-0.79.0.tgz", + "integrity": "sha512-WMLDvCjjchUYtI6zXKOdzTDGm72BaYZiz1/VhB1rrxdakUZRlJh1aMr3CT6ui51uHcWVBycULIXSZHpw6u2pTQ==", "cpu": [ "arm64" ], @@ -767,9 +832,9 @@ } }, "node_modules/@oxfmt/binding-darwin-arm64": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-arm64/-/binding-darwin-arm64-0.73.0.tgz", - "integrity": "sha512-Tn7Y+qWIpCQK+qdYwBcn6YvqeBuPiuG3tcNlYg16a5QL2o3rSmrgBB1nCyYqo0uvc1LNrfQW9/CK2tzFuID/Fg==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-arm64/-/binding-darwin-arm64-0.79.0.tgz", + "integrity": "sha512-+LzSN7w7tULz96ntS1Uqe5oI00XZ0o/m/t3+eSfiQp3aTPnj2eGUafqEWryMLk84j7x9NiF+GEP2YT4/BfClgA==", "cpu": [ "arm64" ], @@ -784,9 +849,9 @@ } }, "node_modules/@oxfmt/binding-darwin-x64": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-x64/-/binding-darwin-x64-0.73.0.tgz", - "integrity": "sha512-yVb0E0tg/+9Xc9YJCBq66qF1DC/aN5mhb5nnHz0k4ikwkMANtSul2VPDSwjYdXR6/DFimc+pPUgLBqkIa5Ctuw==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-x64/-/binding-darwin-x64-0.79.0.tgz", + "integrity": "sha512-KFiMRhKeiiooaS1dKc4r8AZgOrfOhwVe1yf/aRef+8BajJwtVjMtlsQl/BNRxtkFbq13GjEo/4Q+9YhFGU4o6g==", "cpu": [ "x64" ], @@ -801,9 +866,9 @@ } }, "node_modules/@oxfmt/binding-freebsd-x64": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-freebsd-x64/-/binding-freebsd-x64-0.73.0.tgz", - "integrity": "sha512-IKR4lFnBkYNL9Uqdxa5GMTQLvnLj+3sDwTvh2atHCzah0xeo+1xR5bigRU8uyXlOsA4VpXUn0UAimq4E4RBGmQ==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-freebsd-x64/-/binding-freebsd-x64-0.79.0.tgz", + "integrity": "sha512-lHVIp0g8ZOFKiqVscvttp+3HJkkRH6XkGgfAA0lVexIlE1mMFVp4V7RBdxz/P9p7T8pSNsYdapFWvdT21Mib9w==", "cpu": [ "x64" ], @@ -818,9 +883,9 @@ } }, "node_modules/@oxfmt/binding-linux-arm-gnueabihf": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.73.0.tgz", - "integrity": "sha512-7qnZ4g0ZCO3aZevOOQpZIABYwwXJW1lLDo2elviGdPQ0i11255xKEMFsi97fC1/nauQFseCJfELUy/k2JoOP+g==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.79.0.tgz", + "integrity": "sha512-Pt35GoxiMUfnr+23cuzk07XQVvISDFxxPcp/aFVB87+RQvJoQaBo/XN7Re9XxgElvbELdyxTLnV9XM2aTfJeUA==", "cpu": [ "arm" ], @@ -835,9 +900,9 @@ } }, "node_modules/@oxfmt/binding-linux-arm-musleabihf": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.73.0.tgz", - "integrity": "sha512-36eBico2j/WPB84gb4FYd/jjqGCKOwU4M+TWLBUIqlnzTozQueLy0joA5BwsSp2OZFVkOlpCwvA3ndPamdiyLw==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.79.0.tgz", + "integrity": "sha512-zPi9Dni58VKp3r1QUcFvnbJNfBr49qyecq0vlM4SaX/MSjmguq77VngirghDua5tyhIDfqdUMTCK2KRlnZFp/g==", "cpu": [ "arm" ], @@ -852,9 +917,9 @@ } }, "node_modules/@oxfmt/binding-linux-arm64-gnu": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.73.0.tgz", - "integrity": "sha512-VZ3cSgCAT18knKo52DcACmAuIoqG6qVEyeZRFbJd0xmYQ8GyYjuBc6IAh6MZHijT6q7p4/HPI+6ZWsCuhdV6iw==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.79.0.tgz", + "integrity": "sha512-XhRehATEWjwX7VVEgDUD+7pfHYncQIJaEU0qsHvEKtu9XX0QYzcKvXhU9+URfiGX9WRh3wy2Ow+YCc3EeHtImg==", "cpu": [ "arm64" ], @@ -872,9 +937,9 @@ } }, "node_modules/@oxfmt/binding-linux-arm64-musl": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.73.0.tgz", - "integrity": "sha512-8YVzH59XSHcqwXNgc5qK851zCqwpmBgOifARXEPPe5/xTsIbHceYoPZAyqfpYV0CfKmzSaEDBgYHFza4rhx+Zw==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.79.0.tgz", + "integrity": "sha512-gbVjFZYug0MEyqvuTAzXGNxFJmBqBO32o1Fud1lG8bGs6oVz48ZtNQyEcAzqrOwaaG+Sxtv4gVzcsfht9aqmkg==", "cpu": [ "arm64" ], @@ -892,9 +957,9 @@ } }, "node_modules/@oxfmt/binding-linux-ppc64-gnu": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.73.0.tgz", - "integrity": "sha512-MqRJnmCys0rwOgpWyEidSA7v/bvOqfNDJhPkQoR9mPVYrvSmMaW2Xhdpl28cbTA+brOM1is62GjIvJplVlUVpw==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.79.0.tgz", + "integrity": "sha512-0N0sD3vnllyuiNh1r6zKvNXWE/CakcPKJAespg7XE2+sfvxpz5Q1iFah8sF5aedsOmVvbZaOPZcSHVmMosT1fA==", "cpu": [ "ppc64" ], @@ -912,9 +977,9 @@ } }, "node_modules/@oxfmt/binding-linux-riscv64-gnu": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.73.0.tgz", - "integrity": "sha512-4t2F3SWJSK/O/kRRFnL0elJzn75fJGGu71gs1HtiWcS80SmJOpkHiwwLnTp9suGdns8VHEPxYS0GTcyVwHKWBA==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.79.0.tgz", + "integrity": "sha512-YtjqUHolcX6cv0ZMZuKQCM4H0ae/okcowy0wGcPHJk4O+8zjy3TvNhzDQ1/KGCkMJO8Fwulm1JcPJsraVJ3p+w==", "cpu": [ "riscv64" ], @@ -932,9 +997,9 @@ } }, "node_modules/@oxfmt/binding-linux-riscv64-musl": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.73.0.tgz", - "integrity": "sha512-D8b4I8I1kLdJQFwdFXNV+cwh3xWSiNKofjdGUk0nDpc0AHOds8T+poGbP9RWQMvgsvMb9OMgp/aV7ahBR37TbQ==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.79.0.tgz", + "integrity": "sha512-H2gb9bEBr5tcdP5FU8JYTfgOavXDorWcAAlwci/zEKF2jzgh/oEr/SAw6aHB9n3FLEvnKvOh0A1fjku+vgYoUA==", "cpu": [ "riscv64" ], @@ -952,9 +1017,9 @@ } }, "node_modules/@oxfmt/binding-linux-s390x-gnu": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.73.0.tgz", - "integrity": "sha512-QrC1S5VL1+N5rvorB15jH7CPvjVHA7GyUI5oVEd8Bd9m5605RDBQYTxDQ920DuylRoZOh2V7/xXpfCtFUrojUQ==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.79.0.tgz", + "integrity": "sha512-aZUbyWW5dSOxT/u6suWc4S9GVDt7YPPNMKQon+z79M8dpXmosadcFHAb7jBhpU7Hdsd2GN6/y3nd0JFTsGddZw==", "cpu": [ "s390x" ], @@ -972,9 +1037,9 @@ } }, "node_modules/@oxfmt/binding-linux-x64-gnu": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.73.0.tgz", - "integrity": "sha512-dFcUKQPltCEPa+YlkF3zqufn6nJPZdG73LpnjBvZFFsU3laCMssDXSYB99mVaj43FqdEgjpz5TO6gbYXcczd9g==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.79.0.tgz", + "integrity": "sha512-5pW/ZHYfjjQ71gQR+EKzDz8ZzWIDHlTUtWtxVFNgZbKxVZnRxiSXVrllbjpJtx1q8VtSPZ+Lyg9BLny3yw+PTA==", "cpu": [ "x64" ], @@ -992,9 +1057,9 @@ } }, "node_modules/@oxfmt/binding-linux-x64-musl": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-musl/-/binding-linux-x64-musl-0.73.0.tgz", - "integrity": "sha512-LmQe+nV8e+eUwfPNCxDF+owbsg88toBiR/8rZRgVOeKQP3MaGefXZRvBoc1UG37iWEQ/9JlCXG9Mc4nf4N3agw==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-musl/-/binding-linux-x64-musl-0.79.0.tgz", + "integrity": "sha512-3IVUerTDB7Dvd90c1EurAzlVnlE9Azl7Wn8e33qX3wL/IqnslF+P7HvwkD+VeMbHxRtuw0EEBGSArZFXpUAZrQ==", "cpu": [ "x64" ], @@ -1012,9 +1077,9 @@ } }, "node_modules/@oxfmt/binding-openharmony-arm64": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-openharmony-arm64/-/binding-openharmony-arm64-0.73.0.tgz", - "integrity": "sha512-8weOr1OKknE0G2DbR6ejJUT9AOsoBU6cXlsetmbihHv1K+bK7qP61T6lJxY0k/aAO7GyOJiRGNlL+04r4eH8Xg==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-openharmony-arm64/-/binding-openharmony-arm64-0.79.0.tgz", + "integrity": "sha512-C5QDgJBtu9+/2BQScoP7ynv54PLOqfoSqhRWwI0D0RPOwYD4tYj0TUdJbXMO1fNegL/5zJiSOxkq6II2xvttWg==", "cpu": [ "arm64" ], @@ -1029,9 +1094,9 @@ } }, "node_modules/@oxfmt/binding-win32-arm64-msvc": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.73.0.tgz", - "integrity": "sha512-mZV+QxXYgb8E18gzAFItb937VIsE4dqWdStrD3tRRC52UubOYEuU+e7NaIqUsGdB5YsJqNeuck3Ue/af2r9wyA==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.79.0.tgz", + "integrity": "sha512-zlW1m8M49vNGgqQF/ze80KW8pZMicnW2XDZGBHuYtXTRYn4ewvgpqN9wwoqb6uLZZfb1R1zaQWKEB8cs7KYjwA==", "cpu": [ "arm64" ], @@ -1046,9 +1111,9 @@ } }, "node_modules/@oxfmt/binding-win32-ia32-msvc": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.73.0.tgz", - "integrity": "sha512-QJPUsbgUb97ZPPMkFUq6VQq0fLhC4Np19KL9aB/qKVwXnpKE6MIiILXqzhKnQ/UbnEDjKJ7Xv1d6zH4bYPCUdQ==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.79.0.tgz", + "integrity": "sha512-wbb7hFv2wK3SCTfu8dl1ydNsXM5dmH+PJMU3sojCkfKcG29VDpITL5/AtouCzXjkOc90QRkcAZcg36gP0KqoHA==", "cpu": [ "ia32" ], @@ -1063,9 +1128,9 @@ } }, "node_modules/@oxfmt/binding-win32-x64-msvc": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.73.0.tgz", - "integrity": "sha512-cGcze2fu+ykIaFtkEvZlkZ3HvnCLk+WISthtq99zWTWn0x13t5L9TxvGdLZMUMvtfYR+ICkiCwKnguVubdcw0w==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.79.0.tgz", + "integrity": "sha512-JLaeaQ+4LkQiVXY06JIV1dBFEDJzssvDieK/3Poi6CsY+c4UxghZVrrsfcKGJ5R/0F2Sw3C5Lf5Hu0sM5qJfPw==", "cpu": [ "x64" ], @@ -1079,94 +1144,10 @@ "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@oxlint-tsgolint/darwin-arm64": { - "version": "7.0.2004", - "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/darwin-arm64/-/darwin-arm64-7.0.2004.tgz", - "integrity": "sha512-uJk3ttju7Lz+Nv8WG4CsLyewoL1qf/Ny8S8OksJ7Bm/F14Tc9gMfW6arM1PCc57IzH/X/I79YsCWTgxX1FKibQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@oxlint-tsgolint/darwin-x64": { - "version": "7.0.2004", - "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/darwin-x64/-/darwin-x64-7.0.2004.tgz", - "integrity": "sha512-0BFfHTzDxNDFPcu0UZAXT6CyCJHAXM0dZveyDb4KEHa2qF/DSnOKOrmvK/wFuFol9kvijbGM9JfuOsor+zWXRw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@oxlint-tsgolint/linux-arm64": { - "version": "7.0.2004", - "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/linux-arm64/-/linux-arm64-7.0.2004.tgz", - "integrity": "sha512-TAehQc+qdRXyDN3nl/r/3/oPrBVrbtrDeGMkFyG6mf+XphpoJ2lAMVFLclyvrVZCw02RbKROjyw8h72XwQQHcw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@oxlint-tsgolint/linux-x64": { - "version": "7.0.2004", - "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/linux-x64/-/linux-x64-7.0.2004.tgz", - "integrity": "sha512-LPunZvm6ZbWPfHMAyfZf9ci3HHvNEzLejO8zdqO3GoVGoSEHqqufHUD7+OgeatVSaJP7uXDJ2HaNOHIoH7go4Q==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@oxlint-tsgolint/win32-arm64": { - "version": "7.0.2004", - "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/win32-arm64/-/win32-arm64-7.0.2004.tgz", - "integrity": "sha512-FVWplzDImWhiuawnIZVETaQecv4GWom6Jv4Fx2xj7hhXXDZ5okEgiw1gTCImHTIQsi2ycC5oSxVwrn69bMh7iw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@oxlint-tsgolint/win32-x64": { - "version": "7.0.2004", - "resolved": "https://registry.npmjs.org/@oxlint-tsgolint/win32-x64/-/win32-x64-7.0.2004.tgz", - "integrity": "sha512-7PsxuUx11Ry9DYTWcljTzRbmZY9B6O9fFFfZV+aodQEMy6pfRT3fhoQRv9PtGN/89z1pPz3nFKrsFm6WqNtX7w==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@oxlint/binding-android-arm-eabi": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm-eabi/-/binding-android-arm-eabi-1.88.0.tgz", - "integrity": "sha512-k6Fgkf86ubfeH4GvqYsRolfuVAp0pfYVZvifSlXNHPdMaWUOfxUrmLEeDD7hF6U2oJuhsVxhSWq86/xCJ+9MmA==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm-eabi/-/binding-android-arm-eabi-1.95.0.tgz", + "integrity": "sha512-hJna6w3COWJjfMPxomjZL82klTdrITm56PEpCsfO/xMkzQw/fNtJWauQ/YEwQqVttj0L5vDIa8rCcuhfAE3L4w==", "cpu": [ "arm" ], @@ -1176,14 +1157,15 @@ "os": [ "android" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-android-arm64": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm64/-/binding-android-arm64-1.88.0.tgz", - "integrity": "sha512-AsIyhl9o1ejwtac7NMbhKpMdSml6NWR0ljKjZERxC8OHYDAW8o/Om9n1QHVLi4VCEUo42Zte2/Op9kyoGpJZMg==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm64/-/binding-android-arm64-1.95.0.tgz", + "integrity": "sha512-uAIGZQ9uJVUeogeWOSboI3F7twOuM4mNuZcHXD9+LdYLcWp7J6kbtRUXJ6GVqcs5E0Cjb4emmSBK9FNrkGuhqQ==", "cpu": [ "arm64" ], @@ -1193,14 +1175,15 @@ "os": [ "android" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-darwin-arm64": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-arm64/-/binding-darwin-arm64-1.88.0.tgz", - "integrity": "sha512-qgBjB7eEKcCB4RqjXGuoSZq74g0wD09fWFJ+HWcCJcKaga8TeUHtb+BY0SsxdleSLBgx4RZ7qmgo0EzqEq7JoQ==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-arm64/-/binding-darwin-arm64-1.95.0.tgz", + "integrity": "sha512-Ogh1vfHO5vshKRop/He46r+WqC5BTqonYwhB4fp9e2gvOFvg1Xi6XsHTuM/lBSH85ZcaG+DS99EMAy9GcwDong==", "cpu": [ "arm64" ], @@ -1210,14 +1193,15 @@ "os": [ "darwin" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-darwin-x64": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-x64/-/binding-darwin-x64-1.88.0.tgz", - "integrity": "sha512-sCz3X5Mw/xdzEzn4fsCt1Iq8NKJnGNfhR+b9B5k+4DysYAHsmIhYoocnBPiQ9kvY3+pUun2A0Z8Vtun/Nv6YoQ==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-x64/-/binding-darwin-x64-1.95.0.tgz", + "integrity": "sha512-kTrE1xfpQUBMMS50Ws6KY92N8OsJ8LE6JqxKqkHEY3KdsmguQ6kKVGSjzyt1HLwsSi0fQCvNRog8YRBBovD1AA==", "cpu": [ "x64" ], @@ -1227,14 +1211,15 @@ "os": [ "darwin" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-freebsd-x64": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-freebsd-x64/-/binding-freebsd-x64-1.88.0.tgz", - "integrity": "sha512-xTOdYOIqCufgIj0knvxu86FBfovP6QBiD7ngNva01gb8xPQCD5gXkE5APGczH35zStim1O3zqvFbLQmY85xXRg==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-freebsd-x64/-/binding-freebsd-x64-1.95.0.tgz", + "integrity": "sha512-ho7E1VCInK0VnpneRaI1BEpe1ceJE8VjxP2O9THWdReV6bth1Q4+80kYVGGK47mHRyZ2NGztQZ2dWRo6j1lavA==", "cpu": [ "x64" ], @@ -1244,14 +1229,15 @@ "os": [ "freebsd" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-linux-arm-gnueabihf": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.88.0.tgz", - "integrity": "sha512-BLadtw88NdYJBrAtC1dYzrPfSP2d5zgx6iuZycdD0YmZBJ2Nqbit9Z4PSaIb6gxK25dweArGMPbOmq/0ugwUPg==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.95.0.tgz", + "integrity": "sha512-94afnouMHcnHr/OtRh07gG5LehC9M0GjiSoik3xxTtrmq6cWxXOTAhYlBtxa67u/GlycbnHlDoGJfYlTshcr/w==", "cpu": [ "arm" ], @@ -1261,14 +1247,15 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-linux-arm-musleabihf": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-1.88.0.tgz", - "integrity": "sha512-wILSczl/DaZsCcf7j7tvNbssp8hxEHIJxrv4j7+JjI3TAL1U/JTWbeUtoJJC/vo8+2hkTmHLYoKJjmiNbijdXw==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-1.95.0.tgz", + "integrity": "sha512-LEeclqV1/fafxPgJWN21Bri6HBBBZpEFluq/ZH7Avvu9HjJh/XOn6WwogJqX9X7pG2aITZ2nRH39+sUKEQt2WA==", "cpu": [ "arm" ], @@ -1278,14 +1265,15 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-linux-arm64-gnu": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.88.0.tgz", - "integrity": "sha512-jutT2Hy8JCuZuMwIFHo2HtyxfOfBJHyQxlBHBK1SL9W2f8n/WhjAP0FnDMz9d/mjhv9+QA0mx5AdQ9fDjsrFFg==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.95.0.tgz", + "integrity": "sha512-EpXpEQKmgtkvc6RyU84LM1e3CrVDWQkgghVzf1hMGgwjBzgKAJ/QntHgnzmu5cNeLBfa7GPCY+gGXxEll8Adcg==", "cpu": [ "arm64" ], @@ -1298,14 +1286,15 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-linux-arm64-musl": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.88.0.tgz", - "integrity": "sha512-8N8iGV9hh4Lkeuq7QsEkjoXNRRflqR1G2qyoGYXcA0k5qllrdqmfylKEXyHIVERxqNDyMO4StqDQ0uLxXcBQAg==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.95.0.tgz", + "integrity": "sha512-+96Md8c2BAgFp8nWHrUrpqba87DoU+HVJYIun6qA+QKFoeNd3xAWq1JYE6da4nVli9GgwRpfncfRePcgmQQaIQ==", "cpu": [ "arm64" ], @@ -1318,14 +1307,15 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-linux-ppc64-gnu": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.88.0.tgz", - "integrity": "sha512-5ydcQt3znNQ/rGEWYRvpS2cK9+T18P2VYgnyJ+eloEAwi9YUmsXy5VGrRqNWIK6qzWwHGnEE3ojVqqQNo+f0hA==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.95.0.tgz", + "integrity": "sha512-6yG99vsXct3Uv536w6Z1s03w2makRKnE0q3eJSmf+W/IwPmO56QLk8XUA6ebu/R5peCbJ67HmcWqACH+kg/6Bg==", "cpu": [ "ppc64" ], @@ -1338,14 +1328,15 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-linux-riscv64-gnu": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-1.88.0.tgz", - "integrity": "sha512-iGx0uvFT54b/5DPJdEBCxYIrVB3v0uTy+JhRh3CyEp8/22BXDkG8rffkFwREdLsdj9mOrPbJYVOZw8ipcBuzjw==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-1.95.0.tgz", + "integrity": "sha512-Eir0Z4ldh55AsQUqVDlLF4Pw3lSFXIdAl8ZNgU8tp/gTwT9JVCzWY0o3+ys9pCcpTN0vCqBwwuQfAUxzbIgvcQ==", "cpu": [ "riscv64" ], @@ -1358,14 +1349,15 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-linux-riscv64-musl": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-1.88.0.tgz", - "integrity": "sha512-Wt47mKMWelVjRjuR7BCFxXkB0m79K1sTEbqMHRWciKUgo5iv7sWsF4RXSOyFYHD9zerNrkRZblnN273rhwOA1Q==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-1.95.0.tgz", + "integrity": "sha512-ceRx+K2WJ7C3tIv+XjZS28oAoZ7DY29ZcWChPdXG5M100phI72FRDYwGRlWZEeDfmkROnarLTMKnnrQAtsC42Q==", "cpu": [ "riscv64" ], @@ -1378,14 +1370,15 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-linux-s390x-gnu": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.88.0.tgz", - "integrity": "sha512-g3L12KCS4+1gtUt3RbJ4F+Yxx4LNmmZLEPfhd8rAHEJjJk2lAgNfnjGoP/phJyhG5WS6VbNYbJtadJelNfvTMA==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.95.0.tgz", + "integrity": "sha512-WbD3sM08ZDk2QE6060wK/omihQKbRm+LVzKIg4W5zNTbEhYJChciqX49UZuqW59RGF+wBUxzAup7egUIESTjUA==", "cpu": [ "s390x" ], @@ -1398,14 +1391,15 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-linux-x64-gnu": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.88.0.tgz", - "integrity": "sha512-og/XHVDOD9ZJgRiZkT9DgzQd4sr+JZW7e4l17Q/jVMZiIbeEd4uIu9iAoUbTF1gIvVZoRc4QDOxyVUvQGp4WHg==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.95.0.tgz", + "integrity": "sha512-F4ST2ZkFIiLL9OKyRCyC0KQQpwM5WIv0GTcMiZuYVa6xSRJHR05iVRqst+arOVudEPkhP47EnbuoC9UfVCYDyg==", "cpu": [ "x64" ], @@ -1418,14 +1412,15 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-linux-x64-musl": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-musl/-/binding-linux-x64-musl-1.88.0.tgz", - "integrity": "sha512-EmhBsp+xuKb6YbZNEMLBo80Xw71AZOIm18do8ni/GLX/Lw1XzNhVYpbxO1KasYtoAvrGtCOdCPULRlIE0bPbTQ==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-musl/-/binding-linux-x64-musl-1.95.0.tgz", + "integrity": "sha512-hEpYDZatpuxLrWlTlkwhHZ1e8QkL02aFS55BPQX1XA9iOd+yUEADGFF1iY6z+xkw6RkpzXFrtnDFe4/JNOLSRA==", "cpu": [ "x64" ], @@ -1438,14 +1433,15 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-openharmony-arm64": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-openharmony-arm64/-/binding-openharmony-arm64-1.88.0.tgz", - "integrity": "sha512-DBUcx/KwYdg1DAz+G01P/GFv512J04EsZadbHptx2FTpWT/MWRg21ZToNHt9pnsfQRBQ3et/g+vqzbvrdAVbuA==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-openharmony-arm64/-/binding-openharmony-arm64-1.95.0.tgz", + "integrity": "sha512-+JwIH9/uLgQXfxBvOAKzvp616m5i0fBR5ELEBHm5D+++fStBZ+74T7YW4xBpX13zNU2blr52Swoe3GTF1JyqRg==", "cpu": [ "arm64" ], @@ -1455,14 +1451,15 @@ "os": [ "openharmony" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-win32-arm64-msvc": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.88.0.tgz", - "integrity": "sha512-xeVd0n4XG5HvynxfYvXi6uB+JvZbVZataowPS8cYpMbYg9mwE4sSyElFQd4LVJFifq8bRLDSR18XgEildmcXAg==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.95.0.tgz", + "integrity": "sha512-pzJgcp3WkOSchukg5y5pn5mVIQ6P83RDI79YJ9gQZKed1pOgjhrmlc5AMizjuq6/P8VifhxzBsMqYI6LLjO2TA==", "cpu": [ "arm64" ], @@ -1472,14 +1469,15 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-win32-ia32-msvc": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.88.0.tgz", - "integrity": "sha512-MA6iOw//amleaz2mVMsZrA7NHlEexjTrhIxSMFCXQi6IUuQO+3Od00GZhr2iCYw6RFzMW36jkKK/WHBXMsoQAw==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.95.0.tgz", + "integrity": "sha512-54MeQvLRXkJqF1nEFs7wb73SrnurZJQy9fVK4NdEwumNKVwyUUxpGHhvfDMIY2NqJZS7kz0pY9uVty5664Gt1Q==", "cpu": [ "ia32" ], @@ -1489,14 +1487,15 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/binding-win32-x64-msvc": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.88.0.tgz", - "integrity": "sha512-3Sz6rVWe8Dy+ufsXurFN1GX2dX43F/lQMSLelK9gFjiba7nHvLlqlhR5cHlWVnCpSqUY1hN9pyCX9XToe6ve6g==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.95.0.tgz", + "integrity": "sha512-I/Fn+Fed1qzb1k2uRjMe2VRtRN1+ZObyU+E76B6v/Ul3Z6JdeAW5zBHSe0n5d8a0ZyU4iorzVy0Rw9LYgo3MSQ==", "cpu": [ "x64" ], @@ -1506,14 +1505,15 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@oxlint/plugins": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/@oxlint/plugins/-/plugins-1.88.0.tgz", - "integrity": "sha512-G2xbfWTrbqYRhR/vfeKNMQf/sS3/ti0iKJAAkRxHuXWZH/hne/dyIb9QKk5LuR6cJLARxsL6FMoAYmfspd74MQ==", + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/plugins/-/plugins-1.94.0.tgz", + "integrity": "sha512-YT6htikBOBQ00XDxZpRZLZ0anEDo7h9s4+YvjRU0/Ng/cLd0D6SZQ3tsms4g/GDer/z8UKlegC5iptEfyRXJcw==", "dev": true, "license": "MIT", "engines": { @@ -1827,7 +1827,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", - "dev": true, "license": "MIT" }, "node_modules/@rollup/pluginutils": { @@ -1869,49 +1868,59 @@ "license": "0BSD" }, "node_modules/@tailwindcss/node": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.3.3.tgz", - "integrity": "sha512-/T8IKEsf9VTU6tLjgC7+sv2mOPtQxzE2jMw7u4Tt40Tx+QSZxpzh95/H6cMKoja9XuW7iMdLJYBB0o9G1CaAgg==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.3.5.tgz", + "integrity": "sha512-yT53FzV4ke0cr/BguDxhWMpm5MJu1O2muzk+tKw6lKHjODAsYArBbWwFbJiaksfzFv1tpkO9QHGzmfs1hJT66g==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/remapping": "^2.3.5", - "enhanced-resolve": "^5.24.1", + "enhanced-resolve": "^5.24.5", "jiti": "^2.7.0", - "lightningcss": "1.32.0", - "magic-string": "^0.30.21", + "lightningcss": "1.33.0", + "magic-string": "^1.1.0", "source-map-js": "^1.2.1", - "tailwindcss": "4.3.3" + "tailwindcss": "4.3.5" + } + }, + "node_modules/@tailwindcss/node/node_modules/magic-string": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" } }, "node_modules/@tailwindcss/oxide": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.3.3.tgz", - "integrity": "sha512-krXjAikiaFSPaK/FkAQT5UTx3VormQaiZ5hBFlJZ9UFQGB/rwg1MZIhHAG9smMQRTdyJxP6Qt5MwMtdyU5FWrA==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.3.5.tgz", + "integrity": "sha512-PynqGLZsZvwM9tqD/CUxkOIfyd6K5elZ2MooauzJryP/UqXYgi3yYbtt3N0Xe+MHV/eFKPFQCEfIKAqlAS1CBg==", "dev": true, "license": "MIT", "engines": { "node": ">= 20" }, "optionalDependencies": { - "@tailwindcss/oxide-android-arm64": "4.3.3", - "@tailwindcss/oxide-darwin-arm64": "4.3.3", - "@tailwindcss/oxide-darwin-x64": "4.3.3", - "@tailwindcss/oxide-freebsd-x64": "4.3.3", - "@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.3", - "@tailwindcss/oxide-linux-arm64-gnu": "4.3.3", - "@tailwindcss/oxide-linux-arm64-musl": "4.3.3", - "@tailwindcss/oxide-linux-x64-gnu": "4.3.3", - "@tailwindcss/oxide-linux-x64-musl": "4.3.3", - "@tailwindcss/oxide-wasm32-wasi": "4.3.3", - "@tailwindcss/oxide-win32-arm64-msvc": "4.3.3", - "@tailwindcss/oxide-win32-x64-msvc": "4.3.3" + "@tailwindcss/oxide-android-arm64": "4.3.5", + "@tailwindcss/oxide-darwin-arm64": "4.3.5", + "@tailwindcss/oxide-darwin-x64": "4.3.5", + "@tailwindcss/oxide-freebsd-x64": "4.3.5", + "@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.5", + "@tailwindcss/oxide-linux-arm64-gnu": "4.3.5", + "@tailwindcss/oxide-linux-arm64-musl": "4.3.5", + "@tailwindcss/oxide-linux-x64-gnu": "4.3.5", + "@tailwindcss/oxide-linux-x64-musl": "4.3.5", + "@tailwindcss/oxide-wasm32-wasi": "4.3.5", + "@tailwindcss/oxide-win32-arm64-msvc": "4.3.5", + "@tailwindcss/oxide-win32-x64-msvc": "4.3.5" } }, "node_modules/@tailwindcss/oxide-android-arm64": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.3.3.tgz", - "integrity": "sha512-Y85A2gmPSkl5Ve5qR86GL4HT509cFqQh1aes9p3sSkyTPwt0Pppf3GkwGe4JPACcRYjgJIEhQgM6dBClnr0NYw==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.3.5.tgz", + "integrity": "sha512-Se0z5xMqcSQanJD1IYmO0cGpK3iv0fp3ZsIT7xRJZ1Da5PghvNoc46zz4jIQn+aan3dV9T8AermFNN9QPmsh0Q==", "cpu": [ "arm64" ], @@ -1926,9 +1935,9 @@ } }, "node_modules/@tailwindcss/oxide-darwin-arm64": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.3.3.tgz", - "integrity": "sha512-BiaWatpBcERQFDlOjRDpIVXuFK5PJez5SA4JMg6VYZdBYU+qKfV/vqjcIs+IYmtitf1xYQZTwXvU/8y4lfZUGw==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.3.5.tgz", + "integrity": "sha512-UPrgTDuUbvmqGMZuCnmI3FKee/tYKzKdp00/kuB4oSGB213VYg8QTdF7lVhnPoBXq/mIfJ+ILoBFqNOboWcMwQ==", "cpu": [ "arm64" ], @@ -1943,9 +1952,9 @@ } }, "node_modules/@tailwindcss/oxide-darwin-x64": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.3.3.tgz", - "integrity": "sha512-fAeUqfV5ndhxRwai8cXGzdLvul9utWOmeTkv69unv4ZXixjn61Z+p9lCWdwOwA3TYboG3BwdVuN/RDjhBRl0mw==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.3.5.tgz", + "integrity": "sha512-E+p7HEtjI0b8D7kbbWxH067cGui6d4c79COGko9fAPVE3rwc1E7ld2HFCbaG86AOGWS5VKQYqZOaf38ya4uxTQ==", "cpu": [ "x64" ], @@ -1960,9 +1969,9 @@ } }, "node_modules/@tailwindcss/oxide-freebsd-x64": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.3.3.tgz", - "integrity": "sha512-iyf5bV6+wnAlflVeEy7R25dupxTNECZN5QMI0qNT6eT+EgaGdZcKhGkr5SdoaWiLJ3spLqIY9VCeSGrwmtg4kw==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.3.5.tgz", + "integrity": "sha512-yWEWcWyAG7rWOcTpJTjdhQ3pcaFY2h+0bqTRfgU3G2fz87ZU3AKdvdZKhslD+kyHnjBUWKvNdRYwIYC5dI1tIg==", "cpu": [ "x64" ], @@ -1977,9 +1986,9 @@ } }, "node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.3.3.tgz", - "integrity": "sha512-aAYUprJAJQWWbRrPvtjdroZ56Md+JM8pMiopS6xGEwDfLhqj+2ver2p4nU4Mb3CRqcMmNBjo8KkUgcxhkzVQGQ==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.3.5.tgz", + "integrity": "sha512-WmeVjtJhZlr+smpqcdR2kQkkn6arHIJnUIBxTO2EJcTLGY1ecVXNo2hbSn8xc0IH2aEtys936iMWKGyj0GaKnA==", "cpu": [ "arm" ], @@ -1994,13 +2003,16 @@ } }, "node_modules/@tailwindcss/oxide-linux-arm64-gnu": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.3.3.tgz", - "integrity": "sha512-nDxldcEENOxZRzC2uu9jrutZdAAQtb+8WWDCSnWL1zvBk1+FN+x6MtDViPB5AJMfttVCUhehGWus3XBPgatM/w==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.3.5.tgz", + "integrity": "sha512-DTCSyucc6ShMp1QMqV5R94Z7xlgNgUzkGmFF1rL5HH2Qjy4eSmEqy+YLGkqqYvWa4sILtgrBt1JjRKbneQtiFQ==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -2011,13 +2023,16 @@ } }, "node_modules/@tailwindcss/oxide-linux-arm64-musl": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.3.3.tgz", - "integrity": "sha512-Md44bD6veX/PC5iyF8cDVnw4HBIANZepRZZ7a8DQOvkfo5WUBwcp6iAuCUz23u+4SUkhJlD3eL7hNdW8ezd/kA==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.3.5.tgz", + "integrity": "sha512-H9lsvO4x9E4nE4Hi8h7NHHw0O/kcVSu+iOyFHNGdYzazGgDjFHZbE6S3hQ8kMcbNXSBlMdNi67LV5EVqtpaJtw==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -2028,13 +2043,16 @@ } }, "node_modules/@tailwindcss/oxide-linux-x64-gnu": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.3.3.tgz", - "integrity": "sha512-tx7us1muwOKAKWao2v/GaafFeQboE6aj88vC6ziN2NCGcRm8gWUhwjzg+YdVB1e4boAtdtma4L43onunI6NS4w==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.3.5.tgz", + "integrity": "sha512-4uxQvtBvPuIdl13WfUBj9xMZHH14PtHZ8OZdtLmdyDtG66sCa1t599NZT+jagkUzRtWhuul1qRZQ1nAJscXN5g==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -2045,13 +2063,16 @@ } }, "node_modules/@tailwindcss/oxide-linux-x64-musl": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.3.3.tgz", - "integrity": "sha512-SJxX60smvHgasZoBy11dX6YRjXJFovwWBoedhbQPOBzgFWBHGB+TVPWB9BxzR7TTxU8FQZAI2AyiNCMzFm8Img==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.3.5.tgz", + "integrity": "sha512-0JQAzs7jwbA7O6+z/adU+Jk3AXwsu3npAhtr5escXS7TqEqWcaDV7qHuI+0Vy/KQRuVGnLQREcSJWYauyV3oqg==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -2062,9 +2083,9 @@ } }, "node_modules/@tailwindcss/oxide-wasm32-wasi": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.3.3.tgz", - "integrity": "sha512-jx1+rPhY/5Ympkktd656HBWEBLxP7dH06losBLjjf5vgCODXvi9KhtftWcMIwTFIDqBr7cRnQkdLnAG+IOlGvQ==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.3.5.tgz", + "integrity": "sha512-OJhFmlEfdzMr+avACdi40RPtnkW0B6hXyxL/8r+tnEHBWZji36CYRjEXrrvgBmaYsD3oEOBqwYFRKsYvzFe7Bw==", "bundleDependencies": [ "@napi-rs/wasm-runtime", "@emnapi/core", @@ -2073,28 +2094,94 @@ "@emnapi/wasi-threads", "tslib" ], - "cpu": [ - "wasm32" - ], "dev": true, "license": "MIT", "optional": true, "dependencies": { - "@emnapi/core": "^1.11.1", - "@emnapi/runtime": "^1.11.1", - "@emnapi/wasi-threads": "^1.2.2", - "@napi-rs/wasm-runtime": "^1.1.4", - "@tybys/wasm-util": "^0.10.2", + "@emnapi/core": "^1.11.3", + "@emnapi/runtime": "^1.11.3", + "@emnapi/wasi-threads": "^1.2.3", + "@napi-rs/wasm-runtime": "^1.2.2", + "@tybys/wasm-util": "^0.10.3", "tslib": "^2.8.1" }, "engines": { - "node": ">=14.0.0" + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/core": { + "version": "1.11.3", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.2.3", + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/runtime": { + "version": "1.11.3", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/wasi-threads": { + "version": "1.2.3", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": { + "version": "1.2.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.3", + "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.3" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@tybys/wasm-util": { + "version": "0.10.3", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" } }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/tslib": { + "version": "2.8.1", + "dev": true, + "inBundle": true, + "license": "0BSD", + "optional": true + }, "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.3.tgz", - "integrity": "sha512-3rc292Ca2ceK6Ulcc/bAVnTs/3nDtoPhyEKlgPv+yQJQi/JS/AMJlqzxvlDacL1nekbrcf6bTqp/jV4qgnPxNQ==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.5.tgz", + "integrity": "sha512-9o8jgthi+QE5eandnboiJT64VQfnIArfZzSTdgbhEK5aafdiu2jTW9Honi/mwYHxBZuH1vAC57IFyrh+0iK5Gg==", "cpu": [ "arm64" ], @@ -2109,9 +2196,9 @@ } }, "node_modules/@tailwindcss/oxide-win32-x64-msvc": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.3.3.tgz", - "integrity": "sha512-yJ0pwIVc/nYeGoV02WtsN8KYyLQv7kyI2wDnkezyJlGGjkd4QLwDGAwl47YpPJeuI0M0ObaXGSPjvWDPeTPggw==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.3.5.tgz", + "integrity": "sha512-XiKFfIy1RWe7qK4WqByxNW7Oz1/nkOy8o/BWhHminyV1PmpUd8Eedj5v2A8h2kpqeVlz6xRnwk9Fr/ZXNLcZfg==", "cpu": [ "x64" ], @@ -2126,15 +2213,15 @@ } }, "node_modules/@tailwindcss/vite": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.3.3.tgz", - "integrity": "sha512-yYU8cogLeSh/ms2jh8Fj7jaba/EWa7Ja6GoUqYZaraEuCI5YS6ms6ObZgjjedm+jm6XZjdNRWBpPP6Z86oOxcw==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.3.5.tgz", + "integrity": "sha512-BCNiY0a1ZjdOHVqw7kyb7U72BwfMF3dfUuN+tQsLWky/J5JOI/r7abibglXfygrZhVO/3u3V+E25kkKTeMkXaQ==", "dev": true, "license": "MIT", "dependencies": { - "@tailwindcss/node": "4.3.3", - "@tailwindcss/oxide": "4.3.3", - "tailwindcss": "4.3.3" + "@tailwindcss/node": "4.3.5", + "@tailwindcss/oxide": "4.3.5", + "tailwindcss": "4.3.5" }, "peerDependencies": { "vite": "^5.2.0 || ^6 || ^7 || ^8" @@ -2187,9 +2274,9 @@ } }, "node_modules/@testing-library/user-event": { - "version": "14.6.8", - "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.6.8.tgz", - "integrity": "sha512-vgSSqnANMnkcYR/vUNDbwS7aM3OErRLNUG8vCVVlj4oc6cKffUrccX7UAS5AmJQQNZTSibi9z5GvvRZ0aYgUCQ==", + "version": "14.6.13", + "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.6.13.tgz", + "integrity": "sha512-2LVZGptuB5un1Cu/u31o9adkCwbsUTMp4B4p04xupI7uobvTIpgKidSdShqZiReo/mQmvR9xjgdgTgge4oAbYA==", "dev": true, "license": "MIT", "engines": { @@ -2200,45 +2287,192 @@ "@testing-library/dom": ">=7.21.4" } }, - "node_modules/@types/aria-query": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", - "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", + "node_modules/@tsrs/darwin-arm64": { + "version": "7.1.0-beta.tsrs4", + "resolved": "https://registry.npmjs.org/@tsrs/darwin-arm64/-/darwin-arm64-7.1.0-beta.tsrs4.tgz", + "integrity": "sha512-Be1McQGyHipWIjnkvytZmh7Wi4YVATvTfiEuPX34kfk+W7QCtTdUUHnuLZ7bzwy8LgL9VDCmyvQtWiF3MENxBQ==", + "cpu": [ + "arm64" + ], "dev": true, - "license": "MIT" + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" + } }, - "node_modules/@types/chai": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", - "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "node_modules/@tsrs/darwin-x64": { + "version": "7.1.0-beta.tsrs4", + "resolved": "https://registry.npmjs.org/@tsrs/darwin-x64/-/darwin-x64-7.1.0-beta.tsrs4.tgz", + "integrity": "sha512-J9LM9ja4EGcA1/DNnWOo9smswK1Aa4xW+zbCubWdT/4z8SPwCmVwm5sn5KmvNBCHQHkke9KRrBl+zROqz6F74A==", + "cpu": [ + "x64" + ], "dev": true, - "license": "MIT", - "dependencies": { - "@types/deep-eql": "*", - "assertion-error": "^2.0.1" + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" } }, - "node_modules/@types/deep-eql": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", - "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "node_modules/@tsrs/linux-arm64-gnu": { + "version": "7.1.0-beta.tsrs4", + "resolved": "https://registry.npmjs.org/@tsrs/linux-arm64-gnu/-/linux-arm64-gnu-7.1.0-beta.tsrs4.tgz", + "integrity": "sha512-RIbwlpYWflMDq9XosRHL7gpwSV5fnEaUvjr3ehzKCcc7E6ozo0mH4m/OgQE3ts/4euWKzZxsK7lN6r091W5mWg==", + "cpu": [ + "arm64" + ], "dev": true, - "license": "MIT" + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } }, - "node_modules/@types/esrecurse": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", - "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "node_modules/@tsrs/linux-arm64-musl": { + "version": "7.1.0-beta.tsrs4", + "resolved": "https://registry.npmjs.org/@tsrs/linux-arm64-musl/-/linux-arm64-musl-7.1.0-beta.tsrs4.tgz", + "integrity": "sha512-4RGERFCpPayJ74T2eA+ky3VdIS0r1BezKIclqGWRTx/RXnj9H/1NbtEt0aKhj3TrTMPDmInlPiCwRJUv7M9kFA==", + "cpu": [ + "arm64" + ], "dev": true, - "license": "MIT" + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } }, - "node_modules/@types/estree": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", - "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "node_modules/@tsrs/linux-x64-gnu": { + "version": "7.1.0-beta.tsrs4", + "resolved": "https://registry.npmjs.org/@tsrs/linux-x64-gnu/-/linux-x64-gnu-7.1.0-beta.tsrs4.tgz", + "integrity": "sha512-YIqFRStXq5yURR+zYDwIKcV126KH+EibPMJ1ZbfT2ToJ0w5zmRUKV/A5z0kjmQu6A6wItLZxOzKjU1v+ad5blA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@tsrs/linux-x64-musl": { + "version": "7.1.0-beta.tsrs4", + "resolved": "https://registry.npmjs.org/@tsrs/linux-x64-musl/-/linux-x64-musl-7.1.0-beta.tsrs4.tgz", + "integrity": "sha512-TQeiFbrxowI26YDaUojRfV7DhDKjXlPWtz9DopyGtufFoKsv2efIzUiEAA8IVw689nUoi0CVl0aWTWio49lWMg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@tsrs/win32-arm64": { + "version": "7.1.0-beta.tsrs4", + "resolved": "https://registry.npmjs.org/@tsrs/win32-arm64/-/win32-arm64-7.1.0-beta.tsrs4.tgz", + "integrity": "sha512-0YRK8h3vCTtJM7j+GpWByK8ehWMdHPCETLEAeQiW6Xy4wrrJJ2Fso/1FeF6gfi6LyCq1mZMfydn2OiDoJmAu1A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@tsrs/win32-x64": { + "version": "7.1.0-beta.tsrs4", + "resolved": "https://registry.npmjs.org/@tsrs/win32-x64/-/win32-x64-7.1.0-beta.tsrs4.tgz", + "integrity": "sha512-JW5JoAammbwL2pXkhC//p/9t7lxg34zHgtA6L5ixiCDw5s+hxxEc85h3sm9M3oYUqCOOi+W6Jw5PLDClN3nMHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@types/aria-query": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", + "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", "dev": true, "license": "MIT" }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "license": "MIT" + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -2247,13 +2481,13 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "24.10.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.13.tgz", - "integrity": "sha512-oH72nZRfDv9lADUBSo104Aq7gPHpQZc4BTx38r9xf9pg5LfP6EzSyH2n7qFmmxRQXh7YlUXODcYsg6PuTDSxGg==", + "version": "24.19.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.4.tgz", + "integrity": "sha512-s04odlR3ksJrLu7QLi+pddkWLD0RmSbcP9KuWn2/ozQKAp/YgwBC/6x9kJj8yAzZnGPfxePm7zm7nysVPCRagw==", "devOptional": true, "license": "MIT", "dependencies": { - "undici-types": "~7.16.0" + "undici-types": ">=7.24.0 <7.24.7" } }, "node_modules/@types/web-bluetooth": { @@ -2263,16 +2497,16 @@ "license": "MIT" }, "node_modules/@typescript-eslint/parser": { - "version": "8.67.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.67.0.tgz", - "integrity": "sha512-fUBfTuuEulWqX6V8+O3PtScV01tzYYRUDTAirHFKoRAt7nOzoGiPt0M/bB47wWNy0coOOcgEwAMUtBpykMxl6w==", + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.74.0.tgz", + "integrity": "sha512-ecr8AYdig7avVkxaHdQvxHnIJ/mOyliO4Gv/uWF8q69vBew/z3sexqBwHUZX5Vql+Ns0w4sH6gBLkICGbOvJkA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.67.0", - "@typescript-eslint/types": "8.67.0", - "@typescript-eslint/typescript-estree": "8.67.0", - "@typescript-eslint/visitor-keys": "8.67.0", + "@typescript-eslint/scope-manager": "8.74.0", + "@typescript-eslint/types": "8.74.0", + "@typescript-eslint/typescript-estree": "8.74.0", + "@typescript-eslint/visitor-keys": "8.74.0", "debug": "^4.4.3" }, "engines": { @@ -2288,14 +2522,14 @@ } }, "node_modules/@typescript-eslint/project-service": { - "version": "8.67.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.67.0.tgz", - "integrity": "sha512-cvE8c7ulYeXN9fYuszhCeCsbzyVEXuhrRCybnBre7TUmqb5nRmBfQAwCj0O3WJFDeyAZt4VYv51vMCC9LHSdYw==", + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.74.0.tgz", + "integrity": "sha512-z/mymuE+JlEeSFIv3Mo70EvgG1Zz74Hl0IDfExfXutARAP834bt+MppTD7mVAwmZO0GdxdOAi0jbTam749eH6g==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.67.0", - "@typescript-eslint/types": "^8.67.0", + "@typescript-eslint/tsconfig-utils": "^8.74.0", + "@typescript-eslint/types": "^8.74.0", "debug": "^4.4.3" }, "engines": { @@ -2310,14 +2544,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.67.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.67.0.tgz", - "integrity": "sha512-EgvsleTwS4E+WzzSvem8fAUubLwatMNF1B5hHSLQxcvs7q2dtRhGyujHwLJSYlG41niJ7GP24Aha2+0mb1b2kg==", + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.74.0.tgz", + "integrity": "sha512-kpOdpu4CpWN5U38ox3f727DwWRBtUAVhyUJtqTBYe5gf2wYoxac7PgKP14txrxN7ICVtcjlLdzjqfRgpSnDKvQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.67.0", - "@typescript-eslint/visitor-keys": "8.67.0" + "@typescript-eslint/types": "8.74.0", + "@typescript-eslint/visitor-keys": "8.74.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2328,9 +2562,9 @@ } }, "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.67.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.67.0.tgz", - "integrity": "sha512-vV+LUSv5njUWsknE71fqKTlXUva+R76SaeORd6Zojcunk/6DvKFXONU3BrAs2H49mbygUXt6gbYunzwqNwlhdg==", + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.74.0.tgz", + "integrity": "sha512-p07wAuaS6BjCYgOSXKJi4YhvTnAf7fiG37e9THcpnYaQEt2QiTTYZWKwUFNgeRiywiMudazhzgddAirZ0GgHtQ==", "dev": true, "license": "MIT", "engines": { @@ -2345,9 +2579,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.67.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.67.0.tgz", - "integrity": "sha512-sBtgslww8nsMYUjhdPBiSyUqSzT8uR6g93A2QXnQC8+cGdjz0CyaOdqHDRJb1AtORbZCNUJBBeFA/tNR2uQmww==", + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.74.0.tgz", + "integrity": "sha512-MpnMrJCVNpP1iVL8NiHkQZgQqIMBH5ewDGUPBh1pqQXwFtMFjsl1M03QcYPXmv6stCKEiF0PN7CGbU1ZbXFzEA==", "dev": true, "license": "MIT", "engines": { @@ -2359,18 +2593,18 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.67.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.67.0.tgz", - "integrity": "sha512-EKQBCE9yNlRJYm7jdTW5AhDacDUmSwQb0FAJAmK2EKYrNXIsa2vxcSZx6PvJ/dEdI6lS+Y9W+EXckLj0iPFGcw==", + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.74.0.tgz", + "integrity": "sha512-wL348k6l92DNG+kPP5rVpKwNBoz7a3xRZy3TPKc1uymQttd7u7gcMv3eENmcuh4CjC4mO3FTM0DYstFXMyDLuw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/project-service": "8.67.0", - "@typescript-eslint/tsconfig-utils": "8.67.0", - "@typescript-eslint/types": "8.67.0", - "@typescript-eslint/visitor-keys": "8.67.0", + "@typescript-eslint/project-service": "8.74.0", + "@typescript-eslint/tsconfig-utils": "8.74.0", + "@typescript-eslint/types": "8.74.0", + "@typescript-eslint/visitor-keys": "8.74.0", "debug": "^4.4.3", - "minimatch": "^10.2.2", + "minimatch": "^11.0.1", "semver": "^7.7.3", "tinyglobby": "^0.2.15", "ts-api-utils": "^2.5.0" @@ -2383,17 +2617,23 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { + "@typescript/native": "npm:typescript@>=7.1.0-dev.20261009.1 || >=7.1.0-beta <7.1.0-dev", "typescript": ">=4.8.4 <6.1.0" + }, + "peerDependenciesMeta": { + "@typescript/native": { + "optional": true + } } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.67.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.67.0.tgz", - "integrity": "sha512-fkv8dHRDqfGtTHuJeebdrQ7cX6Ad4WAS00rgHh9UGvMycF1mjBfsxry1XsLIFhWZ6Judlh6UdzK+TYlbpCXgnA==", + "version": "8.74.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.74.0.tgz", + "integrity": "sha512-XSZmOtMUbWCBIM+2BK134FyMFxmll1mW2mPLk/PSwYQYzGIPMgJAqL929U4qXVizLv7Xq5b7r41/o7Ombuwk0g==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.67.0", + "@typescript-eslint/types": "8.74.0", "eslint-visitor-keys": "^5.0.0" }, "engines": { @@ -2405,9 +2645,9 @@ } }, "node_modules/@vitejs/plugin-vue": { - "version": "6.0.8", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-6.0.8.tgz", - "integrity": "sha512-0ZjgOg7oO6farnNGup7yvoM/YXZV84OZxHAwtflItNa/6zzQyVb5LNxyea3FEKEX2XlagIKzrlH7wwxkKgtiew==", + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-6.0.11.tgz", + "integrity": "sha512-m48lskIUJGlB6qUiYhDMI8nd2ngeidz2U4nKTjqI13cFMu5rH8JeEILPkDtK9Fk/TjBA2pkj8AlbenqDaKu+ww==", "dev": true, "license": "MIT", "dependencies": { @@ -2418,55 +2658,55 @@ }, "peerDependencies": { "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0", - "vue": "^3.2.25" + "vue": "^3.2.25 || ^3.6.0-rc.15" } }, "node_modules/@vitest/browser": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/@vitest/browser/-/browser-5.0.5.tgz", - "integrity": "sha512-IDMoZX/iZ8rkilw7weaSgN8tJ7iZ9hUv0wYoKXyiyjWjWFwLSWAY707DcVTgxTYOudWC1E3HA9LYn7kVa9a7uQ==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@vitest/browser/-/browser-5.1.1.tgz", + "integrity": "sha512-xxWAtzfr7tuRXtKLdyCY1hWEP74oLeb7hrGMFcoFBOTsvJnl5bmeQ9W2Wzzh8IJN1gHYp1eIRaduP/WHn+jUcA==", "dev": true, "license": "MIT", "dependencies": { "@blazediff/core": "1.10.0", - "@vitest/mocker": "5.0.5", - "@vitest/ui": "5.0.5", - "@vitest/utils": "5.0.5", - "magic-string": "^1.4.3", + "@vitest/mocker": "5.1.1", + "@vitest/ui": "5.1.1", + "@vitest/utils": "5.1.1", + "magic-string": "^1.4.5", "pngjs": "^7.0.0", "sirv": "^3.0.2", "tinyrainbow": "^3.2.0", - "ws": "^8.22.0" + "ws": "^8.22.1" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "vitest": "5.0.5" + "vitest": "5.1.1" } }, "node_modules/@vitest/browser-preview": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/@vitest/browser-preview/-/browser-preview-5.0.5.tgz", - "integrity": "sha512-ViNg4UlomGSJHtnnr7Txm+55P7/aAMMoS+1WYnWjp5w5tzf7YEUAICcs2sb1uMovEnC8el/8zUfkWZ8+7fPCKA==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@vitest/browser-preview/-/browser-preview-5.1.1.tgz", + "integrity": "sha512-HKTjVL3gVfc/GNcs2z1urdFN5bONsEUb9k+2E1rBL+774SqsPMrtCQ32CVpCbWB+I8ZTokjIFEFAzm+AjCd6RA==", "dev": true, "license": "MIT", "dependencies": { "@testing-library/dom": "^10.4.2", - "@testing-library/user-event": "^14.6.7", - "@vitest/browser": "5.0.5" + "@testing-library/user-event": "^14.6.8", + "@vitest/browser": "5.1.1" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "vitest": "5.0.5" + "vitest": "5.1.1" } }, "node_modules/@vitest/browser/node_modules/magic-string": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.3.tgz", - "integrity": "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==", + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", "dev": true, "license": "MIT", "dependencies": { @@ -2474,16 +2714,16 @@ } }, "node_modules/@vitest/mocker": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.5.tgz", - "integrity": "sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.1.1.tgz", + "integrity": "sha512-b2OgTB4+3ImWIVafXKazJXwLKwQxUNnix6b3xUvUTMh7RyXlrtzoxfZr8aEz9zkHOMAS4K5lu3TvFWoiVeVTQg==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/trace-mapping": "0.3.31", - "@vitest/spy": "5.0.5", + "@vitest/spy": "5.1.1", "estree-walker": "^3.0.3", - "magic-string": "^1.4.3" + "magic-string": "^1.4.5" }, "funding": { "url": "https://opencollective.com/vitest" @@ -2512,9 +2752,9 @@ } }, "node_modules/@vitest/mocker/node_modules/magic-string": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.3.tgz", - "integrity": "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==", + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", "dev": true, "license": "MIT", "dependencies": { @@ -2522,9 +2762,9 @@ } }, "node_modules/@vitest/pretty-format": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-5.0.5.tgz", - "integrity": "sha512-24sSdIlMA9DVPXnYiB9siwU0bTd887Y9jX3+vabztCSsvHwo7ipvJ/a2L3Rljw8+2rK1f5fCj3h5U9I/Jsqgbw==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-5.1.1.tgz", + "integrity": "sha512-25VrNCa2fxNyRv7VTtYBjJnC7hQkAzDLuSWJb8kHJATfCPe+5YPferPPDrSO7pcxik4+cBo4IXS2H7rf4OOXgg==", "dev": true, "license": "MIT", "dependencies": { @@ -2535,15 +2775,15 @@ } }, "node_modules/@vitest/snapshot": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-5.0.5.tgz", - "integrity": "sha512-dHyFElWMQy0wFBGrIaPPeUWfJFh+jAUrv46ImIJGd8CADdKV3mlrAu3FyD0wesdxELFCs9M807e040Kba/XKtA==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-5.1.1.tgz", + "integrity": "sha512-SIk7xA0A1VnFfa5oAZ6cRZ6eOJp+quXzbowRmow7jVGjEG+l4ToGOQi2LHEFCqJWC5tbK2hLYe2QnPYIuFpW7w==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "5.0.5", - "@vitest/utils": "5.0.5", - "magic-string": "^1.4.3", + "@vitest/pretty-format": "5.1.1", + "@vitest/utils": "5.1.1", + "magic-string": "^1.4.5", "pathe": "^2.0.3" }, "funding": { @@ -2551,9 +2791,9 @@ } }, "node_modules/@vitest/snapshot/node_modules/magic-string": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.3.tgz", - "integrity": "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==", + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", "dev": true, "license": "MIT", "dependencies": { @@ -2561,9 +2801,9 @@ } }, "node_modules/@vitest/spy": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.5.tgz", - "integrity": "sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.1.tgz", + "integrity": "sha512-6K8C6alQG1/Yc8/ZI22iJS7JEsxPdVzqtqDq+/xM4Z0mGVykemMVjLhqMy/q6/IHYG3kKD8hKSwRen/ZdyI9vQ==", "dev": true, "license": "MIT", "funding": { @@ -2571,13 +2811,13 @@ } }, "node_modules/@vitest/ui": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-5.0.5.tgz", - "integrity": "sha512-dCoGUOdgmCaSB2g+WQ/spPCBkytAWdNUkFSXY4z+eYp2d8JEOY8v0uDRaJTG9qf/kTlTVZ4CuYMYMz/f1HS/qQ==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-5.1.1.tgz", + "integrity": "sha512-qpNyZ9CAKhBCnWMZSYQMFJzcBvpqb7ssC9NHJUq8haNZkjC4rSMSmKZzMu7IYR1XMqiKOSIAF34FmOQkGP77Mw==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "5.0.5", + "@vitest/utils": "5.1.1", "fflate": "^0.8.3", "flatted": "^3.4.4", "pathe": "^2.0.3", @@ -2588,17 +2828,17 @@ "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "vitest": "5.0.5" + "vitest": "5.1.1" } }, "node_modules/@vitest/utils": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-5.0.5.tgz", - "integrity": "sha512-/rBu7gzLDQI/SC79Tn98b5DwOgaHU/Gt4I9OVeP3YofzNaYtbImRCOJQmT1S6vOJg9gEIlWC+r3QxKkjuSa1nQ==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-5.1.1.tgz", + "integrity": "sha512-CtwJP89ozg9RLHb70HM9jwzHnzZDaLTCovwr313CSRM6IkwNuIcORlZluW0zVNkmjJWBxPRLpvjnX6XhztjS2w==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "5.0.5", + "@vitest/pretty-format": "5.1.1", "convert-source-map": "^2.0.0", "tinyrainbow": "^3.2.0" }, @@ -2607,9 +2847,9 @@ } }, "node_modules/@voidzero-dev/vite-plus-darwin-arm64": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-darwin-arm64/-/vite-plus-darwin-arm64-1.3.0.tgz", - "integrity": "sha512-BF4W+UwGxUkHPrH2pZLhafJfkJT20WZIbMzZgZLGQ44LPpZPX8Sb+qtblUnXUkkCzTqad4XtSPgiLKglvZkNQQ==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-darwin-arm64/-/vite-plus-darwin-arm64-1.8.0.tgz", + "integrity": "sha512-j2QR6zkjDpHh9oOIgVaqljY2wbJcdgqF53Mbdhr8zPnB4bDOVf9fnxpV9MqJdRAfPAqwgU+qMpVeA3hSUddBpQ==", "cpu": [ "arm64" ], @@ -2623,9 +2863,9 @@ } }, "node_modules/@voidzero-dev/vite-plus-darwin-x64": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-darwin-x64/-/vite-plus-darwin-x64-1.3.0.tgz", - "integrity": "sha512-vLZTk0r+s3e7mycj4SGBbcpK+xyM8a86hXQZtQbJyW7xrGJzsavISy7/m4gGZpWN32Hl4Tmx9V/ffeaoXLkRdg==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-darwin-x64/-/vite-plus-darwin-x64-1.8.0.tgz", + "integrity": "sha512-j73bmtymB6oeOWkaLNqLUg82FBX/yEudRvtyxZp55UZCcAYVF2wN3TteB4LISNt46urE0H2xajrprnGNwRLpdA==", "cpu": [ "x64" ], @@ -2639,9 +2879,9 @@ } }, "node_modules/@voidzero-dev/vite-plus-linux-arm64-gnu": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-linux-arm64-gnu/-/vite-plus-linux-arm64-gnu-1.3.0.tgz", - "integrity": "sha512-H43Dj9RkEyjOFXxTk3DLTa6hqmHhxUN9vbbqNdwQoc3/TPNhC1zsLZy3qgUFbYGLdS7M9jICCqFzj5GDSYrhIw==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-linux-arm64-gnu/-/vite-plus-linux-arm64-gnu-1.8.0.tgz", + "integrity": "sha512-QPsbpuY3OplXhwYcJr+g1ks5e9X2fJhO6eY9iLoMouENMUTTmTpc00vwNPACO/HWO6YX/bQjY+86s7qGSSDqZw==", "cpu": [ "arm64" ], @@ -2658,9 +2898,9 @@ } }, "node_modules/@voidzero-dev/vite-plus-linux-arm64-musl": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-linux-arm64-musl/-/vite-plus-linux-arm64-musl-1.3.0.tgz", - "integrity": "sha512-Se2GlvzUZOvFy+5hoQHoG7LFeiplKs+EJwaskayCSLwZAP+e6/LTK7EK+8OcdMpmdsLPtZoTJHkIjSzrQowJwQ==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-linux-arm64-musl/-/vite-plus-linux-arm64-musl-1.8.0.tgz", + "integrity": "sha512-kSLxtRsOCRHGAbq3uWKPQj2elmJwZbS6jw5qUUWpkpK255aFNsA8e1FKQtWVvYgvEBeLpLoHHxt9CyRc7vEztg==", "cpu": [ "arm64" ], @@ -2677,9 +2917,9 @@ } }, "node_modules/@voidzero-dev/vite-plus-linux-x64-gnu": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-linux-x64-gnu/-/vite-plus-linux-x64-gnu-1.3.0.tgz", - "integrity": "sha512-moxojk6zmog2SaLE4/cG75acE6X3cjR0/52Ba8OG2ct0r+dv55VSE0kellAuxS6o9VHy7TBhkIpwpFpQ34rnAA==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-linux-x64-gnu/-/vite-plus-linux-x64-gnu-1.8.0.tgz", + "integrity": "sha512-bqL6QDjez58vyM7ZZm8pZNJCFnBEJOEAD/kkIryhNC+drfXf6VKV5IFJRykwf+Rd2pGN5FYCg803B2KovIoICw==", "cpu": [ "x64" ], @@ -2696,9 +2936,9 @@ } }, "node_modules/@voidzero-dev/vite-plus-linux-x64-musl": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-linux-x64-musl/-/vite-plus-linux-x64-musl-1.3.0.tgz", - "integrity": "sha512-CykxH008Dy9u20Myki9/UIqq3Dbo1ZMqa098aS6AtWp3QKyEKzSLPB3jKDUklgmu83xiFe5BpPA+33oF0yNY7A==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-linux-x64-musl/-/vite-plus-linux-x64-musl-1.8.0.tgz", + "integrity": "sha512-abU1t1ExqRkhT5A6u+Vpi/kHcsqwFahEDAm4uzBYTHBQ1/6xqatfZf4UtlrL0C68xrXfttPrGRZcfitv2TZqZA==", "cpu": [ "x64" ], @@ -2715,9 +2955,9 @@ } }, "node_modules/@voidzero-dev/vite-plus-win32-arm64-msvc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-win32-arm64-msvc/-/vite-plus-win32-arm64-msvc-1.3.0.tgz", - "integrity": "sha512-l61S9b8aeiDpi8wPRfz4HonqRkLpt/OVYs0sCskvlXYSW/L8qfLOtuWH/xpF8xDjMIfBefKejBVfU1UlRax5Tw==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-win32-arm64-msvc/-/vite-plus-win32-arm64-msvc-1.8.0.tgz", + "integrity": "sha512-bDg0/4orrkNOsGK60a60CX78t2UYPH1ohMd5GIr8RP7CJ139TQaUtFYqlhWKCn8mDKMNa+OL/WaujIC1nOGIBQ==", "cpu": [ "arm64" ], @@ -2731,9 +2971,9 @@ } }, "node_modules/@voidzero-dev/vite-plus-win32-x64-msvc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-win32-x64-msvc/-/vite-plus-win32-x64-msvc-1.3.0.tgz", - "integrity": "sha512-b6Ng8YezA6JA3adQBNA+8Mn26+OX4fw/tsPfnk//5Cx+1XFDZoAxWYXtGzc0yUQPEKnoGtfw/0OUvcibg61yYg==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-win32-x64-msvc/-/vite-plus-win32-x64-msvc-1.8.0.tgz", + "integrity": "sha512-HvQDw3gU8mXQHxZtXrElcFLPE9EGWBudPefsj5RruBM3UWRybfr4ejMLmHbv83/rDGAGvyflA/EdugO4uZl29g==", "cpu": [ "x64" ], @@ -2747,32 +2987,62 @@ } }, "node_modules/@volar/language-core": { - "version": "2.4.28", - "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.28.tgz", - "integrity": "sha512-w4qhIJ8ZSitgLAkVay6AbcnC7gP3glYM3fYwKV3srj8m494E3xtrCv6E+bWviiK/8hs6e6t1ij1s2Endql7vzQ==", + "version": "2.4.30", + "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.30.tgz", + "integrity": "sha512-73fjwEV8wat6aOZ6U/y/hqtE30ocrIWECg67b0txGczOMNw+MffLmvJ5fnFfN9drVUEYZzLdaNo6VAy6G6avMw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@volar/source-map": "2.4.30" + } + }, + "node_modules/@volar/language-service": { + "version": "2.4.30", + "resolved": "https://registry.npmjs.org/@volar/language-service/-/language-service-2.4.30.tgz", + "integrity": "sha512-w/xDsASiqC71ggCOm7sTDXDNk/l72XEptodeRC68tgZ0e5QM4hM3zAqBGC7mBctvhrpYwKfMG+t9xcUo2hEFtA==", "devOptional": true, "license": "MIT", "dependencies": { - "@volar/source-map": "2.4.28" + "@volar/language-core": "2.4.30", + "vscode-languageserver-protocol": "^3.17.5", + "vscode-languageserver-textdocument": "^1.0.11", + "vscode-uri": "^3.0.8" + }, + "peerDependencies": { + "typescript": "<7" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/@volar/source-map": { - "version": "2.4.28", - "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.28.tgz", - "integrity": "sha512-yX2BDBqJkRXfKw8my8VarTyjv48QwxdJtvRgUpNE5erCsgEUdI2DsLbpa+rOQVAJYshY99szEcRDmyHbF10ggQ==", + "version": "2.4.30", + "resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.30.tgz", + "integrity": "sha512-zym1ob/KwDDyN+0jGVtxwbxJSRRnUvv5HspCtz3yEfVVdCG4/dzxJktMGPAgemqRuVs81O0o/y0q3qOUErR8kg==", "devOptional": true, "license": "MIT" }, "node_modules/@volar/typescript": { - "version": "2.4.28", - "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.4.28.tgz", - "integrity": "sha512-Ja6yvWrbis2QtN4ClAKreeUZPVYMARDYZl9LMEv1iQ1QdepB6wn0jTRxA9MftYmYa4DQ4k/DaSZpFPUfxl8giw==", + "version": "2.4.30", + "resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.4.30.tgz", + "integrity": "sha512-/DgA5tgYFPfrLFuSjIMXMGHk1LQv2+P8eny6+BhGNzFJELWIW7UZlc56ZLIRFhLsPpMfIFxM8/HvOPBggrjTZg==", "devOptional": true, "license": "MIT", "dependencies": { - "@volar/language-core": "2.4.28", + "@volar/language-core": "2.4.30", + "@volar/language-service": "2.4.30", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" + }, + "peerDependencies": { + "typescript": "<7" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/@vscode/markdown-it-katex": { @@ -2812,53 +3082,83 @@ } }, "node_modules/@vue/compiler-core": { - "version": "3.5.41", - "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.41.tgz", - "integrity": "sha512-q0Xtv/F9w2YO/7htQhtiL+Ev2WCJbe5N2hc+XfgyKkEKqWpSxknmT8QOuGdEKNdjPq0c3F7rNpFkTo3Kfrm7pg==", + "version": "3.5.46", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.46.tgz", + "integrity": "sha512-yb+N8/mgBcoeqCJPVyJI/D3OphLrSMXnB3ZQUNmRLU/1fsMW4bFfdJWNi9oIj7+EA3ULKKkP7b/VCpcYQYeiuQ==", "license": "MIT", "dependencies": { - "@babel/parser": "^7.29.8", - "@vue/shared": "3.5.41", + "@babel/parser": "^7.29.12", + "@vue/shared": "3.5.46", "entities": "^7.0.1", "estree-walker": "^2.0.2", - "source-map-js": "^1.2.1" + "source-map-js": "^1.2.3" + } + }, + "node_modules/@vue/compiler-core/node_modules/@babel/parser": { + "version": "7.29.15", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.15.tgz", + "integrity": "sha512-RpKWyisHoP81twtSCgmE02iU0RnPcq1DN5bBEbpUePrjA9Q3wXhufnCJrrayPpoZieqFh3zyZQqwtSK0gGccRA==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.15" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" } }, "node_modules/@vue/compiler-dom": { - "version": "3.5.41", - "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.41.tgz", - "integrity": "sha512-oKacVfNglLvGjnS6BXOlGL7EyG2h8X03pqXCjzotRZUaXGjbrTJUnVAQjrCqUnS+lyu31nwQjZY/d817GmCnfw==", + "version": "3.5.46", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.46.tgz", + "integrity": "sha512-Bj3lCSw3DQnDRDxw115XqdLDd0+18Nftlgd8OXSGG+ud74hxJIE17eYrM+VWgQrTMsvJbLh9Hzf2MkwAzru36Q==", "license": "MIT", "dependencies": { - "@vue/compiler-core": "3.5.41", - "@vue/shared": "3.5.41" + "@vue/compiler-core": "3.5.46", + "@vue/shared": "3.5.46" } }, "node_modules/@vue/compiler-sfc": { - "version": "3.5.41", - "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.41.tgz", - "integrity": "sha512-XJhip7R2wy6vX3knCxdZN4KracFaZUef58s1KYewqluedHIJaPIVfXoYT7MF1F8nCvv6k8bWWxDC8opMkg1VTQ==", + "version": "3.5.46", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.46.tgz", + "integrity": "sha512-hjUvMxGh+QIgegwksfp6BRBYleE/a8veZHvTR6sa+o+bM4HU+WnrUZlhN0X+pDcsl8Lhwmbu72xPvLMk3XUwog==", "license": "MIT", "dependencies": { - "@babel/parser": "^7.29.8", - "@vue/compiler-core": "3.5.41", - "@vue/compiler-dom": "3.5.41", - "@vue/compiler-ssr": "3.5.41", - "@vue/shared": "3.5.41", + "@babel/parser": "^7.29.12", + "@vue/compiler-core": "3.5.46", + "@vue/compiler-dom": "3.5.46", + "@vue/compiler-ssr": "3.5.46", + "@vue/shared": "3.5.46", "estree-walker": "^2.0.2", "magic-string": "^0.30.21", - "postcss": "^8.5.19", - "source-map-js": "^1.2.1" + "postcss": "^8.5.32", + "source-map-js": "^1.2.3" + } + }, + "node_modules/@vue/compiler-sfc/node_modules/@babel/parser": { + "version": "7.29.15", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.15.tgz", + "integrity": "sha512-RpKWyisHoP81twtSCgmE02iU0RnPcq1DN5bBEbpUePrjA9Q3wXhufnCJrrayPpoZieqFh3zyZQqwtSK0gGccRA==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.15" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" } }, "node_modules/@vue/compiler-ssr": { - "version": "3.5.41", - "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.41.tgz", - "integrity": "sha512-U3v5OejKEGqOI0Wy0+Sz7hGuIFZHA4LSXzrNM3IMIeDyJEBBfTpX26n3SDgToRpP2bLc9FfI2j/kSgcJ8Emq5A==", + "version": "3.5.46", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.46.tgz", + "integrity": "sha512-qebChL3aP0m1k+TlSf+fZWvOwAf3flBCi5o+n01ykR3DX4mTIWheFltmoiQ12+z66/4cGeXqbB2P7sPWkGhQNQ==", "license": "MIT", "dependencies": { - "@vue/compiler-dom": "3.5.41", - "@vue/shared": "3.5.41" + "@vue/compiler-dom": "3.5.46", + "@vue/shared": "3.5.46" } }, "node_modules/@vue/devtools-api": { @@ -2889,13 +3189,13 @@ "license": "MIT" }, "node_modules/@vue/language-core": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/@vue/language-core/-/language-core-3.3.11.tgz", - "integrity": "sha512-QJmpliwAVpC/OxubIByPAhNzsQPRc8/gxlN2qnVzVfIMjMDz/9RnXRFoetjz5yEgXVXyp4LqhXq3V53PjmNzFw==", + "version": "3.3.14", + "resolved": "https://registry.npmjs.org/@vue/language-core/-/language-core-3.3.14.tgz", + "integrity": "sha512-kRB+3hHg0c+BdD1XLAvwjVMQd5pC05zijSlPDRI3ERvC/s04JlRs5upy2KjeMg/9m9oD5zuMVh9yVvkKfZqoJg==", "devOptional": true, "license": "MIT", "dependencies": { - "@volar/language-core": "2.4.28", + "@volar/language-core": "2.4.30", "@vue/compiler-dom": "^3.5.0", "@vue/shared": "^3.5.0", "alien-signals": "^3.2.1", @@ -2904,52 +3204,59 @@ "picomatch": "^4.0.4" } }, + "node_modules/@vue/language-core/node_modules/muggle-string": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/muggle-string/-/muggle-string-0.4.1.tgz", + "integrity": "sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==", + "devOptional": true, + "license": "MIT" + }, "node_modules/@vue/reactivity": { - "version": "3.5.41", - "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.41.tgz", - "integrity": "sha512-rznsqKM0np0x18EjzF8x88MpEhdNsffbvFbckLL5+oUKz1BxAImEmO7J1ArRYSyo6aQaVoBDp7jEkT91OOxydA==", + "version": "3.5.46", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.46.tgz", + "integrity": "sha512-+FHtYTvGxgFoX3oRs7soz6JHizGv50Q26WJN6PWtXuTLXRfkfUpDUTRuoTA/kiZVVt8NMeMpsPQLh9h++ReUjQ==", "license": "MIT", "dependencies": { - "@vue/shared": "3.5.41" + "@vue/shared": "3.5.46" } }, "node_modules/@vue/runtime-core": { - "version": "3.5.41", - "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.41.tgz", - "integrity": "sha512-Vcry58hiAKwGen9Z1jUZE0feFsNArPCMOImYI8el48A9Idf6DuQYD0U05zZIF2Iad1hGhPSvcbBbAOhNr55fhg==", + "version": "3.5.46", + "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.46.tgz", + "integrity": "sha512-eJUzKAUaHAmtnys/l9qduPzUnBrYMkmsCU7TN+vbSOSpm8kcETT7nacKxIO4MBej/XiOraVzq+lSeZv7o1//jQ==", "license": "MIT", "dependencies": { - "@vue/reactivity": "3.5.41", - "@vue/shared": "3.5.41" + "@vue/reactivity": "3.5.46", + "@vue/shared": "3.5.46" } }, "node_modules/@vue/runtime-dom": { - "version": "3.5.41", - "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.41.tgz", - "integrity": "sha512-3vVBahVBS9+U6cmXBLyb8nE6/yYo4J/CGI9eVFs3KiMc0YHuudwKyShTD65jtJy/L9PUUxNAFu4cj4LiJ0UFbw==", + "version": "3.5.46", + "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.46.tgz", + "integrity": "sha512-6L7lbBvXTYBFFjIt25a0pgdpmn3Ns8RqUnNVibRzF4bgyiWJvqOhKEV5MXYWKlCttZE3aGeJN8mveo+6IrIKXA==", "license": "MIT", "dependencies": { - "@vue/reactivity": "3.5.41", - "@vue/runtime-core": "3.5.41", - "@vue/shared": "3.5.41", - "csstype": "^3.2.3" + "@vue/reactivity": "3.5.46", + "@vue/runtime-core": "3.5.46", + "@vue/shared": "3.5.46", + "csstype": "^3.2.4" } }, "node_modules/@vue/server-renderer": { - "version": "3.5.41", - "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.41.tgz", - "integrity": "sha512-n6hx/pNFfbD6SuyeuMVkvqox8bwf/ET9JlA/kAz/imw8sw++wkqKe2mHX5KutjPpbKE4Z56yTHszoOjGMI9igQ==", + "version": "3.5.46", + "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.46.tgz", + "integrity": "sha512-4mc0YWREc6OZ5pDCigvKPDzIUV+aciiH92yvyTS6xaHHxW/80rMceQQn11pYe7OEEBt2YQgYWR9zF8QF30GJUQ==", "license": "MIT", "dependencies": { - "@vue/compiler-ssr": "3.5.41", - "@vue/runtime-dom": "3.5.41", - "@vue/shared": "3.5.41" + "@vue/compiler-ssr": "3.5.46", + "@vue/runtime-dom": "3.5.46", + "@vue/shared": "3.5.46" } }, "node_modules/@vue/shared": { - "version": "3.5.41", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.41.tgz", - "integrity": "sha512-IOnwSCma8j+9xJT6b8H0dEYidC80NsYmNMlZxRsukYcSoGaDBohog5hDxzeUXdFeGWFA++vWvxqOmrr96VlqMA==", + "version": "3.5.46", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.46.tgz", + "integrity": "sha512-P1WePbdzHrcIciWtmY2Im9EFhdakd3rZxYqvalOa3SfoxtF35Q8Uhmj1tKn6bWP4utcOpN8ao6BoJUItq0Uf+g==", "license": "MIT" }, "node_modules/@vueuse/core": { @@ -2991,9 +3298,9 @@ } }, "node_modules/@wailsio/runtime": { - "version": "3.0.0-beta.29", - "resolved": "https://registry.npmjs.org/@wailsio/runtime/-/runtime-3.0.0-beta.29.tgz", - "integrity": "sha512-ZrYvyb2vJ8rAn9mdBBbpNsNRk8Yg5+0DCWhfIQbfoNyI329Lwu8irPYqRneFuNlttA39qsQ0a5mG4mbgBF8g3g==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@wailsio/runtime/-/runtime-3.1.0.tgz", + "integrity": "sha512-noEAedvRyO8TLCrqhGwzrp+mbMxAIDa2rYmdJQOzvJV9MxgaZeXAJGNBiMiKMTSSy4ESOtQi4VH/5heSzi6ZmA==", "license": "MIT" }, "node_modules/@yuku-core/binding-android-arm64": { @@ -3247,9 +3554,9 @@ } }, "node_modules/argparse": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-3.0.2.tgz", - "integrity": "sha512-mFdDM6WqWKraGLsVb+C9CahPnzTXOefAOLq3jYcca2YZ8bEWpr++Tzj+zSaKW9+X9L5uSxcm1AZ3Y6aZJ09OhQ==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-3.0.4.tgz", + "integrity": "sha512-fwWK3Zq22l4XJJjx5mcBHGikIk+hJqO+32dPm0Jur7+rtG5x1scOjSfdT9ZKeWHPpsya/l0HHK4tDImBkTrtvA==", "funding": [ { "type": "github", @@ -3311,22 +3618,94 @@ } }, "node_modules/ast-walker-scope": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/ast-walker-scope/-/ast-walker-scope-0.9.0.tgz", - "integrity": "sha512-IJdzo2vLiElBxKzwS36VsCue/62d6IdWjnPB2v3nuPKeWGynp6FF/CYoLa5i/3jXH/z97ZDdsXz6abpgM6w07A==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/ast-walker-scope/-/ast-walker-scope-0.10.0.tgz", + "integrity": "sha512-KzvoxDfXNz2Gm8KYLh47K3qcY3Zza3WKOuh2xoqa7LBu6MDKWAZLovJtU9DuAd/Er+rhQHCRn619lHS5U+qmhw==", "license": "MIT", "dependencies": { - "@babel/parser": "^7.29.2", - "@babel/types": "^7.29.0", - "ast-kit": "^2.2.0" + "@babel/parser": "^8.0.0", + "@babel/types": "^8.0.0", + "ast-kit": "^3.0.0" }, "engines": { - "node": ">=20.19.0" + "node": "^22.18.0 || >=24.11.0" + }, + "funding": { + "url": "https://github.com/sponsors/sxzz" + } + }, + "node_modules/ast-walker-scope/node_modules/@babel/helper-string-parser": { + "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-8.1.3.tgz", + "integrity": "sha512-5HTuREtgj0xIc345zU4gtD2+3vIPkZpJw7wUYytt/mzBTQN2mWpGr1nxYiocYa2E8sWggRkrSg/k7BK51pAxIg==", + "license": "MIT", + "engines": { + "node": "^22.18.0 || >=24.11.0" + } + }, + "node_modules/ast-walker-scope/node_modules/@babel/helper-validator-identifier": { + "version": "8.0.6", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-8.0.6.tgz", + "integrity": "sha512-HYx0YmuchRxRSpnjvcNffnPS8DCauKNmnumIuHG3jnQAVewRA7kfJGwF13ayEpSZs7s4R/oBH4eppuXcAQd5JQ==", + "license": "MIT", + "engines": { + "node": "^22.18.0 || >=24.11.0" + } + }, + "node_modules/ast-walker-scope/node_modules/@babel/parser": { + "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-8.1.3.tgz", + "integrity": "sha512-v3ck2WN7jn8gEJlEfIDEwTM8dCBjOac1CZjolvB6/r0O1ome6E7xS2cDQEOQqESRQZWWrLrhnjxD0qjmZ8QBgg==", + "license": "MIT", + "dependencies": { + "@babel/types": "^8.1.3" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": "^22.18.0 || >=24.11.0" + } + }, + "node_modules/ast-walker-scope/node_modules/@babel/types": { + "version": "8.1.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-8.1.3.tgz", + "integrity": "sha512-eBREGwDHRPHtdsg44t071GE2KRDEuJrf0J2uT5/qvJPB2+pfPZOKlx93dMZOFkE7QW5G0JWoczySD7a01Jf0iw==", + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^8.1.3", + "@babel/helper-validator-identifier": "^8.0.6" + }, + "engines": { + "node": "^22.18.0 || >=24.11.0" + } + }, + "node_modules/ast-walker-scope/node_modules/ast-kit": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ast-kit/-/ast-kit-3.0.1.tgz", + "integrity": "sha512-fCGiQvmHghhf858e/SVGh2aUo/FsbtB5qB8bifo6ygHK5OMcGna56FUvS0IrYvo+unYwIi1nCklEh/KUaOKVmg==", + "license": "MIT", + "dependencies": { + "@babel/parser": "^8.1.0", + "estree-walker": "^3.0.3", + "pathe": "^2.0.3" + }, + "engines": { + "node": "^22.18.0 || >=24.11.0" }, "funding": { "url": "https://github.com/sponsors/sxzz" } }, + "node_modules/ast-walker-scope/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, "node_modules/balanced-match": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", @@ -3364,9 +3743,9 @@ "license": "ISC" }, "node_modules/brace-expansion": { - "version": "5.0.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", - "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.1.0.tgz", + "integrity": "sha512-aa11Dv491GKnYqxaul3aRJ0szew7yMJMfZPnqD44NjGrZXoj62l41OEDDpdpC4eE2P88vBFfLuSyRhpG91NUvg==", "dev": true, "license": "MIT", "dependencies": { @@ -3376,6 +3755,20 @@ "node": "20 || >=22" } }, + "node_modules/cacheable": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-2.5.0.tgz", + "integrity": "sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/memory": "^2.2.0", + "@cacheable/utils": "^2.5.0", + "hookified": "^1.15.0", + "keyv": "^5.6.0", + "qified": "^0.10.1" + } + }, "node_modules/chai": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", @@ -3391,6 +3784,7 @@ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz", "integrity": "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==", "license": "MIT", + "optional": true, "dependencies": { "readdirp": "^5.0.0" }, @@ -3422,9 +3816,9 @@ } }, "node_modules/confbox": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.2.4.tgz", - "integrity": "sha512-ysOGlgTFbN2/Y6Cg3Iye8YKulHw+R2fNXHrgSmXISQdMnomY6eNDprVdW9R5xBguEqI954+S6709UyiO7B+6OQ==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.3.2.tgz", + "integrity": "sha512-ZUAKhKlkCOrIGKc8cj7zek9s9z1mveHif/25nUshI2BzCRzF7KH7KHa+Lnh2ubq+e1tIlaFuP763mzW4qVoehg==", "license": "MIT" }, "node_modules/convert-source-map": { @@ -3449,23 +3843,10 @@ "node": ">= 8" } }, - "node_modules/cssesc": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", - "dev": true, - "license": "MIT", - "bin": { - "cssesc": "bin/cssesc" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/csstype": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", - "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.4.tgz", + "integrity": "sha512-PoKaoPzQapnEoqUSnHx1u6W6ku8CVEgKsnpmmzU3m1nwkidpPBQ8V/Zq2+bWNrsOKoKLwTGdbx6xF7BXP1zLVQ==", "license": "MIT" }, "node_modules/debug": { @@ -3543,9 +3924,9 @@ "license": "EPL-2.0" }, "node_modules/enhanced-resolve": { - "version": "5.24.5", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.24.5.tgz", - "integrity": "sha512-L1l8TNvomm6UVW5B253AGxQagSQr+vGwhMlrrfRS2qmhx46AMpMVJKQYLvWYbysTMY8VoicOvzHzoHMbyzB+4A==", + "version": "5.27.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.27.0.tgz", + "integrity": "sha512-Do6BB2xzlcc/odFg+XEYyneAx4T/WfywO71yw9ePS2tVfRsf7JVR4mUeELadIeHzixkzbG5DpluiEFPi2WGfYQ==", "dev": true, "license": "MIT", "dependencies": { @@ -3589,9 +3970,9 @@ } }, "node_modules/eslint": { - "version": "10.9.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.9.0.tgz", - "integrity": "sha512-5KeEOJZBfEVA47boFiBsf+6MmmJpffM7qEBg4pLla2e4nlKgdKlqCW0oSLOGsT8Wl5uCGJptLV1bkaiShj90Gw==", + "version": "10.16.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.16.0.tgz", + "integrity": "sha512-Xu3PRLG/wCaZWZ20gkExUcNqL2mWWsXTR+Lln3Sof4Y9WuA678fH9hrlQ8B6UNwbTnsKdDdBYOd2jxtycXVTGQ==", "dev": true, "license": "MIT", "workspaces": [ @@ -3600,11 +3981,11 @@ "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.2", - "@eslint/config-array": "^0.23.5", + "@eslint/config-array": "^0.23.7", "@eslint/config-helpers": "^0.7.0", "@eslint/core": "^1.2.1", - "@eslint/plugin-kit": "^0.7.2", - "@humanfs/node": "^0.16.6", + "@eslint/plugin-kit": "^0.7.3", + "@humanfs/node": "^0.16.8", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", @@ -3618,14 +3999,14 @@ "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^8.0.0", + "file-entry-cache": "11.1.5 || >11.1.6 <12", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", - "minimatch": "^10.2.5", + "minimatch": "^11.0.5", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, @@ -3648,9 +4029,9 @@ } }, "node_modules/eslint-config-prettier": { - "version": "10.1.8", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz", - "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", + "version": "10.1.9", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.9.tgz", + "integrity": "sha512-JnOR0K4u67CWOiSS3vaduGlLUWS32lGiyglMIV6AyvK9DBRpS+QhR2ESKaUe2eWGRsdVmrxy77yaOk2hzDa4Bg==", "dev": true, "license": "MIT", "bin": { @@ -3664,29 +4045,29 @@ } }, "node_modules/eslint-plugin-oxlint": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-oxlint/-/eslint-plugin-oxlint-1.88.0.tgz", - "integrity": "sha512-5njQn7i07e3mTMzoj4acolSZZXqnd3H1S3JcV8lUJfpavoB2UvRKNiq9fZXYFLY4iHvsckUK2yQxnJn44ImjnA==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-oxlint/-/eslint-plugin-oxlint-1.95.0.tgz", + "integrity": "sha512-JVl2HXdkxg7MNSTzMapg4yhCep3OsxFxFuX8RmZxF9z4/SXwXodQJIsVK4Ce3Zej1QnodlohQOC47C7OokT4AQ==", "dev": true, "license": "MIT", "dependencies": { "jsonc-parser": "^3.3.1" }, "peerDependencies": { - "oxlint": "~1.88.0" + "oxlint": "~1.95.0" } }, "node_modules/eslint-plugin-vue": { - "version": "10.10.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-10.10.0.tgz", - "integrity": "sha512-dL9x9rBHqqNcByWiLOHK6L0SB97V82/NC0cZRn9cXPjM7pCuWlpQQP9bFH4vjBv80ej1ZpzAkuD8zWH1o9bZbA==", + "version": "10.12.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-10.12.1.tgz", + "integrity": "sha512-Z5hmchVWq4EEOCn131J2p/uS4hjkrC+goPV5c/YApTY68xTqV3K5IYqD0mYGupDvZ6iYoTSuhSZUoWN+gZIqZQ==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", "natural-compare": "^1.4.0", "nth-check": "^2.1.1", - "postcss-selector-parser": "^7.1.4", + "postcss-selector-parser": "^7.1.7", "semver": "^7.8.5", "xml-name-validator": "^5.0.0" }, @@ -3811,9 +4192,9 @@ } }, "node_modules/eventsource-parser": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-4.1.0.tgz", - "integrity": "sha512-+DHvQ1wLO//MK+1OZgcuXCbZFKgu3YjKPJt7n98rxX8vezL0ni+7s3ZQiM8bJkUEOk7MsuCycrPLj0FzUNf7Og==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-4.1.3.tgz", + "integrity": "sha512-jZVIVilXZfAx6H20ZKKEj5dabbpD9ETmMj3uHsjMmgBzBHB6tsHrmdWB4mAiy3amtN6MOoVkfXRQu4wf1n88Rw==", "license": "MIT", "engines": { "node": ">=22.12" @@ -3881,16 +4262,13 @@ "license": "MIT" }, "node_modules/file-entry-cache": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", - "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "version": "11.1.5", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-11.1.5.tgz", + "integrity": "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q==", "dev": true, "license": "MIT", "dependencies": { - "flat-cache": "^4.0.0" - }, - "engines": { - "node": ">=16.0.0" + "flat-cache": "^6.1.23" } }, "node_modules/find-up": { @@ -3911,17 +4289,15 @@ } }, "node_modules/flat-cache": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", - "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "version": "6.1.23", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.23.tgz", + "integrity": "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA==", "dev": true, "license": "MIT", "dependencies": { - "flatted": "^3.2.9", - "keyv": "^4.5.4" - }, - "engines": { - "node": ">=16" + "cacheable": "^2.5.0", + "flatted": "^3.4.2", + "hookified": "^1.15.0" } }, "node_modules/flatted": { @@ -3959,11 +4335,11 @@ } }, "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "version": "4.2.12", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.12.tgz", + "integrity": "sha512-iuyGF2E4oafQfPsRrG2wtY2ILupMhvtdrhzrxB+0VcjsPpSPttpfYdjnGFGsTi5MaJFjI1jOKHPQ6UTbTj9TAw==", "dev": true, - "license": "ISC" + "license": "BlueOak-1.0.0" }, "node_modules/has-flag": { "version": "4.0.0", @@ -3975,6 +4351,19 @@ "node": ">=8" } }, + "node_modules/hashery": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/hashery/-/hashery-1.5.1.tgz", + "integrity": "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^1.15.0" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/highlight.js": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.12.0.tgz", @@ -3990,6 +4379,13 @@ "integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==", "license": "MIT" }, + "node_modules/hookified": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.15.1.tgz", + "integrity": "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==", + "dev": true, + "license": "MIT" + }, "node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -4001,9 +4397,9 @@ } }, "node_modules/immutable": { - "version": "5.1.9", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.9.tgz", - "integrity": "sha512-m8nVez3rwrgmWxtLMt1ZYXB2Lv7OKYn/disyxAlSDYAlKSlFoPPfIAmAM/M5xqL4m4C/wAPw7S2/CNaUii1Hxg==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-5.2.1.tgz", + "integrity": "sha512-CgXNM1BhKqpMjFHTyqQSk09OWqzHNJ/U4BdeBgXoBdR2DdgBdOSv131cO1/YMgzopqnka3B/i949UaMLEKUxOA==", "devOptional": true, "license": "MIT" }, @@ -4064,13 +4460,6 @@ "dev": true, "license": "MIT" }, - "node_modules/json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true, - "license": "MIT" - }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -4109,13 +4498,13 @@ } }, "node_modules/keyv": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", - "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.6.0.tgz", + "integrity": "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==", "dev": true, "license": "MIT", "dependencies": { - "json-buffer": "3.0.1" + "@keyv/serialize": "^1.1.1" } }, "node_modules/levn": { @@ -4133,10 +4522,10 @@ } }, "node_modules/lightningcss": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", - "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", - "dev": true, + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", + "devOptional": true, "license": "MPL-2.0", "dependencies": { "detect-libc": "^2.0.3" @@ -4149,27 +4538,26 @@ "url": "https://opencollective.com/parcel" }, "optionalDependencies": { - "lightningcss-android-arm64": "1.32.0", - "lightningcss-darwin-arm64": "1.32.0", - "lightningcss-darwin-x64": "1.32.0", - "lightningcss-freebsd-x64": "1.32.0", - "lightningcss-linux-arm-gnueabihf": "1.32.0", - "lightningcss-linux-arm64-gnu": "1.32.0", - "lightningcss-linux-arm64-musl": "1.32.0", - "lightningcss-linux-x64-gnu": "1.32.0", - "lightningcss-linux-x64-musl": "1.32.0", - "lightningcss-win32-arm64-msvc": "1.32.0", - "lightningcss-win32-x64-msvc": "1.32.0" - } - }, - "node_modules/lightningcss-android-arm64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz", - "integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==", - "cpu": [ - "arm64" + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -4184,13 +4572,12 @@ } }, "node_modules/lightningcss-darwin-arm64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz", - "integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", "cpu": [ "arm64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -4205,13 +4592,12 @@ } }, "node_modules/lightningcss-darwin-x64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz", - "integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", "cpu": [ "x64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -4226,13 +4612,12 @@ } }, "node_modules/lightningcss-freebsd-x64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz", - "integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", "cpu": [ "x64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -4247,13 +4632,12 @@ } }, "node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz", - "integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", "cpu": [ "arm" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -4268,13 +4652,15 @@ } }, "node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz", - "integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", "cpu": [ "arm64" ], - "dev": true, + "libc": [ + "glibc" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -4289,13 +4675,15 @@ } }, "node_modules/lightningcss-linux-arm64-musl": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz", - "integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", "cpu": [ "arm64" ], - "dev": true, + "libc": [ + "musl" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -4310,13 +4698,15 @@ } }, "node_modules/lightningcss-linux-x64-gnu": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz", - "integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", "cpu": [ "x64" ], - "dev": true, + "libc": [ + "glibc" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -4331,13 +4721,15 @@ } }, "node_modules/lightningcss-linux-x64-musl": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz", - "integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", "cpu": [ "x64" ], - "dev": true, + "libc": [ + "musl" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -4352,13 +4744,12 @@ } }, "node_modules/lightningcss-win32-arm64-msvc": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz", - "integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", "cpu": [ "arm64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -4373,13 +4764,12 @@ } }, "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz", - "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", "cpu": [ "x64" ], - "dev": true, "license": "MPL-2.0", "optional": true, "os": [ @@ -4480,9 +4870,9 @@ } }, "node_modules/markdown-it": { - "version": "15.0.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-15.0.2.tgz", - "integrity": "sha512-q4IGxMv56jCqT4OCRCADBoDP3LO4MhmTXjFbphHPXs4g3j9Xg5RDnxqN8IF/3vIWEU+VCnUq+7JUg/cfy2E6Qw==", + "version": "15.0.3", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-15.0.3.tgz", + "integrity": "sha512-+Az7Ojz3iRGu8KYMvJ6xVhvrxP3eE+vEtJX75Ow88XBpcQNV/0lGX5ZynIIBftREo4DC2jsveAMDaeltmm8QvQ==", "funding": [ { "type": "github", @@ -4495,9 +4885,9 @@ ], "license": "MIT", "dependencies": { - "argparse": "^3.0.0", - "entities": "^8.0.0", - "linkify-it": "^6.0.0", + "argparse": "^3.0.3", + "entities": "^8.1.0", + "linkify-it": "^6.1.0", "mdurl": "^2.1.0", "punycode.js": "^2.3.1", "uc.micro": "^3.0.0" @@ -4525,16 +4915,17 @@ "license": "MIT" }, "node_modules/minimatch": { - "version": "10.2.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", - "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "version": "11.0.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-11.0.9.tgz", + "integrity": "sha512-KCFkfyjqerNlSstjlhIGNXIKZGA/6O4V4RlhZ+Dsr621SPPw0mzlypE9D9ZOoPiVefHID+j7/XuMMlqfD/F60Q==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^5.0.8" + "@isaacs/nonrecursive-glob-match": "^1.1.0", + "brace-expansion": "^5.0.12" }, "engines": { - "node": "18 || 20 || >=22" + "node": "20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -4587,10 +4978,13 @@ "license": "MIT" }, "node_modules/muggle-string": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/muggle-string/-/muggle-string-0.4.1.tgz", - "integrity": "sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==", - "license": "MIT" + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/muggle-string/-/muggle-string-1.0.6.tgz", + "integrity": "sha512-kB/+YLCZXJP3ippQ1c3NG376og/Qz+pfojyYHKFQYf+2b43HJwGDy9tEY3HQfeAcrwqiuYg/Oe1ICQeNSviDTw==", + "license": "MIT", + "engines": { + "node": ">=12" + } }, "node_modules/nanoid": { "version": "3.3.20", @@ -4682,9 +5076,9 @@ } }, "node_modules/oxfmt": { - "version": "0.73.0", - "resolved": "https://registry.npmjs.org/oxfmt/-/oxfmt-0.73.0.tgz", - "integrity": "sha512-Ke4xbpuzqIBP4bkd48q815RhqWNJqOBzxVA9199M4qcF0y0LtpUv7UTg1dJ5ea6jw0RBUDZvX3qOUMNmmxfxbw==", + "version": "0.79.0", + "resolved": "https://registry.npmjs.org/oxfmt/-/oxfmt-0.79.0.tgz", + "integrity": "sha512-92iLHGxAgtYk6jLp/1ZBnEeABveNduHZgMDQj7tyqO9iafuJG3q+YHJq0R5Aa4YT+E6xswMQXdmPZYMwynS8ig==", "dev": true, "license": "MIT", "dependencies": { @@ -4700,28 +5094,28 @@ "url": "https://github.com/sponsors/oxc-project" }, "optionalDependencies": { - "@oxfmt/binding-android-arm-eabi": "0.73.0", - "@oxfmt/binding-android-arm64": "0.73.0", - "@oxfmt/binding-darwin-arm64": "0.73.0", - "@oxfmt/binding-darwin-x64": "0.73.0", - "@oxfmt/binding-freebsd-x64": "0.73.0", - "@oxfmt/binding-linux-arm-gnueabihf": "0.73.0", - "@oxfmt/binding-linux-arm-musleabihf": "0.73.0", - "@oxfmt/binding-linux-arm64-gnu": "0.73.0", - "@oxfmt/binding-linux-arm64-musl": "0.73.0", - "@oxfmt/binding-linux-ppc64-gnu": "0.73.0", - "@oxfmt/binding-linux-riscv64-gnu": "0.73.0", - "@oxfmt/binding-linux-riscv64-musl": "0.73.0", - "@oxfmt/binding-linux-s390x-gnu": "0.73.0", - "@oxfmt/binding-linux-x64-gnu": "0.73.0", - "@oxfmt/binding-linux-x64-musl": "0.73.0", - "@oxfmt/binding-openharmony-arm64": "0.73.0", - "@oxfmt/binding-win32-arm64-msvc": "0.73.0", - "@oxfmt/binding-win32-ia32-msvc": "0.73.0", - "@oxfmt/binding-win32-x64-msvc": "0.73.0" + "@oxfmt/binding-android-arm-eabi": "0.79.0", + "@oxfmt/binding-android-arm64": "0.79.0", + "@oxfmt/binding-darwin-arm64": "0.79.0", + "@oxfmt/binding-darwin-x64": "0.79.0", + "@oxfmt/binding-freebsd-x64": "0.79.0", + "@oxfmt/binding-linux-arm-gnueabihf": "0.79.0", + "@oxfmt/binding-linux-arm-musleabihf": "0.79.0", + "@oxfmt/binding-linux-arm64-gnu": "0.79.0", + "@oxfmt/binding-linux-arm64-musl": "0.79.0", + "@oxfmt/binding-linux-ppc64-gnu": "0.79.0", + "@oxfmt/binding-linux-riscv64-gnu": "0.79.0", + "@oxfmt/binding-linux-riscv64-musl": "0.79.0", + "@oxfmt/binding-linux-s390x-gnu": "0.79.0", + "@oxfmt/binding-linux-x64-gnu": "0.79.0", + "@oxfmt/binding-linux-x64-musl": "0.79.0", + "@oxfmt/binding-openharmony-arm64": "0.79.0", + "@oxfmt/binding-win32-arm64-msvc": "0.79.0", + "@oxfmt/binding-win32-ia32-msvc": "0.79.0", + "@oxfmt/binding-win32-x64-msvc": "0.79.0" }, "peerDependencies": { - "@astrojs/compiler-rs": "^0.4.0 || ^0.5.0", + "@astrojs/compiler-rs": "^0.5.0", "svelte": "^5.0.0", "vite-plus": "*" }, @@ -4738,11 +5132,12 @@ } }, "node_modules/oxlint": { - "version": "1.88.0", - "resolved": "https://registry.npmjs.org/oxlint/-/oxlint-1.88.0.tgz", - "integrity": "sha512-uIcFgw8BmqvFRGzH5+r7d2zJMEexwNSrEmM6WQNnGh3VkO0XYTEFoyxyNE6tjKMUib9Cue4XJA2DoWruO5D6aw==", + "version": "1.95.0", + "resolved": "https://registry.npmjs.org/oxlint/-/oxlint-1.95.0.tgz", + "integrity": "sha512-eNzjFjm1TU02/+ohAJjOB7aekRQgTXhOWxMGscEm8VJMokNnnix+PCZn7kqIuGIqxAoBnHxatqlN3Chz3N6PKA==", "dev": true, "license": "MIT", + "peer": true, "bin": { "oxlint": "bin/oxlint" }, @@ -4753,28 +5148,28 @@ "url": "https://github.com/sponsors/oxc-project" }, "optionalDependencies": { - "@oxlint/binding-android-arm-eabi": "1.88.0", - "@oxlint/binding-android-arm64": "1.88.0", - "@oxlint/binding-darwin-arm64": "1.88.0", - "@oxlint/binding-darwin-x64": "1.88.0", - "@oxlint/binding-freebsd-x64": "1.88.0", - "@oxlint/binding-linux-arm-gnueabihf": "1.88.0", - "@oxlint/binding-linux-arm-musleabihf": "1.88.0", - "@oxlint/binding-linux-arm64-gnu": "1.88.0", - "@oxlint/binding-linux-arm64-musl": "1.88.0", - "@oxlint/binding-linux-ppc64-gnu": "1.88.0", - "@oxlint/binding-linux-riscv64-gnu": "1.88.0", - "@oxlint/binding-linux-riscv64-musl": "1.88.0", - "@oxlint/binding-linux-s390x-gnu": "1.88.0", - "@oxlint/binding-linux-x64-gnu": "1.88.0", - "@oxlint/binding-linux-x64-musl": "1.88.0", - "@oxlint/binding-openharmony-arm64": "1.88.0", - "@oxlint/binding-win32-arm64-msvc": "1.88.0", - "@oxlint/binding-win32-ia32-msvc": "1.88.0", - "@oxlint/binding-win32-x64-msvc": "1.88.0" + "@oxlint/binding-android-arm-eabi": "1.95.0", + "@oxlint/binding-android-arm64": "1.95.0", + "@oxlint/binding-darwin-arm64": "1.95.0", + "@oxlint/binding-darwin-x64": "1.95.0", + "@oxlint/binding-freebsd-x64": "1.95.0", + "@oxlint/binding-linux-arm-gnueabihf": "1.95.0", + "@oxlint/binding-linux-arm-musleabihf": "1.95.0", + "@oxlint/binding-linux-arm64-gnu": "1.95.0", + "@oxlint/binding-linux-arm64-musl": "1.95.0", + "@oxlint/binding-linux-ppc64-gnu": "1.95.0", + "@oxlint/binding-linux-riscv64-gnu": "1.95.0", + "@oxlint/binding-linux-riscv64-musl": "1.95.0", + "@oxlint/binding-linux-s390x-gnu": "1.95.0", + "@oxlint/binding-linux-x64-gnu": "1.95.0", + "@oxlint/binding-linux-x64-musl": "1.95.0", + "@oxlint/binding-openharmony-arm64": "1.95.0", + "@oxlint/binding-win32-arm64-msvc": "1.95.0", + "@oxlint/binding-win32-ia32-msvc": "1.95.0", + "@oxlint/binding-win32-x64-msvc": "1.95.0" }, "peerDependencies": { - "oxlint-tsgolint": ">=7.0.2003", + "oxlint-tsgolint": ">=7.0.2008", "vite-plus": "*" }, "peerDependenciesMeta": { @@ -4786,24 +5181,6 @@ } } }, - "node_modules/oxlint-tsgolint": { - "version": "7.0.2004", - "resolved": "https://registry.npmjs.org/oxlint-tsgolint/-/oxlint-tsgolint-7.0.2004.tgz", - "integrity": "sha512-vQ9WDF3fiZJvRdSDosNOflerOCOpwol6vWzVDxW76RcU19cjTh7engvkHLvmv+tzedR8fAiJUVUGr6IVZdkzXQ==", - "dev": true, - "license": "MIT", - "bin": { - "tsgolint": "bin/tsgolint.js" - }, - "optionalDependencies": { - "@oxlint-tsgolint/darwin-arm64": "7.0.2004", - "@oxlint-tsgolint/darwin-x64": "7.0.2004", - "@oxlint-tsgolint/linux-arm64": "7.0.2004", - "@oxlint-tsgolint/linux-x64": "7.0.2004", - "@oxlint-tsgolint/win32-arm64": "7.0.2004", - "@oxlint-tsgolint/win32-x64": "7.0.2004" - } - }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -4870,15 +5247,15 @@ "license": "MIT" }, "node_modules/pdfjs-dist": { - "version": "6.4.299", - "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-6.4.299.tgz", - "integrity": "sha512-AVl138zALtfaAPvADulE0PZThbYzCBS79nL4pOSL/6Sm/4AH5A21BD9VHt97OlCuzJuCpmeZtAtkinisF4Vb1g==", + "version": "6.5.438", + "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-6.5.438.tgz", + "integrity": "sha512-vg8Pw1x+AFKy4AMDvhuWl5cOYV8d698UoEANoFFhc79hqXDnZQqnOXoxw3HG907WHOg1JYOvLhP756boddFxpA==", "license": "Apache-2.0", "engines": { "node": ">=22.13.0 || >=24" }, "optionalDependencies": { - "@napi-rs/canvas": "^1.0.10" + "@napi-rs/canvas": "^1.0.13" } }, "node_modules/perfect-debounce": { @@ -4916,12 +5293,6 @@ "pathe": "^2.0.3" } }, - "node_modules/pkg-types/node_modules/confbox": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.3.1.tgz", - "integrity": "sha512-cKUSoKa8YxFZZSmraVi7onONx3amu77ngK3kGpsYHDH7drPwCRkQE1RYMPlLRrMtnciRj274XNRxcHxnKmDSnA==", - "license": "MIT" - }, "node_modules/pngjs": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-7.0.0.tgz", @@ -4933,9 +5304,9 @@ } }, "node_modules/postcss": { - "version": "8.5.30", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.30.tgz", - "integrity": "sha512-zkd+e9S1AQHhmaBKye9zlFHWjOwVgqXl1q3ECYy8561K7qxR2cREf/STLskulBFd78k6AOFeA+ff1TtEzk9bAA==", + "version": "8.5.34", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.34.tgz", + "integrity": "sha512-P1Qzj0XXZjMda74C7qiVnBG90UKNbyNUAOeQRBW8X63RsIMV57gevRqjnkELdwtZ/S2/uQFksJhmwuN8xShLPw==", "funding": [ { "type": "opencollective", @@ -4954,20 +5325,19 @@ "dependencies": { "nanoid": "^3.3.20", "picocolors": "^1.1.1", - "source-map-js": "^1.2.2" + "source-map-js": "^1.2.4" }, "engines": { "node": "^10 || ^12 || >=14" } }, "node_modules/postcss-selector-parser": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.6.tgz", - "integrity": "sha512-7qASPzhKF2l2KLboRZux8CCTRMdGiV08vWmyKzPz22qZ7ZjQBOeY7rNzNoCLSUiftJ7HUq0GERHmxw/t0dCdMw==", + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.2.1.tgz", + "integrity": "sha512-GwxlMgTTXwIom+ebC7an3k6RaJDwklRQQnfiXsLPGicu8FYV/k/+1/9YY2OU2+r938H2t4X0TDxoif+HP2rjzQ==", "dev": true, "license": "MIT", "dependencies": { - "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" }, "engines": { @@ -5018,6 +5388,26 @@ "node": ">=6" } }, + "node_modules/qified": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/qified/-/qified-0.10.1.tgz", + "integrity": "sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^2.1.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/qified/node_modules/hookified": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-2.2.0.tgz", + "integrity": "sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA==", + "dev": true, + "license": "MIT" + }, "node_modules/quansync": { "version": "0.2.11", "resolved": "https://registry.npmjs.org/quansync/-/quansync-0.2.11.tgz", @@ -5065,9 +5455,13 @@ } }, "node_modules/reka-ui": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/reka-ui/-/reka-ui-2.11.0.tgz", - "integrity": "sha512-ilkpm4bIAol4jwzm4tpm3WVcffyGOpqksNZL1k1qO9QmIwAA+q8jroxjkUGLEn/GddfdExFfvofWfQiKZszUeQ==", + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/reka-ui/-/reka-ui-2.12.0.tgz", + "integrity": "sha512-MRH1Pn913Ddh/3z9AklI5AykWAkeCCkNcBBDRomCF6jW4liVlXUWwXLFYi8IgXWt7OAPO1wmOBMEvuO2Rgp9cw==", + "funding": [ + "https://opencollective.com/unovue", + "https://github.com/sponsors/zernonia" + ], "license": "MIT", "dependencies": { "@floating-ui/vue": "^2.0.1", @@ -5080,12 +5474,8 @@ "defu": "^6.1.5", "ohash": "^2.0.11" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/zernonia" - }, "peerDependencies": { - "vue": ">= 3.4.0" + "vue": ">= 3.5.22" } }, "node_modules/rxjs": { @@ -5099,9 +5489,9 @@ } }, "node_modules/sass": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.105.1.tgz", - "integrity": "sha512-1CnAWPyrrnVQzXGB/DUep1vYCKCm1CIBr+YxjjiW6wk9qtzemnGP4qicH56T2F9S4Hjtv/Ne3jDz8JqfdDU4oA==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.108.2.tgz", + "integrity": "sha512-kugK8djotnG9HQRPTOf36asKYlxg8rWWsNLYHOgWDIVOiZQqlRfKBgF4XXM6kfw146kIDMvm57B4GIkvDSyTzA==", "license": "MIT", "optional": true, "dependencies": { @@ -5120,9 +5510,9 @@ } }, "node_modules/sass-embedded": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded/-/sass-embedded-1.105.1.tgz", - "integrity": "sha512-9tKxXG4rq+oGTZUlQehWZwHxBTL80EiB8IWk9AEqz8uOqg910t88JIYbN92eMCxokQ5vrYSQxg15bh0o/3hh3w==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded/-/sass-embedded-1.108.2.tgz", + "integrity": "sha512-+T+jag2BFS2RKipKF80uCAuNztA8VC7T9PU716xMe9Ob1Su4uDZf9vj0JBeSxcQo1vy6EMdiwZFXTRmvuAhl0g==", "devOptional": true, "license": "MIT", "dependencies": { @@ -5141,30 +5531,30 @@ "node": ">=20.19.0" }, "optionalDependencies": { - "sass-embedded-all-unknown": "1.105.1", - "sass-embedded-android-arm": "1.105.1", - "sass-embedded-android-arm64": "1.105.1", - "sass-embedded-android-riscv64": "1.105.1", - "sass-embedded-android-x64": "1.105.1", - "sass-embedded-darwin-arm64": "1.105.1", - "sass-embedded-darwin-x64": "1.105.1", - "sass-embedded-linux-arm": "1.105.1", - "sass-embedded-linux-arm64": "1.105.1", - "sass-embedded-linux-musl-arm": "1.105.1", - "sass-embedded-linux-musl-arm64": "1.105.1", - "sass-embedded-linux-musl-riscv64": "1.105.1", - "sass-embedded-linux-musl-x64": "1.105.1", - "sass-embedded-linux-riscv64": "1.105.1", - "sass-embedded-linux-x64": "1.105.1", - "sass-embedded-unknown-all": "1.105.1", - "sass-embedded-win32-arm64": "1.105.1", - "sass-embedded-win32-x64": "1.105.1" + "sass-embedded-all-unknown": "1.108.2", + "sass-embedded-android-arm": "1.108.2", + "sass-embedded-android-arm64": "1.108.2", + "sass-embedded-android-riscv64": "1.108.2", + "sass-embedded-android-x64": "1.108.2", + "sass-embedded-darwin-arm64": "1.108.2", + "sass-embedded-darwin-x64": "1.108.2", + "sass-embedded-linux-arm": "1.108.2", + "sass-embedded-linux-arm64": "1.108.2", + "sass-embedded-linux-musl-arm": "1.108.2", + "sass-embedded-linux-musl-arm64": "1.108.2", + "sass-embedded-linux-musl-riscv64": "1.108.2", + "sass-embedded-linux-musl-x64": "1.108.2", + "sass-embedded-linux-riscv64": "1.108.2", + "sass-embedded-linux-x64": "1.108.2", + "sass-embedded-unknown-all": "1.108.2", + "sass-embedded-win32-arm64": "1.108.2", + "sass-embedded-win32-x64": "1.108.2" } }, "node_modules/sass-embedded-all-unknown": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-all-unknown/-/sass-embedded-all-unknown-1.105.1.tgz", - "integrity": "sha512-kN0G03K9KoUbSf72t7ZvxAudcB4Wbf0M0XFaPc1gaF94jEPUb0xLCQUIPIDPH2Kx8vpYZ/GzzgF7USsB6rUYfw==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-all-unknown/-/sass-embedded-all-unknown-1.108.2.tgz", + "integrity": "sha512-VlIJTjCc82VhLKV7EAPJ4fdJn/EM0q0djOzYBjmsuK1i95b1oVKS6NPa4qQMjeKq3LPTsNyH6eYHZTHKCMhIzw==", "cpu": [ "!arm", "!arm64", @@ -5174,13 +5564,13 @@ "license": "MIT", "optional": true, "dependencies": { - "sass": "1.105.1" + "sass": "1.108.2" } }, "node_modules/sass-embedded-android-arm": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-android-arm/-/sass-embedded-android-arm-1.105.1.tgz", - "integrity": "sha512-WYltUXkUP9jDaUq4uUiLgZXyYO5c72sa/TvpO4E2MMRdS+WJWgrPUDyvO+DpMR9gKWIm0QQ5cCEYnPDgovjVJw==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-android-arm/-/sass-embedded-android-arm-1.108.2.tgz", + "integrity": "sha512-18L7VPiIqT/nUOy9bo+dhURVGrRE1c3qClueOEQu4AlkuCs8atnSErkA4icMo4pklzY2XQ3NCRhKfaCe66Lbuw==", "cpu": [ "arm" ], @@ -5194,9 +5584,9 @@ } }, "node_modules/sass-embedded-android-arm64": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-android-arm64/-/sass-embedded-android-arm64-1.105.1.tgz", - "integrity": "sha512-lWnIFmW3gL4ZDfZgjeUfxazmA0zlwSS/ADe2q9XmP0W2UfM9kuvrXdWvp6KjZOCv0CrTYVQMrIUj8Of1L2M24Q==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-android-arm64/-/sass-embedded-android-arm64-1.108.2.tgz", + "integrity": "sha512-9OWtObry0k/4u+ervuEcgcMM1YVZCqZbcPxGkXuuDjykbWyyvcaVZ1F+8Fup7wod6BVGqbiQfgdfsXd4zsbcPg==", "cpu": [ "arm64" ], @@ -5210,9 +5600,9 @@ } }, "node_modules/sass-embedded-android-riscv64": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-android-riscv64/-/sass-embedded-android-riscv64-1.105.1.tgz", - "integrity": "sha512-lWity0qhyQyPgkHUfZz+4IeD0r6mcAqG9KzOwVSjUrcSR9xAfWFKYAtHTA05R28ymyXf2Sf2+XfNV7YkxLgkUQ==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-android-riscv64/-/sass-embedded-android-riscv64-1.108.2.tgz", + "integrity": "sha512-K5Hgenk+cfq+eZ5rqfpf6DyqkpZjawmAEpPBBcZFNFpsEdfu2F1L2ld0cFYGmifz7V54Kh9Q9MIhG/5ma3EAAg==", "cpu": [ "riscv64" ], @@ -5226,9 +5616,9 @@ } }, "node_modules/sass-embedded-android-x64": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-android-x64/-/sass-embedded-android-x64-1.105.1.tgz", - "integrity": "sha512-FRGZuIZ9eS3qutYPFqz8u12Ti9ccyWKWb7F7rKRI1BkIEmLZV1rC862dUGnTV2d9Tk9qbSAXL71t8alUR+fzIA==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-android-x64/-/sass-embedded-android-x64-1.108.2.tgz", + "integrity": "sha512-HalOpck3jfo6+PNjDGeohrfswMStSPdvcsHFdWkF8wib5aTwrpirFTY3ZdtGBXLlg5fccN6c3kQGUwMlOZRobw==", "cpu": [ "x64" ], @@ -5242,9 +5632,9 @@ } }, "node_modules/sass-embedded-darwin-arm64": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-darwin-arm64/-/sass-embedded-darwin-arm64-1.105.1.tgz", - "integrity": "sha512-75qVpHj0qwJKWOo+ZA5NPVFnOGfRrUiBdnLR0dPqsvzp3acvb5gBevptqTtJjVWubpYRIjcRdDDjmeWoXnfacQ==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-darwin-arm64/-/sass-embedded-darwin-arm64-1.108.2.tgz", + "integrity": "sha512-wca4RdevELodsjjk+4K1lqhzVfnBf0nCvvtw7YEpbXxGgkMJhHDbh/mf8Gyy3zCKISls9MKm7dPU23G8GGnmeQ==", "cpu": [ "arm64" ], @@ -5258,9 +5648,9 @@ } }, "node_modules/sass-embedded-darwin-x64": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-darwin-x64/-/sass-embedded-darwin-x64-1.105.1.tgz", - "integrity": "sha512-5TV8xyZrOO89ky752favkTuyz9O2hOB2aMoiUpMTk0rFr+UVANcXdIrEvJ9WKoqTHaszim7un3jADumunpW7zQ==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-darwin-x64/-/sass-embedded-darwin-x64-1.108.2.tgz", + "integrity": "sha512-MJnsh5mVPA2Hy7XKaryfAwUCoDy4MuCkcDbe0Jj4j7F7iaVAhX2dPAyvBvMGBIhhMEeFfYlkxYX/Lhbl+7x8SQ==", "cpu": [ "x64" ], @@ -5274,9 +5664,9 @@ } }, "node_modules/sass-embedded-linux-arm": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-arm/-/sass-embedded-linux-arm-1.105.1.tgz", - "integrity": "sha512-Ng9GWIF6heTrwc9r/FFY9oUSoaylV2zcS296Qo2re3tJfLMWR37O2JUMyzPT+vtkRs8k3JOE6jTFVlXYnz4EAA==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-arm/-/sass-embedded-linux-arm-1.108.2.tgz", + "integrity": "sha512-OdsYCHqp5oh3vLqJCov4xXKeEUWS0+8ff+HIofWgTQYEC9Z3+3SYMRiNiGO37Qxt+QNsKXSvo+hsIqVMrfHHfw==", "cpu": [ "arm" ], @@ -5291,9 +5681,9 @@ } }, "node_modules/sass-embedded-linux-arm64": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-arm64/-/sass-embedded-linux-arm64-1.105.1.tgz", - "integrity": "sha512-arALlVQkXjxN1RPaQR41vbDYXrTIdXwPtEzBWRkOg7FdIN/dSohY8ik96M6M3MSc+niV/UIC7BO47PcspzJGpw==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-arm64/-/sass-embedded-linux-arm64-1.108.2.tgz", + "integrity": "sha512-DQGGHEe+P1cv3ydBC0Gyh8I42X7xRIOBF+/1o5DyEuexMLHEEF7ZI9rmu8xJfBJv6lW0r8Gsrjke09c63dAOaQ==", "cpu": [ "arm64" ], @@ -5308,9 +5698,9 @@ } }, "node_modules/sass-embedded-linux-musl-arm": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-arm/-/sass-embedded-linux-musl-arm-1.105.1.tgz", - "integrity": "sha512-7u932XawHxGZvuYV4pOqcCvQi05yMONDmNDxVNh8Q7KmpytQP7mnyxBOYWStiw/p665AVL6BYGe7WY/vzCcWGw==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-arm/-/sass-embedded-linux-musl-arm-1.108.2.tgz", + "integrity": "sha512-TEjaziqiHj08QHZztOD26HQAkdC5mQLvFj+GMv8sUCxgEPAusDR/bx6KieWfNqAhajXte9aczwdjYVsURMp7KA==", "cpu": [ "arm" ], @@ -5325,9 +5715,9 @@ } }, "node_modules/sass-embedded-linux-musl-arm64": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-arm64/-/sass-embedded-linux-musl-arm64-1.105.1.tgz", - "integrity": "sha512-KizYVR3d70U67iLgKdF+HCKBdQYUxYiv0YWCS3zl6GwNGIbGXlkOtnjxus41CKTA4oOK0KsSus9P5zwhOBjiYA==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-arm64/-/sass-embedded-linux-musl-arm64-1.108.2.tgz", + "integrity": "sha512-pYa1W4FYqMPsTMNi4/T76AEcqXpgUntzHpaJUsK+TaxQ+Y9+oaOxPL5mVz+Rg+RBj1UOHJRJ4GO86hVrF8dUqg==", "cpu": [ "arm64" ], @@ -5342,9 +5732,9 @@ } }, "node_modules/sass-embedded-linux-musl-riscv64": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-riscv64/-/sass-embedded-linux-musl-riscv64-1.105.1.tgz", - "integrity": "sha512-gs84BgRBVNMX5fHRU3wxc3HuJjl0dUmZFpcVIaDDEVhnp5oXFLQp+gEu0xBBAurTzCHVpPU6GlGK6B1gRKmbhg==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-riscv64/-/sass-embedded-linux-musl-riscv64-1.108.2.tgz", + "integrity": "sha512-g+6V6IIYK3dRF7fYQBppNRCtnZl22JncUhmYLL8eTqTIiBpjhIFXavguVX6Z0JW0ZMvlqL3K2TmDMh3sVXpeDA==", "cpu": [ "riscv64" ], @@ -5359,9 +5749,9 @@ } }, "node_modules/sass-embedded-linux-musl-x64": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-x64/-/sass-embedded-linux-musl-x64-1.105.1.tgz", - "integrity": "sha512-jFSRc1BSoCo0bw6GXmBWQMzdj0FBl2FTKSRqQSye3vmlI9O466DwBK4OQL9HRp6MGdY9IQFFMZLPZo5LJWIPsQ==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-x64/-/sass-embedded-linux-musl-x64-1.108.2.tgz", + "integrity": "sha512-X2XN+HepJ3+GGDrvBc13Qn0DqQh8rs7C6N6qA/IrUvNcWvhCTdB2G3pBYsSds61LiQM26S+pAwFirX4SbwIMRw==", "cpu": [ "x64" ], @@ -5376,9 +5766,9 @@ } }, "node_modules/sass-embedded-linux-riscv64": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-riscv64/-/sass-embedded-linux-riscv64-1.105.1.tgz", - "integrity": "sha512-tkZs6OvA+omJgSf8EaPQavq6M7bJNLm88eKt3yzYnBy0dVGMao4+lyRb/EnsgIq2R/B2lhxUHhSVNWAcY5bgXw==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-riscv64/-/sass-embedded-linux-riscv64-1.108.2.tgz", + "integrity": "sha512-GL5t80FVizbU1QgJI3eh8125ZtR8i//csqDqncrIwzDBioJwxIYNNhLdKHpp5DjCdD9qst04p4KG1aVM+XPw/Q==", "cpu": [ "riscv64" ], @@ -5393,9 +5783,9 @@ } }, "node_modules/sass-embedded-linux-x64": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-x64/-/sass-embedded-linux-x64-1.105.1.tgz", - "integrity": "sha512-YF4OyymSlm26OcdPovIZL1blzjTxf5yN/rzgTmoGqAjEk57+yIuYo+7jBCgSQZFov8Rn4uHhZT+u0cpzxNFMRg==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-x64/-/sass-embedded-linux-x64-1.108.2.tgz", + "integrity": "sha512-9SNMGIYzfdMAflPlNLQro9gIWbrbrSibwffatFaEmjMPBHqy2gNwg7VuzDRHBygbSqsrsqfhokYGchCyzCZI9Q==", "cpu": [ "x64" ], @@ -5410,9 +5800,9 @@ } }, "node_modules/sass-embedded-unknown-all": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-unknown-all/-/sass-embedded-unknown-all-1.105.1.tgz", - "integrity": "sha512-bd2zDf+MdoPdRDH1awSQ+IL67vHvCbiKsWJ95XchPg3I67zQlXjTSf9KqRiE6twjNT1fRV82JUKoc0Hf6CUmfQ==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-unknown-all/-/sass-embedded-unknown-all-1.108.2.tgz", + "integrity": "sha512-FYjLjAyr5BxEI2oAB+nT4OkrQZmEcQz8sVRQbxFUtw30MbEZN8WjEEbjqxQjSw4IaYhA8PuUAjvZoTyvcoRYdA==", "license": "MIT", "optional": true, "os": [ @@ -5422,13 +5812,13 @@ "!win32" ], "dependencies": { - "sass": "1.105.1" + "sass": "1.108.2" } }, "node_modules/sass-embedded-win32-arm64": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-win32-arm64/-/sass-embedded-win32-arm64-1.105.1.tgz", - "integrity": "sha512-Zpp/RWYL8ZzpLzBrs+/UVMEHOHx7sw4nlq2R52dKQ0qv/0V8oKemAy41PZyLir3c+S2C+YViYyfnFfQLRTAzuA==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-win32-arm64/-/sass-embedded-win32-arm64-1.108.2.tgz", + "integrity": "sha512-7TGjLKlKjAwWIZhM+VrXzc1jj/Z/88bLqf3/jJSkzM2vbsj6kDp7F0DmIs9wJ0KBLAMnu5ZOCFDG61oJfJuT8Q==", "cpu": [ "arm64" ], @@ -5442,9 +5832,9 @@ } }, "node_modules/sass-embedded-win32-x64": { - "version": "1.105.1", - "resolved": "https://registry.npmjs.org/sass-embedded-win32-x64/-/sass-embedded-win32-x64-1.105.1.tgz", - "integrity": "sha512-DM8EkMDzEsxnYoy11nyA5I4jr8lOV1TVQ/drNYvFQA9undiMzZD+7SkRA0OnCrgD1uCT+uRArCHSpNiiYVks+g==", + "version": "1.108.2", + "resolved": "https://registry.npmjs.org/sass-embedded-win32-x64/-/sass-embedded-win32-x64-1.108.2.tgz", + "integrity": "sha512-zgy9m/e47V0Ib2fDmpAqDO6seFqeVa+cgYitdsMEp704x8e+diybz2fg7rsdGXqa/XlGR2dzT7vtcFSbZkF44w==", "cpu": [ "x64" ], @@ -5515,12 +5905,12 @@ } }, "node_modules/source-map-js": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", - "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.4.tgz", + "integrity": "sha512-J7ZjMvHd9O1fcT/5V09QWaaSl2BbWx3F6O08spde82Namf9UB0GxRVIPiNbVsdKkoizHiSpTodo3vp2bAy91MA==", "license": "BSD-3-Clause", "engines": { - "node": ">=0.10.0" + "node": ">=6.0.0" } }, "node_modules/std-env": { @@ -5547,9 +5937,9 @@ } }, "node_modules/sync-child-process": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/sync-child-process/-/sync-child-process-1.1.0.tgz", - "integrity": "sha512-1LMf/x0kU0CKFSesh5DfYktvj1KhiqYi5LAh5HU2G4SkKk1TGDhsMFBOL47g/E+mNfYpgs365pVNlIYOIHPvlQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/sync-child-process/-/sync-child-process-1.1.1.tgz", + "integrity": "sha512-54zMOnH5qgjdKW8SGpCx3daSP+v+TtTfOxgPdhUE3P0hytMMpknZfP67S4JeRcx5IQRWJERz6890yO4dkTywww==", "devOptional": true, "license": "MIT", "dependencies": { @@ -5570,16 +5960,16 @@ } }, "node_modules/tailwindcss": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.3.tgz", - "integrity": "sha512-gOhV3P7ufE62QDGg1zVaTgCR+EtPv92k2nIhVcVKcLmxT1sUBsQGhnZj175j+MqRt4zLF7ic+sCYjfhxMxj7YQ==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.5.tgz", + "integrity": "sha512-FcQk9BuffmEHJP2G0XmB2SplU1aLTI7j07Kunk+U74Ny+XiWOtzXz9aujFZ/avntw1e2cOv/3PkgzflQ7gX2vQ==", "dev": true, "license": "MIT" }, "node_modules/tapable": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.3.tgz", - "integrity": "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==", + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.4.tgz", + "integrity": "sha512-NHFiWnAbMJxNNpBwiO7jJVGDuqMxT9/oV8v57RR+fgBQShkJil5inGD8/xWy0hjLyHQyX1tu27QANhlz3KBqCg==", "dev": true, "license": "MIT", "engines": { @@ -5598,18 +5988,18 @@ "license": "MIT" }, "node_modules/thinking-orbs": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/thinking-orbs/-/thinking-orbs-0.3.1.tgz", - "integrity": "sha512-3BG1aeB1RUTxItCml/BBuIz5JRM4kZqGuyx+vouv0fXTtcR9ZNoKjWGneHPx94y74GxgArwJZ1qbJR5dt54kSw==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/thinking-orbs/-/thinking-orbs-0.3.2.tgz", + "integrity": "sha512-QZFeBaPEzqhjiZoXy961EvDgaXk2WgXacF3Rbz+Sj5IfzDzBvTC86vdREUHniBffYibJFKSwbfllxLUdI/Xv6g==", "license": "MIT", "peerDependencies": { "react": ">=18.0.0" } }, "node_modules/tinybench": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.2.tgz", - "integrity": "sha512-nIZ2N2dFpjBsg2hgitKu7mA+FvsIJuGJOwysRngmVRRmWgR/UyPjwJj8c/fT/dhm8EkHnF5EOogRf+0Z2qrimA==", + "version": "6.2.5", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.5.tgz", + "integrity": "sha512-b/8GRMdnY4cqkfCLyaFpTGIv1qwfi3oT0mWaepwT++6Z/ZrYehNfZZ2JDKVLKGhNoEkS3IIB1ELtCT0XS5DtOA==", "dev": true, "license": "MIT", "engines": { @@ -5617,9 +6007,9 @@ } }, "node_modules/tinyexec": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz", - "integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.4.0.tgz", + "integrity": "sha512-PV6lIcJQh57aFeJDwx16JNHmgFRh5xguzallrDW1qe8nAghYgr5MKz2K5k7wEyV/ygZhdnIAP8+HZSarHPBCsg==", "dev": true, "license": "MIT", "engines": { @@ -5691,6 +6081,30 @@ "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==", "license": "0BSD" }, + "node_modules/tsrs": { + "version": "7.1.0-beta.tsrs4", + "resolved": "https://registry.npmjs.org/tsrs/-/tsrs-7.1.0-beta.tsrs4.tgz", + "integrity": "sha512-tPeUolNTUDJFk1Fc660PyFGUK/epGbuQVoo+2GnCIWkNDWp8i1DMI5n2X8pxxevi/3zbO8UvIKjWgE4T7OOCeA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsrs": "bin/tsrs", + "tsrs-lint": "bin/tsrs-lint" + }, + "engines": { + "node": ">=16.20.0" + }, + "optionalDependencies": { + "@tsrs/darwin-arm64": "7.1.0-beta.tsrs4", + "@tsrs/darwin-x64": "7.1.0-beta.tsrs4", + "@tsrs/linux-arm64-gnu": "7.1.0-beta.tsrs4", + "@tsrs/linux-arm64-musl": "7.1.0-beta.tsrs4", + "@tsrs/linux-x64-gnu": "7.1.0-beta.tsrs4", + "@tsrs/linux-x64-musl": "7.1.0-beta.tsrs4", + "@tsrs/win32-arm64": "7.1.0-beta.tsrs4", + "@tsrs/win32-x64": "7.1.0-beta.tsrs4" + } + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -5731,19 +6145,20 @@ "license": "MIT" }, "node_modules/undici-types": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", - "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "version": "7.24.6", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz", + "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==", "devOptional": true, "license": "MIT" }, "node_modules/unplugin": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-3.4.0.tgz", - "integrity": "sha512-9skdIFlCsPdFV7wUfZxNsFInlW+7nJmGu2gkTu0OUhF56aXGsHab9x52/QhdJ4lC7ZDPWTxbiC4ANqVlsuaW3w==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-3.7.0.tgz", + "integrity": "sha512-GrM2uq3DQo3hvLU2FjeYhooJ8BY9N6j1Fbzgx7Pta3VVJevsD3VP4dPjZkZOS0mLvN8w9zzr9OlP+31bSMyuLw==", "license": "MIT", "dependencies": { "@jridgewell/remapping": "^2.3.5", + "@rolldown/pluginutils": "^1.0.1", "picomatch": "^4.0.7", "webpack-virtual-modules": "^0.6.2" }, @@ -5837,37 +6252,37 @@ }, "node_modules/vite": { "name": "@voidzero-dev/vite-plus-core", - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-core/-/vite-plus-core-1.3.0.tgz", - "integrity": "sha512-Bk/LBwNrxoB8XbGUtGJE3r+U9P4puvdZ6UH36ekygE1J+on/ytwM/yBgQwBnvmX6/MVax+2xxj8wk0N/KkyNeA==", + "version": "8.3.8001", + "resolved": "https://registry.npmjs.org/@voidzero-dev/vite-plus-core/-/vite-plus-core-8.3.8001.tgz", + "integrity": "sha512-7ODeiZLaa9LhVysGNAkf7qLQU//g7d6QpNY9Ljriy6B2wv7g6iUT8DYh3F6w6DmF0DyPA+MFiYgfVXV++W3OAw==", "devOptional": true, "license": "MIT", "dependencies": { - "@oxc-project/runtime": "=0.154.0", - "@oxc-project/types": "=0.154.0", + "@oxc-project/runtime": "=0.159.0", + "@oxc-project/types": "=0.159.0", "lightningcss": "^1.33.0", - "postcss": "^8.5.29", + "postcss": "^8.5.32", "yuku-parser": "0.19.0" }, "engines": { "node": "^20.19.0 || ^22.18.0 || >=24.11.0" }, "optionalDependencies": { - "@voidzero-dev/vite-plus-darwin-arm64": "1.3.0", - "@voidzero-dev/vite-plus-darwin-x64": "1.3.0", - "@voidzero-dev/vite-plus-linux-arm64-gnu": "1.3.0", - "@voidzero-dev/vite-plus-linux-arm64-musl": "1.3.0", - "@voidzero-dev/vite-plus-linux-x64-gnu": "1.3.0", - "@voidzero-dev/vite-plus-linux-x64-musl": "1.3.0", - "@voidzero-dev/vite-plus-win32-arm64-msvc": "1.3.0", - "@voidzero-dev/vite-plus-win32-x64-msvc": "1.3.0", + "@voidzero-dev/vite-plus-darwin-arm64": "1.8.0", + "@voidzero-dev/vite-plus-darwin-x64": "1.8.0", + "@voidzero-dev/vite-plus-linux-arm64-gnu": "1.8.0", + "@voidzero-dev/vite-plus-linux-arm64-musl": "1.8.0", + "@voidzero-dev/vite-plus-linux-x64-gnu": "1.8.0", + "@voidzero-dev/vite-plus-linux-x64-musl": "1.8.0", + "@voidzero-dev/vite-plus-win32-arm64-msvc": "1.8.0", + "@voidzero-dev/vite-plus-win32-x64-msvc": "1.8.0", "fsevents": "~2.3.3" }, "peerDependencies": { "@arethetypeswrong/core": "^0.18.1", "@types/node": "^20.19.0 || >=22.12.0", "@typescript/native-preview": "*", - "@vitejs/devtools": "^0.7.1", + "@vitejs/devtools": "^0.7.1 || ^0.8.0", "@volar/typescript": "~2.4.0", "@vue/language-core": "~3.2.0 || ~3.3.0", "esbuild": "^0.27.0 || ^0.28.0", @@ -5953,9 +6368,9 @@ } }, "node_modules/vite-plugin-compression2": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/vite-plugin-compression2/-/vite-plugin-compression2-2.5.3.tgz", - "integrity": "sha512-ItPgqQWkcnBbVw7is9OKwiZ8v6+ju9rYROl5Lp6QfQDEx/d55AwJQb/KLpsQqsU9HoigYBsZ8tK6I02UwJNvEw==", + "version": "2.5.4", + "resolved": "https://registry.npmjs.org/vite-plugin-compression2/-/vite-plugin-compression2-2.5.4.tgz", + "integrity": "sha512-zZ8gKdboMu+yoD1GD3MIgdEdN0ds8+leZ253/641yxMRa8bwa8Tl71DFcJR2IKLGLve1B+GRdLfIYyecv06QQQ==", "dev": true, "license": "MIT", "dependencies": { @@ -5964,46 +6379,48 @@ } }, "node_modules/vite-plus": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/vite-plus/-/vite-plus-1.3.0.tgz", - "integrity": "sha512-wZGsDeYfPcrCegqgY68pJJHGTpEZdsZvIMH2/mWXkGkBD72UY3M7z24Sv3ZeOL/FrqbbtyqBOfkKO6BvoQ8wMw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@oxc-project/types": "=0.154.0", - "@oxlint/plugins": "=1.88.0", - "@vitest/browser": "5.0.5", - "@vitest/browser-preview": "5.0.5", - "@vitest/mocker": "5.0.5", - "@vitest/pretty-format": "5.0.5", - "@vitest/snapshot": "5.0.5", - "@vitest/spy": "5.0.5", - "@vitest/utils": "5.0.5", - "oxfmt": "=0.73.0", - "oxlint": "=1.88.0", - "oxlint-tsgolint": "=7.0.2004", - "vite": "npm:@voidzero-dev/vite-plus-core@1.3.0", - "vitest": "5.0.5" + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/vite-plus/-/vite-plus-1.8.0.tgz", + "integrity": "sha512-jrnrMuVNnWDLMNZ3j8z6Ck4bS9+ml3vx7rj6SdSEJryw03IVEChdGMBtIUebK69UTtE4WkMvFHUR021aZ0Azdw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/runtime": "=0.159.0", + "@oxc-project/types": "=0.159.0", + "@oxlint/plugins": "=1.94.0", + "@vitest/browser": "5.1.1", + "@vitest/browser-preview": "5.1.1", + "@vitest/mocker": "5.1.1", + "@vitest/pretty-format": "5.1.1", + "@vitest/snapshot": "5.1.1", + "@vitest/spy": "5.1.1", + "@vitest/utils": "5.1.1", + "oxfmt": "=0.79.0", + "oxlint": "=1.94.0", + "tsrs": "=7.1.0-beta.tsrs4", + "vite": "npm:@voidzero-dev/vite-plus-core@8.3.8001", + "vitest": "5.1.1" }, "bin": { "vp": "bin/vp", - "vpr": "bin/vpr" + "vpr": "bin/vpr", + "vpx": "bin/vpx" }, "engines": { "node": "^22.18.0 || ^24.11.0 || >=26.0.0" }, "optionalDependencies": { - "@voidzero-dev/vite-plus-darwin-arm64": "1.3.0", - "@voidzero-dev/vite-plus-darwin-x64": "1.3.0", - "@voidzero-dev/vite-plus-linux-arm64-gnu": "1.3.0", - "@voidzero-dev/vite-plus-linux-arm64-musl": "1.3.0", - "@voidzero-dev/vite-plus-linux-x64-gnu": "1.3.0", - "@voidzero-dev/vite-plus-linux-x64-musl": "1.3.0", - "@voidzero-dev/vite-plus-win32-arm64-msvc": "1.3.0", - "@voidzero-dev/vite-plus-win32-x64-msvc": "1.3.0" + "@voidzero-dev/vite-plus-darwin-arm64": "1.8.0", + "@voidzero-dev/vite-plus-darwin-x64": "1.8.0", + "@voidzero-dev/vite-plus-linux-arm64-gnu": "1.8.0", + "@voidzero-dev/vite-plus-linux-arm64-musl": "1.8.0", + "@voidzero-dev/vite-plus-linux-x64-gnu": "1.8.0", + "@voidzero-dev/vite-plus-linux-x64-musl": "1.8.0", + "@voidzero-dev/vite-plus-win32-arm64-msvc": "1.8.0", + "@voidzero-dev/vite-plus-win32-x64-msvc": "1.8.0" }, "peerDependencies": { - "@vitest/browser-playwright": "5.0.5", + "@vitest/browser-playwright": "5.1.1", "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", "playwright": "*" }, @@ -6019,293 +6436,419 @@ } } }, - "node_modules/vite-plus/node_modules/@oxc-project/types": { - "version": "0.154.0", - "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.154.0.tgz", - "integrity": "sha512-KYOUGQFlLWR+s4QMV2Q9ko38TZm7EdO87Qm7rvZLqk/webse/cDjtyxKhg/47l0byCbs/k46LT8qc4PKjAikzA==", + "node_modules/vite-plus/node_modules/@oxlint/binding-android-arm-eabi": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm-eabi/-/binding-android-arm-eabi-1.94.0.tgz", + "integrity": "sha512-730FKSBsKg/NawYnpI3gXRroXptOVqY32iYBPLUZaSx0vgYzOeiNtwojZL4gJdzo9wDvHUlstShmGRHrWcbRYg==", + "cpu": [ + "arm" + ], "dev": true, "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/oxc-project" - } - }, - "node_modules/vite/node_modules/@oxc-project/types": { - "version": "0.154.0", - "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.154.0.tgz", - "integrity": "sha512-KYOUGQFlLWR+s4QMV2Q9ko38TZm7EdO87Qm7rvZLqk/webse/cDjtyxKhg/47l0byCbs/k46LT8qc4PKjAikzA==", - "devOptional": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/oxc-project" - } - }, - "node_modules/vite/node_modules/lightningcss": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", - "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", - "devOptional": true, - "license": "MPL-2.0", - "dependencies": { - "detect-libc": "^2.0.3" - }, + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "optionalDependencies": { - "lightningcss-android-arm64": "1.33.0", - "lightningcss-darwin-arm64": "1.33.0", - "lightningcss-darwin-x64": "1.33.0", - "lightningcss-freebsd-x64": "1.33.0", - "lightningcss-linux-arm-gnueabihf": "1.33.0", - "lightningcss-linux-arm64-gnu": "1.33.0", - "lightningcss-linux-arm64-musl": "1.33.0", - "lightningcss-linux-x64-gnu": "1.33.0", - "lightningcss-linux-x64-musl": "1.33.0", - "lightningcss-win32-arm64-msvc": "1.33.0", - "lightningcss-win32-x64-msvc": "1.33.0" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/vite/node_modules/lightningcss-android-arm64": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", - "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "node_modules/vite-plus/node_modules/@oxlint/binding-android-arm64": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm64/-/binding-android-arm64-1.94.0.tgz", + "integrity": "sha512-8v8TICIiZpXLot1HSq5+vsG9NEKQ5czQBYlUqJR75OVfFDr3cGOmRU/CtHDWnS4tm8nW+Z4Y357qGToSfYqFvA==", "cpu": [ "arm64" ], - "license": "MPL-2.0", + "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ], "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/vite/node_modules/lightningcss-darwin-arm64": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", - "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "node_modules/vite-plus/node_modules/@oxlint/binding-darwin-arm64": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-arm64/-/binding-darwin-arm64-1.94.0.tgz", + "integrity": "sha512-NePcRMO/ltt1Pnytohl6pl0bd/QyRX8HbpptuDz9LK7FTsFD4lKxDMBt7di9k6IFLO0J05jO2nm7wGqIh6dRHA==", "cpu": [ "arm64" ], - "license": "MPL-2.0", + "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ], "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/vite/node_modules/lightningcss-darwin-x64": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", - "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "node_modules/vite-plus/node_modules/@oxlint/binding-darwin-x64": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-x64/-/binding-darwin-x64-1.94.0.tgz", + "integrity": "sha512-QV+m+OaEgLmYyillvP1wKXhMm6tDZEWx3vG7Wjmx9ybg15+6YMfqzvp6e+uPukC6zNywuule0vMn0fZgihZzZA==", "cpu": [ "x64" ], - "license": "MPL-2.0", + "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ], "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/vite/node_modules/lightningcss-freebsd-x64": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", - "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "node_modules/vite-plus/node_modules/@oxlint/binding-freebsd-x64": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-freebsd-x64/-/binding-freebsd-x64-1.94.0.tgz", + "integrity": "sha512-KVZjca581nrV6P71kZ9M1otBib9LH0IMn9rr4mrnbRp18V0HiZhBHbU26gji/Ieq2G34qMacnMc3zrmKmvWqWA==", "cpu": [ "x64" ], - "license": "MPL-2.0", + "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" ], "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/vite/node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", - "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "node_modules/vite-plus/node_modules/@oxlint/binding-linux-arm-gnueabihf": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.94.0.tgz", + "integrity": "sha512-AMQtgQJk8DgdIV+qaQ5sFoHAko4iKa8zo+gYqELy2grtU8hXWB08DAGB3u90aQL1YSxbd3zqHjgcODBHDFyzBQ==", "cpu": [ "arm" ], - "license": "MPL-2.0", + "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/vite/node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", - "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "node_modules/vite-plus/node_modules/@oxlint/binding-linux-arm-musleabihf": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-1.94.0.tgz", + "integrity": "sha512-ZLzoGVGAmQkp9leeB5rNxAXLcvlmkmd/GY71LKd5uikk+28NEApY3S2FB3pq6MkfOCFFnFg6QgD9lJIjd07D0Q==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/vite-plus/node_modules/@oxlint/binding-linux-arm64-gnu": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.94.0.tgz", + "integrity": "sha512-N1dW6o7cY90hLVkDsvz8nWIFOwbO+n272pvW7uLYB7u47HagJVnLChfK6QA9dWFdiPudud9zfksVUOciHc5PNA==", "cpu": [ "arm64" ], - "license": "MPL-2.0", + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/vite/node_modules/lightningcss-linux-arm64-musl": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", - "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "node_modules/vite-plus/node_modules/@oxlint/binding-linux-arm64-musl": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.94.0.tgz", + "integrity": "sha512-7tCF4OV/bGDQ2xxgb+sDI97SpmmDrUII4JxTG553voJVA9cnkbXSGSXzo78Ax73BuhEOPoQc2Qi6VrfT0cDG2A==", "cpu": [ "arm64" ], - "license": "MPL-2.0", + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/vite/node_modules/lightningcss-linux-x64-gnu": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", - "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "node_modules/vite-plus/node_modules/@oxlint/binding-linux-ppc64-gnu": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.94.0.tgz", + "integrity": "sha512-B5vUHE4wNisVEuaYxwFUn6tY+vw7A+9APxxqGKI+UmP3yKLpkhnt0qsaCrzjpX55F8rCRHBaTvIDdYo32NE36g==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/vite-plus/node_modules/@oxlint/binding-linux-riscv64-gnu": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-1.94.0.tgz", + "integrity": "sha512-/U0b15+c4hTodo8YhEqDlQ6OjnGKvc8igjM/mh23ukqqCUBKiBCaxqUV8bcaofK9uZ+f8wCygkyXLS6LN25YSA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/vite-plus/node_modules/@oxlint/binding-linux-riscv64-musl": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-1.94.0.tgz", + "integrity": "sha512-ba94Vwl0qOnwXIXNDR33AEbLXuX++ckM74t+9Te7CiPSPAHivhOYyeEkUAicrvOEei1pxXkWggLbFeBFFBTuHA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/vite-plus/node_modules/@oxlint/binding-linux-s390x-gnu": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.94.0.tgz", + "integrity": "sha512-GVwwwms3O8pdgbCiPavwq2vltyB4661GkDz6kJduZ0E5nsSJUDJ0svaP+ePYpuDVYi4+K1qhCKnWa/Ec8I4LUA==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/vite-plus/node_modules/@oxlint/binding-linux-x64-gnu": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.94.0.tgz", + "integrity": "sha512-iUfCFJN8ZIresSnpTfiIkhF3s8X+XA4I9KJ249QwR2QYTMwh0+pla1pj1xaFi+HtR9McjM4Jaemf70HzX7ilOQ==", "cpu": [ "x64" ], - "license": "MPL-2.0", + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/vite/node_modules/lightningcss-linux-x64-musl": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", - "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "node_modules/vite-plus/node_modules/@oxlint/binding-linux-x64-musl": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-musl/-/binding-linux-x64-musl-1.94.0.tgz", + "integrity": "sha512-RqWVeWpDACS4Oh0m21OBmy+CQ50CbbhuHFmNNPVS2P/4R3d188MjEuEuV7So82/tAM8UAT+UuMDtRDESd9NJ7g==", "cpu": [ "x64" ], - "license": "MPL-2.0", + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/vite/node_modules/lightningcss-win32-arm64-msvc": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", - "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "node_modules/vite-plus/node_modules/@oxlint/binding-openharmony-arm64": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-openharmony-arm64/-/binding-openharmony-arm64-1.94.0.tgz", + "integrity": "sha512-K/2DHOUoypwYVqzxJMRPdMuBKjAetZEAsGPP7rHimd+2+5J1TxM+17pG8kw+ayH4+rqBXiPd+H9wgPcU+fF77A==", "cpu": [ "arm64" ], - "license": "MPL-2.0", + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/vite-plus/node_modules/@oxlint/binding-win32-arm64-msvc": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.94.0.tgz", + "integrity": "sha512-hYOCaOJiB4ZCGswBWKl3JQrhqu6mnC5DCUw/1UMNzRXgsHIJ0V226J43LAVICVIDGlhFUZTYShFW+wHWpt6qCQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/vite/node_modules/lightningcss-win32-x64-msvc": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", - "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "node_modules/vite-plus/node_modules/@oxlint/binding-win32-ia32-msvc": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.94.0.tgz", + "integrity": "sha512-1l1FDlzbPmAeDoZ8UGspOE2dOmz1ZL6SlDsvOmRCmWSQjCdTy5LzUepS8mO/SGpAoz4D6WAt/yNZAUyHqbkmkQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/vite-plus/node_modules/@oxlint/binding-win32-x64-msvc": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.94.0.tgz", + "integrity": "sha512-I3eZdd4bemIJQDNv9XDV/FEofDxIoN32tzCv98wIgLdW05EqxZb5hF4AwPrRzHD/dQhl0n7KgPy5AQPfM0HWrA==", "cpu": [ "x64" ], - "license": "MPL-2.0", + "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { - "node": ">= 12.0.0" + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/vite-plus/node_modules/oxlint": { + "version": "1.94.0", + "resolved": "https://registry.npmjs.org/oxlint/-/oxlint-1.94.0.tgz", + "integrity": "sha512-Fnt+3wSKRhtLmvgRfxgRX0excSPCoyiXRol4eWKZLtXxWMQtwQ3KjKQUYXOw5loyinfnZfGzh4RCYf7opfL0vw==", + "dev": true, + "license": "MIT", + "bin": { + "oxlint": "bin/oxlint" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "url": "https://github.com/sponsors/oxc-project" + }, + "optionalDependencies": { + "@oxlint/binding-android-arm-eabi": "1.94.0", + "@oxlint/binding-android-arm64": "1.94.0", + "@oxlint/binding-darwin-arm64": "1.94.0", + "@oxlint/binding-darwin-x64": "1.94.0", + "@oxlint/binding-freebsd-x64": "1.94.0", + "@oxlint/binding-linux-arm-gnueabihf": "1.94.0", + "@oxlint/binding-linux-arm-musleabihf": "1.94.0", + "@oxlint/binding-linux-arm64-gnu": "1.94.0", + "@oxlint/binding-linux-arm64-musl": "1.94.0", + "@oxlint/binding-linux-ppc64-gnu": "1.94.0", + "@oxlint/binding-linux-riscv64-gnu": "1.94.0", + "@oxlint/binding-linux-riscv64-musl": "1.94.0", + "@oxlint/binding-linux-s390x-gnu": "1.94.0", + "@oxlint/binding-linux-x64-gnu": "1.94.0", + "@oxlint/binding-linux-x64-musl": "1.94.0", + "@oxlint/binding-openharmony-arm64": "1.94.0", + "@oxlint/binding-win32-arm64-msvc": "1.94.0", + "@oxlint/binding-win32-ia32-msvc": "1.94.0", + "@oxlint/binding-win32-x64-msvc": "1.94.0" + }, + "peerDependencies": { + "oxlint-tsgolint": ">=7.0.2007", + "vite-plus": "*" + }, + "peerDependenciesMeta": { + "oxlint-tsgolint": { + "optional": true + }, + "vite-plus": { + "optional": true + } } }, "node_modules/vitest": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.0.5.tgz", - "integrity": "sha512-cPODOMF8YnkiiYtDdHo6n4wWmBrOBBbOIYH2d33M4l3CdNn72h+qMmO6uXffUN6A5AZFXNND/d+krS9mgkXRfg==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.1.1.tgz", + "integrity": "sha512-trVmzUFOSraCZcI3uZIMD5FqBh4atFkC/XuJP/IU7qtyQay0FCs3Ia+0QiQ2JJwGyWG/xrcBoJNel2+O7kEZ0g==", "dev": true, "license": "MIT", "dependencies": { "@types/chai": "^5.2.2", - "@vitest/mocker": "5.0.5", + "@vitest/mocker": "5.1.1", "chai": "^6.3.0", "es-module-lexer": "^2.3.2", "expect-type": "^1.4.0", - "magic-string": "^1.4.3", + "magic-string": "^1.4.5", "obug": "^3.0.0", "picomatch": "^4.0.7", "std-env": "^4.3.0", - "tinybench": "^6.2.2", + "tinybench": "^6.2.3", "tinyexec": "^1.3.1", "tinyglobby": "^0.2.17", "why-is-node-running": "3.2.1" @@ -6323,12 +6866,12 @@ "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^22.0.0 || >=24.0.0", - "@vitest/browser-playwright": "5.0.5", - "@vitest/browser-preview": "5.0.5", + "@vitest/browser-playwright": "5.1.1", + "@vitest/browser-preview": "5.1.1", "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", - "@vitest/coverage-istanbul": "5.0.5", - "@vitest/coverage-v8": "5.0.5", - "@vitest/ui": "5.0.5", + "@vitest/coverage-istanbul": "5.1.1", + "@vitest/coverage-v8": "5.1.1", + "@vitest/ui": "5.1.1", "happy-dom": "*", "jsdom": "*", "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" @@ -6373,33 +6916,68 @@ } }, "node_modules/vitest/node_modules/magic-string": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.3.tgz", - "integrity": "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==", + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", "dev": true, "license": "MIT", "dependencies": { "@jridgewell/sourcemap-codec": "^1.6.0" } }, + "node_modules/vscode-jsonrpc": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-10.0.2.tgz", + "integrity": "sha512-U6K7wa1t8jTZf7eoHJLKSNdHE0oi9r/+/4TSXWPSLQ2FSQVMYLR5TvzQHrYjwW/lLjq0eTm+pi8vWz4jSV7o4w==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=14.17.0" + } + }, + "node_modules/vscode-languageserver-protocol": { + "version": "3.18.7", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.18.7.tgz", + "integrity": "sha512-5oItSZDTTehe0zXzwJCFUMso6RfUb2FWVTFfQxAesV3nTbkY1hjW3O6q8872M9TACEXFcALaU5xU37sGudYI8g==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "vscode-jsonrpc": "10.0.2", + "vscode-languageserver-types": "3.18.6" + } + }, + "node_modules/vscode-languageserver-textdocument": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.16.tgz", + "integrity": "sha512-qeNEuOi9a3qkqRf7Gfez2WL2VwlBTLCNekHBGO9kxPVUp9XuY15yfTJ9jwvOwKI0I2MhUUfZq95NSp+LK1CLQg==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/vscode-languageserver-types": { + "version": "3.18.6", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.18.6.tgz", + "integrity": "sha512-DEDtik4YupS+nOg4JxqJ2H5ec/m4tTD9a5mGcBVGYkQKZQo1AIF3ZToiP8+A0kUzyhyqX5dMnPDEnhtmzts7GA==", + "devOptional": true, + "license": "MIT" + }, "node_modules/vscode-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.1.0.tgz", - "integrity": "sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.2.0.tgz", + "integrity": "sha512-m2gXo3bn0G1kT9InzMf07fTbqMbGtyckj3bH5ktLO+1Ssv+yiATZ4dhwaQv9UZWxJh6E9IFGnQyjgWVDWVBDrg==", "devOptional": true, "license": "MIT" }, "node_modules/vue": { - "version": "3.5.41", - "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.41.tgz", - "integrity": "sha512-2laE0p+aK+/AOPG/XL/WepOs/GlK755LJ1XECi9kDUrz1FKNw8rb2Xzlw9JS1rqEV55nb0ttsKxVlTCcd+R5cg==", + "version": "3.5.46", + "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.46.tgz", + "integrity": "sha512-0kW5CgfjMPBqmH158049SaE1muufp+K/ZyrwvSEwrwYky6QB7zL2y8kXfruneKb9O12eh0xAJL6CVSpzb9o0Kg==", "license": "MIT", "dependencies": { - "@vue/compiler-dom": "3.5.41", - "@vue/compiler-sfc": "3.5.41", - "@vue/runtime-dom": "3.5.41", - "@vue/server-renderer": "3.5.41", - "@vue/shared": "3.5.41" + "@vue/compiler-dom": "3.5.46", + "@vue/compiler-sfc": "3.5.46", + "@vue/runtime-dom": "3.5.46", + "@vue/server-renderer": "3.5.46", + "@vue/shared": "3.5.46" }, "peerDependencies": { "typescript": "*" @@ -6411,9 +6989,9 @@ } }, "node_modules/vue-echarts": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/vue-echarts/-/vue-echarts-8.3.1.tgz", - "integrity": "sha512-wN9ycF1+P8j3aajxawRT6R/8asZNBejl1kK2M2/Lk6wCdK2XG+YK39sDfZLF8S5UaBbNZqzN1joObtRhmhORJg==", + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/vue-echarts/-/vue-echarts-8.3.2.tgz", + "integrity": "sha512-FbJD49OZZZv1I8aclHQ+gcQxU+Y9nNWQMuod1sewE7/YjGQUJAaeVcf6WrSfQDBRPke+WoVsUtdRFIqPOsRrnw==", "license": "MIT", "peerDependencies": { "echarts": "^6.0.0", @@ -6446,26 +7024,26 @@ } }, "node_modules/vue-router": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-5.3.1.tgz", - "integrity": "sha512-GDBZzgmILxA/kFnkFbJjQZdZ2QQbngnIMMuoUcjhZIfH1RGMaPjPwX5ASnV38qamuA9uhO0RDjSBHTDNG2uXyQ==", + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-5.5.3.tgz", + "integrity": "sha512-F3uyE2siuOC8QLxR3YAdqtxTEgLM/+rc0Fvej7/DVo6YTY5RgLBQpm1+fYP26ITjD3Fg5rDWuzBKxIB6rjlt1w==", "license": "MIT", "dependencies": { - "@vue-macros/common": "^3.1.3", - "@vue/devtools-api": "^8.1.5", - "ast-walker-scope": "^0.9.0", - "chokidar": "^5.0.0", - "confbox": "^0.2.4", - "local-pkg": "^1.2.1", - "magic-string": "^0.30.21", + "@vue-macros/common": "^3.1.4", + "@vue/devtools-api": "^8.2.1", + "ast-walker-scope": "^0.10.0", + "chokidar": "^6.0.0", + "confbox": "^0.3.2", + "local-pkg": "^2.0.0", + "magic-string": "^1.4.5", "mlly": "^1.8.2", - "muggle-string": "^0.4.1", - "nostics": "^1.1.4", + "muggle-string": "^1.0.4", + "nostics": "^1.3.0", "pathe": "^2.0.3", - "picomatch": "^4.0.5", + "picomatch": "^4.0.7", "scule": "^1.3.0", "tinyglobby": "^0.2.17", - "unplugin": "^3.3.0", + "unplugin": "^3.7.0", "unplugin-utils": "^0.3.2" }, "funding": { @@ -6473,10 +7051,10 @@ }, "peerDependencies": { "@pinia/colada": ">=0.21.2", - "@vue/compiler-sfc": "^3.5.34 || ^4.0.0", + "@vue/compiler-sfc": "^3.5.34 || ^3.6.0-0 || ^4.0.0", "pinia": "^3.0.4 || ^4.0.2", "vite": "^7.3.0 || ^8.0.0", - "vue": "^3.5.34 || ^4.0.0" + "vue": "^3.5.34 || ^3.6.0-0 || ^4.0.0" }, "peerDependenciesMeta": { "@pinia/colada": { @@ -6493,15 +7071,72 @@ } } }, + "node_modules/vue-router/node_modules/chokidar": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-6.0.0.tgz", + "integrity": "sha512-Ec2Z7wpcKBiMpR7DxteoqS/sq5G5d2A4fpxzPv6+fD7xNNdrTghn7L11YwV5EN1B3i72Erc3XVT5FkWIDx90+A==", + "license": "MIT", + "dependencies": { + "readdirp": "^5.1.1" + }, + "engines": { + "node": ">= 22.22" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/vue-router/node_modules/local-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-2.0.0.tgz", + "integrity": "sha512-xvTNwM27EpU+fkLSpo33Pq/nm8m5zNf0aU/hF4W4ZM9RHQjVZa5KTmmXIzEzVsdI09NOUqj0djHhTv96sUowSQ==", + "license": "MIT", + "dependencies": { + "mlly": "^1.8.2", + "pkg-types": "^2.3.1", + "quansync": "^1.0.0" + }, + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/vue-router/node_modules/magic-string": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" + } + }, + "node_modules/vue-router/node_modules/quansync": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/quansync/-/quansync-1.0.0.tgz", + "integrity": "sha512-5xZacEEufv3HSTPQuchrvV6soaiACMFnq1H8wkVioctoH3TRha9Sz66lOxRwPK/qZj7HPiSveih9yAyh98gvqA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/antfu" + }, + { + "type": "individual", + "url": "https://github.com/sponsors/sxzz" + } + ], + "license": "MIT" + }, "node_modules/vue-tsc": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-3.3.11.tgz", - "integrity": "sha512-gOb0B9rtU2+f1dszwPqSH5kAieIF9ReeLhD3kSRNHv5WZZUQz/JdVXW0RTdqhNTMlQkqKzrTTviqKr/4FYZraQ==", + "version": "3.3.14", + "resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-3.3.14.tgz", + "integrity": "sha512-URAu2H9AuMZMg9GCgnqbaHHHd8pBZRAwNV2e2yYS8VDsoTVXHiOSo663OS6DkEvauQ2yixn5TPFJ9WV9QIspkA==", "devOptional": true, "license": "MIT", "dependencies": { - "@volar/typescript": "2.4.28", - "@vue/language-core": "3.3.11" + "@volar/typescript": "2.4.30", + "@vue/language-core": "3.3.14" }, "bin": { "vue-tsc": "bin/vue-tsc.js" @@ -6556,9 +7191,9 @@ } }, "node_modules/ws": { - "version": "8.22.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.22.0.tgz", - "integrity": "sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg==", + "version": "8.23.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.23.1.tgz", + "integrity": "sha512-1rzWDSN0NOi3tpwgHsQExjWRoKUGtjCkJ2gZRaaRtzhYLboMytOI9pj9PU7yCgY37auqdd4OyLofZDbkeuZmPA==", "dev": true, "license": "MIT", "engines": { @@ -6604,6 +7239,7 @@ "version": "0.19.0", "resolved": "https://registry.npmjs.org/yuku-core/-/yuku-core-0.19.0.tgz", "integrity": "sha512-kYK9e1XdfirNhkipzW0wmMcSWcVF/CWnuugodfVYRCUwvoBefweL9HzB96OiKEhsx78V5WbUxbJqlizMX869Qg==", + "deprecated": "Yuku is now one package with one core. Use \"yuku\" instead: https://yuku.fyi/javascript/. Existing installs keep working but get no more fixes.", "devOptional": true, "license": "MIT", "dependencies": { @@ -6631,6 +7267,7 @@ "version": "0.19.0", "resolved": "https://registry.npmjs.org/yuku-parser/-/yuku-parser-0.19.0.tgz", "integrity": "sha512-XrBh9ZiQK5mJVRxZBAvD6LwRyAYrK3MFtH3+onyuxFL5hFD44EC3QOmIC1FjTj6H2MMwq46/NAI+NZxLZPZgxg==", + "deprecated": "Yuku is now one package with one core. Use \"yuku\" instead: https://yuku.fyi/javascript/. Existing installs keep working but get no more fixes.", "devOptional": true, "license": "MIT", "dependencies": { diff --git a/web/package.json b/web/package.json index 5258c724..b390ada7 100644 --- a/web/package.json +++ b/web/package.json @@ -15,45 +15,45 @@ "format:check": "vp fmt --check ." }, "dependencies": { - "@fontsource-variable/google-sans-code": "5.3.1", + "@fontsource-variable/google-sans-code": "5.3.2", "@fontsource-variable/inter": "5.3.0", "@fontsource-variable/inter-tight": "5.3.0", - "@lobehub/icons-static-svg": "1.102.0", - "@lucide/vue": "1.52.0", - "@material-symbols/svg-300": "0.47.6", + "@lobehub/icons-static-svg": "1.106.0", + "@lucide/vue": "1.84.0", + "@material-symbols/svg-300": "0.49.0", "@vscode/markdown-it-katex": "1.1.2", - "@wailsio/runtime": "3.0.0-beta.29", + "@wailsio/runtime": "3.1.0", "beautiful-mermaid": "1.1.3", "echarts": "6.1.0", - "eventsource-parser": "4.1.0", + "eventsource-parser": "4.1.3", "highlight.js": "11.12.0", "katex": "0.16.47", - "markdown-it": "15.0.2", - "pdfjs-dist": "6.4.299", - "reka-ui": "2.11.0", - "thinking-orbs": "0.3.1", - "vue": "3.5.41", - "vue-echarts": "8.3.1", - "vue-router": "5.3.1" + "markdown-it": "15.0.3", + "pdfjs-dist": "6.5.438", + "reka-ui": "2.12.0", + "thinking-orbs": "0.3.2", + "vue": "3.5.46", + "vue-echarts": "8.3.2", + "vue-router": "5.5.3" }, "devDependencies": { - "@tailwindcss/vite": "4.3.3", - "@types/node": "24.10.13", - "@typescript-eslint/parser": "8.67.0", - "@vitejs/plugin-vue": "6.0.8", - "eslint": "10.9.0", - "eslint-config-prettier": "10.1.8", - "eslint-plugin-oxlint": "1.88.0", - "eslint-plugin-vue": "10.10.0", - "sass-embedded": "1.105.1", - "tailwindcss": "4.3.3", + "@tailwindcss/vite": "4.3.5", + "@types/node": "24.19.4", + "@typescript-eslint/parser": "8.74.0", + "@vitejs/plugin-vue": "6.0.11", + "eslint": "10.16.0", + "eslint-config-prettier": "10.1.9", + "eslint-plugin-oxlint": "1.95.0", + "eslint-plugin-vue": "10.12.1", + "sass-embedded": "1.108.2", + "tailwindcss": "4.3.5", "typescript": "6.0.3", - "vite": "npm:@voidzero-dev/vite-plus-core@1.3.0", - "vite-plugin-compression2": "2.5.3", - "vite-plus": "1.3.0", - "vue-tsc": "3.3.11" + "vite": "npm:@voidzero-dev/vite-plus-core@8.3.8001", + "vite-plugin-compression2": "2.5.4", + "vite-plus": "1.8.0", + "vue-tsc": "3.3.14" }, "overrides": { - "vite": "npm:@voidzero-dev/vite-plus-core@1.3.0" + "vite": "npm:@voidzero-dev/vite-plus-core@8.3.8001" } } diff --git a/web/src/App.vue b/web/src/App.vue index 4971f067..15a36d97 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -144,6 +144,7 @@ const { accountTasks, visibleAccounts, models, + catalogModels, cooldowns, requests, config, @@ -507,7 +508,7 @@ onMounted(revealCurrentTab) :error="errors.accounts" :chrome-import="status?.chrome_import ?? false" :camoufox="status?.camoufox" - :models="models" + :models="catalogModels" :cooldowns="cooldowns" @refresh="loadAccountData" @updated="updateAccount" @@ -522,7 +523,7 @@ onMounted(revealCurrentTab) /> - + { + return new Set( + value + .split(',') + .map((id) => id.trim().replace(/^models\//, '')) + .filter(Boolean), + ) +} + +// buildChatModel 判断模型是否为经 Build 写代码助手回答的 -build 模型,按模型 ID 的 -build 后缀判断 +export function buildChatModel(model: Pick): boolean { + return model.id.endsWith('-build') +} + +// apiVisible 判断模型是否在公开 API 中提供:没有在模型目录中隐藏,-build 模型另需打开 Build 对话模型 +export function apiVisible(model: Pick, config: ServiceConfig | null): boolean { + if (config === null) return true + if (buildChatModel(model) && !config.build_chat_models) return false + return !hiddenModels(config.hide_models).has(model.id) +} diff --git a/web/src/components/AccessPanel.vue b/web/src/components/AccessPanel.vue index aed6a54f..572605ef 100644 --- a/web/src/components/AccessPanel.vue +++ b/web/src/components/AccessPanel.vue @@ -14,6 +14,7 @@ import { } from '@/access/endpoints' import { maskKey, splitKeys } from '@/apikey' import { useI18n, type TranslationKey } from '@/i18n' +import { truncateCodePoints } from '@/text' import type { IconName } from '@/icons' import { formatLogNumber } from '@/logs' import { defaultChatModel } from '@/playground/catalog' @@ -209,7 +210,7 @@ async function runTest(): Promise { .content ?? '' return text.trim() === '' ? t('access.testEmptyReply') - : t('access.testReply').replace('{text}', text.trim().slice(0, 200)) + : t('access.testReply').replace('{text}', truncateCodePoints(text.trim(), 200)) }, ) testing.value = false diff --git a/web/src/components/AccountExits.vue b/web/src/components/AccountExits.vue index 4d607021..4a95af52 100644 --- a/web/src/components/AccountExits.vue +++ b/web/src/components/AccountExits.vue @@ -99,16 +99,17 @@ const expanded = ref(false) // hidden 是收起时一行放不下的标签数,排在最后的这些标签不显示 const hidden = ref(0) -// measure 统计收起时一行放不下的标签数:换到第一行以外或在第一行被截断的标签及其后的标签 +// measure 统计收起时一行放不下的标签数:第一个标签之后换到第一行以外或在第一行被截断的标签及其后的标签 function measure(): void { if (expanded.value) return const items = Array.from(list.value!.children) as HTMLElement[] const overflow = items.findIndex( - (item) => - item.offsetTop > items[0]!.offsetTop || - Array.from(item.querySelectorAll('.truncate')).some( - (text) => text.scrollWidth > text.clientWidth, - ), + (item, index) => + index > 0 && + (item.offsetTop > items[0]!.offsetTop || + Array.from(item.querySelectorAll('.truncate')).some( + (text) => text.scrollWidth > text.clientWidth, + )), ) hidden.value = overflow === -1 ? 0 : items.length - overflow } @@ -156,7 +157,7 @@ function proxyText(proxies: string[]): string { :class=" expanded ? 'col-span-full mt-2 max-h-40 cursor-auto overflow-y-auto rounded-md border border-line bg-panel p-2' - : 'h-6 overflow-hidden' + : 'h-6 overflow-hidden max-md:col-span-full max-md:mt-2' " > { text: string; tip: string } | undefined }>() const emit = defineEmits<{ change: [ids: string[]] }>() @@ -44,7 +49,9 @@ function keywords(id: string): string { // triggerLabel 是按钮文字:未选时为全部账户,选中时为第一个账户 const triggerLabel = computed(() => - props.selected.length === 0 ? t('settings.keyAccountsAll') : label(props.selected[0]!), + props.selected.length === 0 + ? (props.noneLabel ?? t('settings.keyAccountsAll')) + : label(props.selected[0]!), ) // triggerBadge 是按钮上其余已选账户的数目,只选一个时不显示 @@ -65,7 +72,7 @@ const triggerBadge = computed(() => :format="keywords" :search-label="t('settings.accountSearch')" :empty-label="t('settings.accountNone')" - :clear-label="t('settings.keyAccountsClear')" + :clear-label="clearLabel ?? t('settings.keyAccountsClear')" :disabled="disabled" @change="emit('change', $event)" > @@ -79,6 +86,12 @@ const triggerBadge = computed(() => :class="tierBadgeClass(tier(value))" >{{ tier(value) }} + {{ props.mark!(value)!.text }} void): void { + if (overlayPressed === event.currentTarget && event.target === event.currentTarget) close() + overlayPressed = null +} + function closeEditor(): void { saveController?.abort() showEditor.value = false @@ -2154,7 +2168,12 @@ watch( /> -