Skip to content

Releases

v1.5.0

Choose a tag to compare

@In-dor In-dor released this 13 Nov 06:44

🎉 v1.5.0 Release Notes / 更新说明

🇨🇳 中文更新说明

🚀 旗舰默认模型与容灾升级

  • 默认主模型升级为 gemini-4-hydrogen:提供更强的搜索整合与深度思考表现;默认单模型请求超时提升至 60s(总容灾超时 180s)。
  • 可配置容灾降级链:默认降级链为 gemini-4-hydrogen -> gemini-3.8-flash -> gemini-3.5-flash-lite -> gemini-3.7-flash -> gemini-3.1-flash-lite -> gemini-3-flash-preview -> gemini-2.5-flash,支持通过 options.fallbackModels 或环境变量 OPENCODE_GOOGLE_FALLBACK_MODELS 自定义。
  • 空响应 / 截断保护:遇到空输出、MAX_TOKENS 截断或 promptFeedback.blockReason 安全拦截时自动降级下一候选模型,且严禁将异常/空结果写入缓存。

🖥️ OpenChamber 网页搜索 UI 配置面板接入 (ctx.integration)

  • 自动在 OpenChamber 「设置 → 网页搜索 → Google Gemini Grounding」 注册完整可视化表单,支持配置 API Key、可选 Base URL(反代网关)与可选 Preferred Model,并自动声明环境变量状态检测(OPENCODE_GOOGLE_API_KEY、GOOGLE_API_KEY、GOOGLE_GENERATIVE_AI_API_KEY、GEMINI_API_KEY)。
  • 尊重用户在 UI 中已选定的默认搜索源或禁用状态(setDefaultWebsearch 仅在显式设置为 true 或当前未指定默认源时设为 google-grounding)。

🗄️ 全面兼容 OpenCode V2.2.6+ opencode.db 与多级配置解析

  • 只读 SQLite 凭据读取:内置兼容 node:sqlite 与 bun:sqlite 的 readCredentialFromSqlite,支持 mtime + WAL 文件变更感知缓存,自动识别 ~/.local/share/opencode/opencode.db credential 表中的 key / oauth 凭据与表单 metadata(baseURL、model)。
  • 完整配置优先级与运行时联动:支持实时 ctx.integration、ctx.provider、ctx.config,祖先目录项目级 opencode.json(c) / .opencode/opencode.json(c),传统 auth.json,以及 {env:VAR} / {file:path/to/secret}(支持 ~/ 与相对路径)占位符解析。

🔐 智能认证分流、思考深度控制与稳定性加固

  • 智能认证头分流 (authMode):Google 官方 *.googleapis.com 端点默认仅发 x-goog-api-key(避免双头冲突);OAuth 凭据仅发 Authorization: Bearer;第三方网关(OneAPI / NewAPI 等)发送双头,并支持 authMode(auto / x-goog-api-key / bearer / both)与自定义 headers 合并。
  • 原生深度思考保留 & #variant 归一化:默认不注入 thinkingConfig 以保留 gemini-4-hydrogen 服务端原生 HIGH 深度思考;支持通过 thinkingLevel / OPENCODE_GOOGLE_THINKING_LEVEL 按需调节(LOW / MEDIUM / HIGH / XHIGH);normalizeModelId 自动剥离 google/ 前缀与 #variant 后缀。
  • 全信号并发合并 & 安全脱敏:Singleflight 并发去重支持多订阅者独立 AbortSignal 隔离;缓存键纳入非默认 baseURL 并在过期时调用 storage.remove 清理;非 JSON 401/403 立即抛出 FatalError 终止,超长错误信息自动截断并对 key= / API Key / Bearer Token 脱敏;卡片 URL 强制校验 http(s)://。
  • 测试覆盖升级:单元测试扩展至 23 项并全部通过(npm test)。

🇺🇸 English Release Notes

🚀 Default Model & Fallback Chain Upgrade

  • Default model upgraded to gemini-4-hydrogen: With per-model request timeout raised to 60s (requestTimeoutMs) and overall chain timeout at 180s (timeoutMs).
  • Customizable fallback chain: Defaults to gemini-4-hydrogen -> gemini-3.8-flash -> gemini-3.5-flash-lite -> gemini-3.7-flash -> gemini-3.1-flash-lite -> gemini-3-flash-preview -> gemini-2.5-flash, configurable via options.fallbackModels or OPENCODE_GOOGLE_FALLBACK_MODELS.
  • Empty / MAX_TOKENS / blocked fallback: Automatically falls back when a model returns empty output, MAX_TOKENS, or promptFeedback.blockReason, without polluting ctx.storage cache.

🖥️ OpenChamber Web Search UI Integration (ctx.integration)

  • Registers Google Gemini Grounding (google-grounding) in OpenChamber Settings → Web Search with a configuration form (API Key, optional Base URL, optional Preferred Model) and environment variable detection (OPENCODE_GOOGLE_API_KEY, GOOGLE_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, GEMINI_API_KEY).
  • Preserves existing user websearch defaults or disabled preference unless setDefaultWebsearch: true is set or no default is currently selected.

🗄️ OpenCode V2.2.6+ opencode.db & Full Config Resolution

  • Safe read-only SQLite credential reader: Supports node:sqlite and bun:sqlite with mtime/WAL-aware caching (readCredentialFromSqlite) to read active key / oauth credentials and metadata (baseURL, model) from ~/.local/share/opencode/opencode.db.
  • Live runtime & project-level resolution: Integrates with live ctx.integration, ctx.provider, and ctx.config, ancestor project opencode.json(c) / .opencode/opencode.json(c), legacy auth.json, GOOGLE_GENERATIVE_AI_API_KEY, and {env:VAR} / {file:path/to/secret} placeholders.

🔐 Smart Auth Routing, Thinking Config & Hardening

  • Smart auth header routing (authMode): Official *.googleapis.com endpoints send x-goog-api-key only; OAuth sends Authorization: Bearer only; custom third-party proxies send dual headers, with explicit authMode (auto | x-goog-api-key | bearer | both) and custom headers merging.
  • Native thinking preservation & #variant normalization: Omits thinkingConfig by default to keep gemini-4-hydrogen's native server-side HIGH thinking; optionally injects generationConfig.thinkingConfig.thinkingLevel (LOW / MEDIUM / HIGH / XHIGH) for Gemini 3/4 models; normalizeModelId strips both google/ prefixes and #variant suffixes.
  • Subscriber-aware Singleflight & hardening: Per-caller AbortSignal isolation in Singleflight deduplication; non-default baseURL cache key isolation and expired entry cleanup via storage.remove; immediate FatalError on non-JSON 401/403; error truncation & secret redaction (key=, API keys, Bearer tokens); strict http(s):// card URL sanitization.
  • Expanded tests: All 23 unit tests passing via npm test.