feat(opencode): 支持旧版协议向后兼容 - #29
Merged
Merged
Conversation
Reviewer's Guide本 PR 引入基于实际协议证据的 OpenCode current/legacy profile 体系,新增 v2 2.0.0 与 v1 1.16/1.17 的安全向后兼容;profile 身份贯穿能力探测、适配、迁移 manifest、删除与回滚校验,并配套旧版启动回退、真实 fixture、CI 回归和文档更新。 Sequence diagram for protocol profile detection and migrationsequenceDiagram
participant CLI
participant Probe as CapabilityProbe
participant Server as OpenCodeServer
participant Adapter as ProfileAdapter
participant Migration
participant Manifest
CLI->>Probe: probeOpenCodeCapabilities()
Probe->>Server: GET version and OpenAPI evidence
Probe->>Probe: Match route, envelope, schema and protocolRule
Probe-->>CLI: capabilities(protocolRule, protocolHash, schemaHash)
CLI->>Migration: buildMigrationPlan(protocolRule)
Migration->>Adapter: importSession()
Adapter->>Server: Profile-specific import route or CLI import
Server-->>Adapter: imported session
Adapter->>Server: Profile-specific export/readback
Server-->>Adapter: exported session
Adapter->>Adapter: Reconcile and validate deletion contract
Migration->>Manifest: Persist protocolRule and protocolHash
Manifest-->>Migration: Resume and rollback require matching profile
Sequence diagram for legacy v2 managed-server startup fallbacksequenceDiagram
participant Migrator
participant Binary as OpenCode2_0_0
participant Descriptor as ServiceDescriptor
participant Health as LegacyHealthEndpoint
Migrator->>Descriptor: Discover managed service
Descriptor-->>Migrator: Descriptor unavailable
Migrator->>Binary: serve --hostname 127.0.0.1 --port
Binary-->>Migrator: Loopback URL and process output
Migrator->>Health: GET /api/health with authorization
Health-->>Migrator: healthy=true, version=2.0.0
Migrator-->>Migrator: Use managed server and clean up process/state
Flow diagram for safe legacy-version admissionflowchart TD
Start[Inspect OpenCode binary and server]
Candidates[Select same-major profile candidates]
Evidence[Match actual routes, envelope and schema]
Boundary{安全契约满足?}
Isolated[Run isolated import/export roundtrip]
Checks[Verify readback, conflicts, parent-child relations, deletion and rollback]
Admit[Admit migration with protocolRule and protocolHash]
Reject[Reject without writing target]
Start --> Candidates --> Evidence --> Boundary
Boundary -- 否 --> Reject
Boundary -- 是 --> Isolated --> Checks
Checks -- 通过 --> Admit
Checks -- 失败 --> Reject
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Merged
yororoA
added a commit
that referenced
this pull request
Sep 29, 2026
此 PR 由 release-please 自动维护。合并后将创建对应 tag 与 GitHub Release。 --- ## [1.3.0](v1.2.0...v1.3.0) (2026-09-29) ### Added * **opencode:** 支持旧版协议profile迁移 ([be5d537](be5d537)) * **opencode:** 支持旧版协议向后兼容 ([#29](#29)) ([4da31d0](4da31d0)) ### Fixed * **opencode:** 使用目标平台规则解析POSIX启动器 ([357582a](357582a)) ### Documentation * **opencode:** 说明旧协议支持与拒绝边界 ([ff8c8ca](ff8c8ca)) --- 版本号、Changelog 和网站版本由 release-please 统一更新,请勿手工修改。 ## Summary by Sourcery Release version 1.3.0 with legacy protocol compatibility, migration support, and improved launcher handling. New Features: - Add migration and backward compatibility support for legacy OpenCode protocol profiles. Bug Fixes: - Correct POSIX launcher parsing to follow target-platform rules. Build: - Update the package release metadata to version 1.3.0. Documentation: - Document legacy protocol support and its rejection boundaries. Chores: - Synchronize the changelog, package lockfile, release manifest, and website version metadata for the 1.3.0 release.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
protocolRule与protocolHash,避免同方言不同 profile 被混用,同时兼容已有 manifest。安全边界
opencode-ai@1.15.x缺少 Session metadata,无法保留迁移所有权证据,继续拒绝。opencode-ai@1.14.x未暴露完整会话 schema,继续拒绝。验证
CI: https://github.com/yororoA/Trae2OpenCode/actions/runs/36517960124
Summary by Sourcery
Support safely migrating sessions to legacy OpenCode protocol profiles by selecting adapters from verified routes and schemas rather than relying solely on major versions.
New Features:
Bug Fixes:
Enhancements:
CI:
Documentation:
Tests:
Chores: