Skip to content

Opencode2Obsidianv0.2.1

Choose a tag to compare

@Changan-Su Changan-Su released this 18 Jan 17:26
· 7 commits to master since this release

Release v0.2.1

Release Date / 发布日期: 2026-01-18
Type / 类型: Bugfix Release (Critical) / 修复版本(关键)


📦 Download / 下载

Plugin Package / 插件包: opencode2obsidian-v0.2.1.zip


🐛 Critical Bugfixes / 关键修复

Session Access Issue (FIXED) / 会话访问问题(已修复)

Problem / 问题: Embedded OpenCode in Obsidian could not access sessions from other directories, displaying "session error" messages.
Obsidian 内嵌 OpenCode 无法访问其它目录的会话,出现 “session error”。

Root Cause / 根因:

  • Incorrect URL construction with base64-encoded vault path (http://127.0.0.1:14096/QzpcVXNlcnNc...) / 将 vault 路径 base64 编码拼到 URL 路径中
  • OpenCode CLI doesn't support path parameters in URLs / OpenCode CLI 不支持 URL path 传参
  • Each vault started OpenCode with different working directory, isolating sessions / 每个 vault 用不同工作目录启动 OpenCode,导致会话隔离

Solution / 解决方案:

  • ✅ Removed base64 path encoding from URL / 移除 URL 中的 base64 路径编码
  • ✅ Changed URL to root path: http://127.0.0.1:14096/ / URL 改为根路径
  • ✅ Changed working directory from vault-specific to user home directory / 工作目录从 vault 改为用户主目录
  • ✅ Now all Obsidian vaults share the same OpenCode environment / 多个 vault 共享同一 OpenCode 环境

Impact / 影响: Users can now access all sessions and settings globally across all vaults.
现在可在所有 vault 间共享会话与设置(全局一致)。


Settings Interface Issue (FIXED) / 设置界面问题(已修复)

Problem / 问题: Settings interface in embedded OpenCode was not functioning correctly.
内嵌 OpenCode 的设置界面无法正常工作。

Root Cause / 根因: Same as session issue - isolated working directories caused settings data to be stored in different locations.
同会话问题:工作目录隔离导致设置数据写入不同位置。

Solution / 解决方案: Global working directory (user home) ensures settings are consistent everywhere.
使用全局工作目录(用户主目录)确保设置一致。


📋 Technical Changes / 技术变更

Modified Files / 修改文件

  • src/ProcessManager.ts:
    • Line 62-67: Simplified getUrl() to return root path only / getUrl() 改为仅返回根路径
    • Line 104-123: Changed cwd from this.projectDirectory to os.homedir() / cwd 从 vault 目录改为 os.homedir()

Code Comparison / 代码对比

Before (v0.2.0) / 变更前(v0.2.0):

getUrl(): string {
  const encodedPath = btoa(this.projectDirectory);
  return `http://${this.settings.hostname}:${this.settings.port}/${encodedPath}`;
}

// Process spawn
cwd: this.projectDirectory,  // vault path

After (v0.2.1) / 变更后(v0.2.1):

getUrl(): string {
  return `http://${this.settings.hostname}:${this.settings.port}`;
}

// Process spawn
const homedir = os.homedir();
cwd: homedir,  // user home directory

⚠️ Behavior Changes / 行为变化

Expected Differences from v0.2.0 / 相比 v0.2.0 的预期差异

1. No Auto-Project Switching / 不再自动切换项目目录

  • Before / 之前: Each vault automatically worked in that vault's directory / 每个 vault 默认工作在自身目录
  • After / 现在: OpenCode always starts in user home directory / OpenCode 总是在用户主目录启动
  • Workaround / 解决方式: Manually select project directory in OpenCode UI / 在 OpenCode 界面手动选择项目目录

2. Global Session/Settings Sharing / 会话与设置全局共享

  • Before / 之前: Each vault had isolated OpenCode instance / 每个 vault 的 OpenCode 数据隔离
  • After / 现在: All vaults share the same OpenCode environment / 所有 vault 共享同一 OpenCode 环境
  • Benefit / 好处: Consistent session history and settings across all vaults / 会话历史与设置在各 vault 间一致

🧪 Testing / 测试

Verified ✅ / 已验证 ✅

  • Build successful with no errors / 构建通过无错误
  • URL construction correct (root path only) / URL 仅使用根路径
  • Working directory set to user home / 工作目录为用户主目录
  • Health check uses corrected URL / 健康检查使用修正后的 URL

User Testing Required / 需要用户验证

Please verify the following after installing v0.2.1: / 安装 v0.2.1 后请确认:

  1. ✅ Session list displays all historical sessions / 会话列表能显示历史会话
  2. ✅ Can switch between sessions without errors / 切换会话无报错
  3. ✅ Settings interface opens and functions correctly / 设置界面可打开且可用
  4. ✅ Settings persist across Obsidian restarts / 设置在重启 Obsidian 后仍能保持
  5. ✅ Sessions created in one vault are visible in other vaults / 一个 vault 创建的会话可在其它 vault 看到

📦 Installation / 安装

Manual Installation (Recommended) / 手动安装(推荐)

  1. Download opencode2obsidian-v0.2.1.zip / 下载压缩包
  2. Create the plugin folder: <vault>/.obsidian/plugins/opencode2obsidian/ / 创建插件目录
  3. Extract the zip into that folder / 解压到该目录
  4. Important / 重要: Completely restart Obsidian (not just reload) / 请完全退出并重启 Obsidian(不要只重载)
  5. Enable plugin in Settings → Community Plugins / 在社区插件中启用

🔗 Upgrade from v0.2.0 / 从 v0.2.0 升级

Is This Update Required? / 是否必须更新?

YES - Highly Recommended / 是的,强烈建议 if you experienced / 如果你遇到:

  • "Session error" messages / “session error” 报错
  • Inability to access sessions from other directories / 无法访问其他目录会话
  • Settings interface not working properly / 设置界面不可用

Migration Notes / 迁移说明

  • No data migration required / 无需迁移数据
  • Settings and sessions are preserved / 设置与会话会保留
  • No breaking changes to plugin configuration / 插件配置无破坏性变更

📚 Documentation / 文档

New Documentation Files / 新增文档

  • BUGFIX-SESSION.md - Detailed technical analysis of the bugfix / Bug 修复技术分析
  • TEST-VERIFICATION.md - Comprehensive testing guide (10 test cases) / 测试指南(10 个用例)
  • CHANGELOG.md - Updated with v0.2.1 entry / 更新 v0.2.1 记录

Updated Files / 更新文件

  • manifest.json - Version 0.2.1 / 版本 0.2.1
  • package.json - Version 0.2.1 / 版本 0.2.1

🙏 Acknowledgments / 致谢

Thanks to the user who reported the session and settings issues. This critical bugfix improves the reliability and usability of the plugin significantly.
感谢反馈会话与设置问题的用户。本次关键修复显著提升了插件的可靠性与可用性。


📝 Full Changelog / 完整变更

See CHANGELOG.md for complete version history.
查看完整版本历史请见 CHANGELOG.md。


🐛 Known Issues / 已知问题

None at this time. Please report issues at: GitHub Issues
目前暂无已知问题,欢迎在上述链接反馈。


🔜 Next Release (v0.3.0 - Planned) / 下个版本(v0.3.0 - 计划中)

  • AGENTS.md auto-initialization / AGENTS.md 自动初始化
  • Skills integration / Skills 集成
  • Enhanced keyboard shortcuts / 增强快捷键
  • Project auto-switching API (pending OpenCode CLI support) / 项目自动切换(待 OpenCode CLI 支持)

Author / 作者: Changan Su (@Changan-Su)
License / 许可证: MIT
Repository / 仓库: https://github.com/Changan-Su/opencode2obsidian