Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

[简体中文](./CHANGELOG.zh-CN.md)

## 3.3.0

OpenCode 2 support. Upgrade every machine before or together with OpenCode 2;
see **Upgrading to OpenCode 2** in the README.

### Security
- **OpenCode 2's `service.json` is never committed.** OpenCode 2 writes it into the config folder (service settings and a password) and into the state folder (URL, process id and a password). The config folder is the repository, so 3.2.0 committed the first, and the state mirror carried the second. Both are now ignored, removed from the repository on the next push, and this machine's own copy survives pulling an older commit that still has another machine's. Lock files, prompt history and recent-file lists (`_state/locks/`, `prompt-history.jsonl`, `frecency.jsonl`) are machine-local for the same reason. The files stay in the repository's history; the password only opens the local background service on that machine.

### Added
- **OpenCode 2 sessions.** Sessions are exported from and imported into OpenCode 2's own tables (`session_v2`, `session_message`, `session_part`, instruction and attachment rows, and the message counter a continued conversation needs). A fresh OpenCode 2 database has no `session` table, so 3.2.0 failed every push there with `no such table: session`. OpenCode 2 sessions travel as format 2 shards; OpenCode 1 and OpenCode 2 machines can share a repository, each importing its own kind and leaving the other's recent shards in place.
- **Imported sessions show up in `/session`.** OpenCode 2 lists only the current project's sessions, so each imported session is placed in the project OpenCode 2 uses for its folder on this machine, creating it the way OpenCode 2 would. A folder under the other machine's home folder is matched to the same folder under this one; a folder this machine does not have puts the session in the home folder's project.
- **`opencode-sync repair-sessions [--apply]`** moves sessions OpenCode 2 migrated from 1.x into the project where `/session` looks for them (the synthetic `global` project and stale project rows of the same repository hide them). Preview by default.
- **Credentials on OpenCode 2.** OpenCode 2 keeps accounts in its database and reads `auth.json` at most once (a database it creates fresh never reads it). With credential sync on, the account picked in OpenCode is written to `auth.json` before a push, and incoming accounts are applied to the database after a pull; a running OpenCode sees them on its next request. A renewed OAuth token updates the account in place, the later expiry wins a conflict, an account missing from an incoming copy never logs a machine out, and logging out on a machine removes the account from the shared copy. Change detection keeps only hashes, in `opencode-sync-credentials.json` next to the database.
- **One machine renews a shared ChatGPT login.** Refreshing an OpenAI OAuth login invalidates its old refresh token, so machines sharing one login logged each other out. With credential sync on, the scheduled job now claims `refs/leases/openai` in the sync repository (an atomic compare-and-swap on the server) and only the winner refreshes, three days before expiry; the next sync hands the new token to the others. Set `"openaiRefreshLease": false` to turn it off.
- **`cli.json`** (OpenCode 2's interface preferences) is part of the main config. Plugin entries that point into this machine's global plugins folder, which the 1.x-to-2 migration writes there, are dropped before sharing; OpenCode 2 finds those plugins without them.

### Changed
- OpenCode 2 reloads configuration by itself, so the restart hint now says a restart is needed only on OpenCode 1 or after a plugin changed.
- The database is opened with a 10-second busy timeout, because OpenCode 2's background service keeps it open.
- Repository links point to `lazyalex616/opencode-github-sync` (the account was renamed; the old links redirect).

### Fixed
- A received OpenCode 2 session is no longer exported back by the machine that received it.

## 3.2.0

### Added
Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

[English](./CHANGELOG.md)

## 3.3.0

支持 OpenCode 2。请在升级 OpenCode 2 之前或同时,把每台电脑都升到这个版本;具体步骤见 README 的**升级到 OpenCode 2**。

### 安全
- **OpenCode 2 的 `service.json` 永远不会提交。** OpenCode 2 会在配置目录里写一份(服务设置和一个密码),在状态目录里再写一份(地址、进程号和一个密码)。配置目录本身就是仓库,所以 3.2.0 会把第一份提交上去,状态目录镜像又带上了第二份。现在两份都被忽略,下次推送时会从仓库里删掉;拉取到旧版本留下的、别的电脑的那份时,本机自己的副本也不会被覆盖。锁文件、输入历史和最近文件列表(`_state/locks/`、`prompt-history.jsonl`、`frecency.jsonl`)同理改为只留在本机。这些文件仍留在仓库历史里;里面的密码只能打开那台电脑本地的后台服务。

### 新增
- **OpenCode 2 会话同步。** 会话直接从 OpenCode 2 自己的表导出和导入(`session_v2`、`session_message`、`session_part`、指令和附件数据,以及继续对话时需要的消息计数器)。全新的 OpenCode 2 数据库根本没有 `session` 表,所以 3.2.0 在那里每次推送都报 `no such table: session`。OpenCode 2 的会话用第 2 版格式保存;OpenCode 1 和 OpenCode 2 的电脑可以共用一个仓库,各自只导入自己那一类,不会删掉对方最近的会话。
- **导入的会话能在 `/session` 里看到。** OpenCode 2 只列出当前项目的会话,所以每个导入的会话都会放进本机 OpenCode 2 为那个文件夹使用的项目里,必要时按 OpenCode 2 的规则新建项目。另一台电脑用户目录下的文件夹会对应到本机用户目录下的同名文件夹;本机没有的文件夹,会话放进用户目录的项目里。
- **`opencode-sync repair-sessions [--apply]`**:把 OpenCode 2 从 1.x 迁移过来、在 `/session` 里看不到的会话移回所属项目(合成的 `global` 项目、同一仓库的旧项目记录都会让它们隐身)。默认只预览。
- **OpenCode 2 的登录凭据。** OpenCode 2 把账号存在数据库里,最多只读一次 `auth.json`(它新建的数据库一次都不读)。开启凭据同步后,推送前会把 OpenCode 里选中的账号写进 `auth.json`,拉取后再把收到的账号写进数据库,正在运行的 OpenCode 下一次请求就能用上。OAuth 令牌续期后原地更新,冲突时以到期更晚的为准;传过来的副本里缺了某个账号不会把本机登出;在某台电脑上退出登录,会从共享副本里删掉这个账号。判断哪边变了只保存哈希值,存在数据库旁边的 `opencode-sync-credentials.json` 里。
- **共用的 ChatGPT 登录只由一台电脑续期。** 刷新 OpenAI OAuth 登录会让旧的刷新令牌失效,所以共用同一个登录的电脑会互相挤掉。开启凭据同步后,定时任务会先在同步仓库里抢占 `refs/leases/openai`(在服务器上原子比较并交换),只有抢到的那台在到期前三天刷新,下一次同步再把新令牌带给其他电脑。设 `"openaiRefreshLease": false` 可以关掉。
- **`cli.json`**(OpenCode 2 的界面偏好)归入主配置一起同步。从 1.x 迁移到 2 时写进去的、指向本机全局插件文件夹的插件条目,会在共享前去掉;OpenCode 2 不靠这些条目也能找到那些插件。

### 变更
- OpenCode 2 会自动重新读取配置,所以“重启 OpenCode”的提示改为:只有 OpenCode 1 或插件变化后才需要重启。
- 打开数据库时最多等待 10 秒,因为 OpenCode 2 的后台服务会一直开着它。
- 仓库链接改为 `lazyalex616/opencode-github-sync`(账号改了名,旧链接会自动跳转)。

### 修复
- 收到的 OpenCode 2 会话,不会再被接收它的电脑原样导出推回去。

## 3.2.0

### 新增
Expand Down
Loading
Loading