Skip to content

OpenCode v1.3.0-hmsy

Choose a tag to compare

@heimoshuiyu heimoshuiyu released this 23 Mar 04:48
· 4570 commits to hmsy since this release
1f3ce56

OpenCode v1.3.0-hmsy - Release Notes

版本 v1.3.0-hmsy 是 OpenCode 的一个重要更新,引入了语音输入、后台作业管理、前端资源嵌入等众多新功能和改进。


🎤 主要功能改进

语音输入系统

  • 完整的语音输入功能:支持 Web UI 和 TUI 双端语音输入
    • Web UI:基于浏览器原生 MediaRecorder API
    • TUI:支持 ffmpeg/sox/arecord 等命令行工具
    • 跨平台支持(Linux/Windows/Mac)
  • 多提供商转录支持:
    • Whisper API(OpenAI 专用音频转录)
    • ALM(通用 Chat Completions API)
  • 智能音频处理:
    • 自动格式转换(WebM → MP3/WAV)
    • 会话上下文感知转录,提高准确性
    • 错误诊断和日志记录
  • 用户体验改进:
    • 转录中显示 Spinner 加载动画
    • 智能插入转录文本,确保插入到编辑器正确位置
    • Toast 通知反馈
    • 键盘快捷键支持(mod+shift+m)

后台作业管理

  • 完整的后台作业管理系统:
    • job_list:列出所有后台作业,支持状态过滤(running/completed/failed/killed)
    • job_output:获取作业输出和状态,支持等待完成
    • job_kill:终止后台作业,支持优雅或强制终止
  • 自动后台转换:
    • 前台命令超过 60 秒自动转换为后台作业
    • 保留原有进程和已收集的输出
    • 最多支持 50 个并发作业
  • 作业生命周期管理:
    • 作业在完成后保留 8 小时
    • 每小时自动清理已完成的作业
    • 最大输出限制 30,000 字符
  • 事件通知系统:作业更新、完成、清理事件

