Repository navigation
lane: CodeArts 渠道改为原生移植,拆掉 v1.7.17 的内嵌服务 - #90
Merged
Merged
Conversation
Huawei Cloud CodeArts Agent's free tier arrives as a fourth lane channel, built on a port of codearts2api's protocol (MIT) rather than its process. The v1.7.17 hub kept the whole upstream binary in-repo (HTTP server, account pool, its own scheduler, a second OAuth panel on :8096); what zen-gate needs is only the wire language — the login round-trip, the account lifecycle and the model catalog all belong to the lane, the same way the WorkBuddy and Kilo sources work. - internal/codearts/upstream + auth: the signer (SDK-HMAC-SHA256 over all headers), DPoP (ES256), OAuth PKCE + ticket-poll fallback, the chat stream, model/benefit discovery and the credit check-in. Its own test suite ships and runs with it. The server/pool/scheduler/panel are gone; internal/codeartshub is deleted. - lane CAAccount is one persisted account (STS triple + the refresh binding), the WorkBuddy contract: refresh before expiry, one 401 refresh-and-retry per turn, single-flight under caMu — a double refresh on the DPoP-bound rotation locks the account out, so every exchange holds the lock. - ChannelCodeArts joins the catalog machinery: account-gated live discovery (a rotating benefit roster cannot be a static table), a fingerprint-free chat post keyed by a stable per-conversation Chat-Id, its own probe, and benefit models ride the maas_type header discovery proved they need. - The dashboard card mirrors WorkBuddy's: 授权登录 opens the Huawei portal in the DEFAULT browser — the loopback callback races the ticket poll inside the lane — with model badges, and the enable switch persists through its own dirty-key branch. Masked() hides all five secret fields plus the DPoP key. - The daily credit check-in rides main's loop like WorkBuddy's activity claim. Tests: 8 lane cases (ticket login, both refresh paths with the chat-affinity headers, the benefit header, expiry round-trip, error shapes), settings persistence, and store masking/clone. go vet + go test ./... green.
The v1.7.17 provider-tracking probe tested symbols the native port removes; its settings half is replaced by codearts_settings_test.go and its account-state half by the lane CAAccount tests.
This was referenced Oct 17, 2026
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.
按反馈重做 #82:不是把 codearts2api 整个嵌进来跑一个 HTTP 服务,而是只把它的协议移植进 zen-gate 自己的渠道体系——和 WorkBuddy / Kilo 同一种原生渠道。
拆掉的(v1.7.17 / #82 的内嵌方案)
internal/codeartshub/整棵树删除:HTTP server、账号池、独立调度器、panel.html、:8096 上的第二套 OAuth 登录。保留并移植的(协议层)
internal/codearts/upstream+auth(它自带的测试套件一并保留、照常跑):华为云 SDK-HMAC-SHA256 签名、DPoP(ES256,refresh 与密钥绑定的根源)、OAuth PKCE + ticket 轮询双通道、/api/v2/chat/completionsSSE、三路模型发现(agent-center / builtin / 限时福利)与maas_type路由、每日签到积分领取。CAAccount:一个落盘账号(STS 三元组 + refresh 绑定),WorkBuddy 同款契约——临近过期先续、401 刷新重试一次、caMu单飞(DPoP 绑定的轮换不允许并发 refresh,否则锁死账号)。ChannelCodeArts进目录机制:账号门控的在线发现(福利套餐是轮换的,做不了静态表)、无指纹的 chat post 带会话稳定的 Chat-Id、独立探测、福利模型自动带maas_type: benefit。Masked()掩掉全部 5 个机密字段 + DPoP 密钥、每日签到挂在 main 的小时循环上。测试
lane 8 例(httptest 全链路:ticket 登录、近过期先续、401 刷新重试 + Chat-Id/Session-Id 亲和、福利头、过期解析、错误分类)+ gateway 开关持久化 + store 掩码/深拷贝。
go vet+go test ./...全绿。注意:本 PR 取代 v1.7.17(那个 release 的渠道实际没法登录——hub 启动时从磁盘读账号文件,卡片按钮只是链到它自己的 panel)。合并后我会发 v1.7.18 并在公告里说明升级路径。