DESIGN.md@adapters/zcode/official_bridgeA
DESIGN.md@adapters/zcode/official_bridge from freehul/sgme is a DESIGN.md file: the design rules coding agents follow in that repo.
mdr add freehul/sgme/adapters/zcode/official_bridge/DESIGN.md@git:20261103.dcaf14aPins git:20261103.dcaf14a in mdr.lock. Pin the fingerprint instead.
- Audit grade
- A, 14 of 14 checks passed
- Kind
- DESIGN.md file
- Repository
- freehul/sgme
- Path
adapters/zcode/official_bridge/DESIGN.md- Versions recorded
- 1
- Latest version
- git:20261103.dcaf14a, committed Nov 3, 2026
- Size
- 3,407 bytes
- Repository stars
- 15
- License
- MIT
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# 设计说明:ZCode 官方通道桥(official_bridge)
## 1. 为什么需要它
- ZCode PC 端的赠送额度(Start Plan / ZCODE GLOBAL BUILD)**不是普通 API Key**:端点 `https://zcode.z.ai/api/v1/zcode-plan/anthropic` 要求账户 JWT + **V4 客户端请求签名**,并且会校验请求体是否被代理改写;第三方网关(magpie 等)改 body 后会被风控 405/3012。
- 官方 CLI(`zcode.cjs`)在进程内完成 OAuth/JWT、签名与请求构造,是唯一合规且可自动化的通道。
- SGME 的提炼/重建只支持 OpenAI 兼容供应商,因此需要一层“官方 CLI ↔ OpenAI”桥。
## 2. 架构
```
SGME ──HTTP──▶ bridge.py (127.0.0.1:8899/v1/chat/completions)
│ 每个请求:prompt 写入临时文件
▼
node zcode.cjs -p <短指令> --attach prompt.txt
--cwd <隔离目录> --mode plan --surface terminal
│ 官方 CLI 内部完成签名/风控合规
▼
ZCode 官方端点(Start Plan / Coding Plan)
```
- 桥不保存凭据、不读取 CLI 的 `config.json`;身份完全由官方 CLI 的登录态决定。
- 并发用信号量(默认 2);单次调用超时、429/3012/MCP 错误分别归类并映射为 HTTP 429/502。
## 3. 身份模型(关键)
| 套餐 | 凭据形态 | 能否直连 | 桥怎么用 |
|---|---|---|---|
| ZCode Coding Plan | API Key(`id.secret`) | 可以(标准 Anthropic 端点) | 可直接用 SGME 的 openai_compat,不需要本桥 |
| ZCode Start Plan(赠送额度) | 账户 JWT + V4 签名 | 不可以 | 必须让 CLI 以**同一账号**登录(`zcode login bigmodel` / `zai`),由 CLI 签名 |
实践要点:
- 登录用错账号(例如登成另一个只有 coding-plan 的账号)会得到 `429/1113 无资源包`;
…Read the whole file at its exact version.
How to install
mdr add freehul/sgme/adapters/zcode/official_bridge/DESIGN.md@sha256:4bf3727b46546fa9The line at the top of this page pins the label git:20261103.dcaf14a, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
[](https://markdownregistry.com/a/art_vwlnztqxyonh3z3t)
1 badge image fetches in 30 days. What the badge shows.
Versions
The registry has recorded 1 version of this file, committed on Nov 3, 2026.
Audit of the latest version
- pass: Size between 200 bytes and 200 KB (3407 bytes)
- pass: No zero-width or bidi control characters
- pass: No instruction hidden inside an HTML comment
- pass: No link to an exfiltration or paste host
- pass: No credential-shaped string
- pass: No instruction to send local credentials anywhere
- pass: No text hidden with inline styles
- pass: No prompt-injection phrasing
- pass: No curl or wget piped into a shell
- pass: No recursive delete of root, home or parent
- pass: No instruction to read or print local credentials
- pass: No base64 blob over 200 characters
- pass: No link to a raw IP address
- pass: No script tag
Source
freehul/sgme · 15 stars · license MIT · pushed 2026-11-06 · branch main
API
GET https://markdownregistry.com/api/v1/artifacts/art_vwlnztqxyonh3z3t GET https://markdownregistry.com/api/v1/resolve?ref=freehul/sgme/adapters/zcode/official_bridge/DESIGN.md GET https://markdownregistry.com/api/v1/blob/4bf3727b46546fa9d8c7ea2a3f47c799becf143c57e4afa950228a508bb880fa
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
Guides: what DESIGN.md is and how agents use it · which agent file does what.