前端资源嵌入

  • CLI 独立运行:将完整的前端应用打包进 CLI 二进制文件
    • 文本资源使用 gzip 压缩
    • 二进制资源使用 base64 编码
    • 二进制大小增加约 96MiB(155MiB → 251MiB for linux-x64)
  • 三层回退机制:
    1. 内嵌资源(优先)
    2. SPA index.html
    3. 远程 CDN
  • 智能缓存策略:
    • index.html:no-cache
    • assets/**(带哈希的 JS/CSS):public, max-age=31536000, immutable
    • 其他静态文件:public, max-age=86400

🔧 次要功能改进

命令工具增强

  • List Tool 深度控制:添加 depth 参数控制目录遍历深度,避免输出过载
  • 命令重定向和智能引导:自动检测不恰当的 bash 命令(grep, cat, sed, ls, find),引导使用专用工具
  • 错误消息改进:使用 XML 标签包装错误消息,提高可解析性
  • 作业输出等待时间显式要求:强制用户明确指定等待时间,避免歧义

Web 和部署

  • 可配置 Web 代理:支持通过 OPENCODE_WEB_URL 环境变量自定义前端资源来源
  • 主题颜色同步:动态更新浏览器 theme-color 与应用主题保持一致
  • 静态资源免认证:前端静态资源(HTML、JS、CSS、图标等)无需身份验证即可访问
  • 标准化部署:新增 web-s3-deploy 技能实现自动化构建、S3 同步和 CloudFront invalidation

国际化

  • 完整的中文支持:
    • 将所有 agent prompt 文件翻译为中文
    • 将命令模板翻译为中文(initialize.txt、review.txt)
    • 为中文用户提供完整的本地化支持
  • 结构化摘要模板:提供包含目标、指令、发现、已完成、相关文件等部分的中文摘要模板

🐛 Bug 修复

UI 和布局

  • Prompt toolbar 溢出布局修复:通过添加横向滚动和响应式宽度,解决了控件在小屏幕上被截断的问题
  • Voice 输入插入修复:确保转录文本插入到编辑器正确位置,而非助手消息

Bash 和工具

  • Bash 工具简化:移除冗余参数和复杂性
  • System prompt 优化:移除自动目录列表,减少 token 消耗,鼓励按需使用 list 工具

Web

  • Cache-Control 头修复:为内嵌的 Web 资源设置合理的缓存策略

📦 代码质量提升

重构

  • Voice 逻辑提取:提取共享逻辑到 voice/common.ts,减少约 70% 代码重复
  • 类型解析简化:简化 voice 类型解析逻辑,遵循项目风格指南
  • Bash 工具简化:移除冗余参数和复杂性

工具化

  • 完整版本发布流程:新增 opencode-release 技能实现自动化发布
    • 多平台二进制压缩(ZSTD + 7zip)
    • 代码改进分析和 GitHub Release 创建
    • 动态 tag 命名和前端部署集成
  • Web 部署自动化:新增 web-s3-deploy 技能实现一键构建、S3 同步、CloudFront invalidation

测试

  • List Tool 测试覆盖:新增 16 个测试用例,100% 覆盖率

📥 二进制下载

平台 文件 压缩工具 大小
Linux x64 opencode-linux-x64.zst ZSTD (level 19) 99.9 MiB
Linux arm64 opencode-linux-arm64.zst ZSTD (level 19) 99.3 MiB
macOS x64 opencode-darwin-x64.zst ZSTD (level 19) 88.9 MiB
macOS arm64 opencode-darwin-arm64.zst ZSTD (level 19) 87.9 MiB
Windows x64 opencode-windows-x64.zip 7zip 112 MiB

解压方法

Linux/macOS:

zstd -d opencode-linux-x64.zst -o opencode
chmod +x opencode
./opencode

Windows:

7z x opencode-windows-x64.zip
.\opencode.exe

🔧 配置选项

语音输入配置

voice:
  type: "whisper"  # 或 "alm"

  # Whisper 配置
  whisper:
    url: "https://api.openai.com/v1/audio/transcriptions"
    apiKey: "{env:OPENCODE_WHISPER_API_KEY}"
    model: "whisper-1"
    language: "auto"

  # ALM 配置
  alm:
    url: "https://api.openai.com/v1/chat/completions"
    apiKey: "{env:OPENAI_API_KEY}"
    model: "gpt-4o-mini-transcribe"
    system: "You are a helpful assistant."
    prompt: "Transcribe the audio."

Web 代理配置

# 设置前端资源来源
export OPENCODE_WEB_URL="https://your-cdn.cloudfront.net"

📚 完整变更列表

从 v1.3.0 到 v1.3.0-hmsy 的所有 commits:

  1. fix(app): improve prompt toolbar overflow layout
  2. fix(web): sync theme-color metadata with active theme
  3. server: bypass auth for frontend static paths
  4. refactor(bash): wrap error messages with XML tags
  5. fix: set proper cache-control headers for embedded web assets
  6. feat: embed frontend assets into CLI binary
  7. Add depth parameter to list tool
  8. feat: add opencode-release skill for complete version release workflow
  9. refactor(voice): extract common logic to voice/common.ts
  10. fix(voice): capture ffmpeg stderr for better error diagnostics
  11. Simplify voice type resolution logic
  12. Fix voice input insertion by ensuring selection is in editor
  13. feat: show spinner while transcribing
  14. Add bash command guard to redirect to specialized tools
  15. Keep processes alive on auto-background
  16. Update default Whisper URL
  17. Add web deploy skill and configurable web proxy
  18. feat: add ALM voice transcription
  19. feat: add voice input feature
  20. Change web bash display: header shows command, content shows description
  21. Update agent prompts and session handling
  22. i18n: translate command templates to Chinese
  23. Revert "remove list tool"
  24. Simplify bash tool implementation
  25. remove file listing from system prompt
  26. Require explicit wait time for job output
  27. feat: implement background job management for bash commands

🎉 致谢

感谢所有贡献者的努力,特别是:

  • 语音输入功能的完整实现
  • 后台作业管理系统的设计和开发
  • 前端资源嵌入功能的创新
  • 国际化支持的完善

下载地址:本页面下方 Assets 区域
更新日期:2025-01-23
上一个版本:v1.3.0