docs: make Chinese README the default
CI / Native Direct Backend Artifacts (push) Has been cancelled
CI / Native Sanitizer Smoke (push) Has been cancelled
CI / Command Contract Snapshots (push) Has been cancelled
CI / Deep Native Preflight (push) Has been cancelled
CI / Deep Native Runtime Cases (1/6) (push) Has been cancelled
CI / Deep Native Runtime Cases (6/6) (push) Has been cancelled
CI / Deep Graph Build Perf (push) Has been cancelled
CI / Workspace Checks (push) Has been cancelled
CI / Conformance Suite (push) Has been cancelled
CI / Native Preflight (push) Has been cancelled
CI / Native Runtime Cases (1/2) (push) Has been cancelled
CI / Native Runtime Cases (2/2) (push) Has been cancelled
CI / Native Metadata Reports (push) Has been cancelled
CI / Graph Build Perf (push) Has been cancelled
CI / Deep Conformance Suite (push) Has been cancelled
CI / Deep Native Runtime Cases (2/6) (push) Has been cancelled
CI / Deep Native Runtime Cases (3/6) (push) Has been cancelled
CI / Deep Native Runtime Cases (4/6) (push) Has been cancelled
CI / Deep Native Runtime Cases (5/6) (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 10:19:12 +00:00
parent 5a109220d0
commit 3abfde051a
+47 -41
View File
@@ -1,22 +1,28 @@
<!-- WEHUB_ZH_README -->
> [!NOTE]
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
> [English](./README.en.md) · [原始项目](https://github.com/vercel-labs/zerolang) · [上游 README](https://github.com/vercel-labs/zerolang/blob/HEAD/README.md)
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
# Zerolang
**The programming language for agents.**
**面向智能体的编程语言。**
Zerolang is an experimental graph-native programming language where the semantic graph is the program database. Humans ask for outcomes. Agents query the graph, submit checked edits, and prove the result.
Zerolang 是一种实验性的图原生(graph-native)编程语言,语义图(semantic graph)即程序数据库。人类提出期望的结果。智能体查询图、提交经校验的编辑,并证明结果。
> **Safety warning**
> **安全警告**
>
> Zerolang is experimental. Expect breaking changes, rough edges, and security issues. Run it in isolated workspaces, not against production systems or sensitive data.
> Zerolang 处于实验阶段。可能会有破坏性变更、粗糙之处和安全问题。请在隔离的工作区中运行,不要针对生产系统或敏感数据使用。
## Start With a Request
## 从需求开始
The expected workflow is a normal conversation:
预期的工作流就是一次普通对话:
```text
build hello world for zerolang
```
The agent should use the compiler, not guess from source text:
智能体应使用编译器,而不是根据源代码文本猜测:
```sh
zero init
@@ -24,7 +30,7 @@ zero patch --op 'addMain' --op 'addCheckWrite fn="main" text="hello from zero\n"
zero run
```
The result is still reviewable as a text projection:
结果仍可作为文本投影(projection)进行审查:
```zero
pub fn main(world: World) -> Void raises {
@@ -32,11 +38,11 @@ pub fn main(world: World) -> Void raises {
}
```
That `.0` file is a projection of `zero.graph`. Humans can read it, review it, and occasionally edit it. Agents should normally keep using `zero query` and `zero patch`.
`.0` 文件是 `zero.graph` 的投影。人类可以阅读、审查它,并偶尔进行编辑。智能体通常应继续使用 `zero query` `zero patch`
## The Program Database
## 程序数据库
Traditional agent coding loops treat text as the source of truth:
传统的智能体编码循环将文本视为单一事实来源:
```mermaid
flowchart LR
@@ -47,7 +53,7 @@ flowchart LR
E --> A
```
Zerolang moves the agent closer to the compiler:
Zerolang 让智能体更贴近编译器:
```mermaid
flowchart LR
@@ -58,19 +64,19 @@ flowchart LR
D --> E[human reviews projection when useful]
```
The graph gives agents explicit handles: symbols, node IDs, graph hashes, types, effects, ownership facts, capabilities, imports, call edges, and target facts. Edits can target semantic structure instead of line ranges. Stale graph hashes, unexpected field values, invalid shapes, and type errors fail before the store is written.
图为智能体提供显式句柄:符号、节点 ID、图哈希(graph hash)、类型、效应(effects)、所有权事实、能力、导入、调用边和目标事实。编辑可以针对语义结构而非行范围。陈旧的图哈希、意外的字段值、无效的形状和类型错误会在写入存储之前失败。
## What Exists Today
## 目前已有的内容
- `zero.graph` is the checked compiler input for graph-first packages.
- `.0` files are human-readable projections, not the normal agent authoring surface.
- `zero patch` applies checked graph edits and rejects stale or invalid changes.
- `zero query`, `zero inspect`, `zero check`, `zero test`, and `zero run` expose compiler facts through agent-friendly commands.
- `zero import` and `zero export` make the projection boundary explicit, so human text edits do not silently diverge from the graph.
- `zero.graph` 是图优先包的经校验编译器输入。
- `.0` 文件是人类可读的投影,而非智能体常规的编写界面。
- `zero patch` 应用经校验的图编辑,并拒绝陈旧或无效的变更。
- `zero query``zero inspect``zero check``zero test` `zero run` 通过面向智能体的命令暴露编译器事实。
- `zero import` `zero export` 明确投影边界,避免人类文本编辑与图悄然偏离。
## Install
## 安装
Install the compiler:
安装编译器:
```sh
curl -fsSL https://zerolang.ai/install.sh | bash
@@ -78,13 +84,13 @@ export PATH="$HOME/.zero/bin:$PATH"
zero --version
```
Install the agent bootstrap skill:
安装智能体引导技能:
```sh
npx skills add vercel-labs/zerolang
```
The compiler bundles version-matched skills for agents:
编译器为智能体打包了版本匹配的技能:
```sh
zero skills
@@ -94,9 +100,9 @@ zero skills get language
zero skills get stdlib
```
## Daily Loop
## 日常流程
For most package work:
对于大多数包级工作:
```sh
zero query
@@ -107,36 +113,36 @@ zero test
zero run -- <args>
```
The default input is the current directory. Use `.` only when you want to be explicit.
默认输入为当前目录。仅在你需要明确指定时使用 `.`
When a human wants to review projection text:
当人类需要审查投影文本时:
```sh
zero export
zero verify-projection
```
When a human intentionally edits a projection:
当人类有意编辑投影时:
```sh
zero import
zero check
```
## Runtime Goals
## 运行时目标
The graph-first model should reduce agent guessing without relaxing the runtime goals:
图优先(graph-first)模型应在不放松运行时目标的前提下减少智能体的猜测:
- Token-efficient inspection
- Low memory usage
- Fast startup and builds
- Low runtime latency
- Explicit capabilities
- Small, dependency-free artifacts
- Token 高效检查
- 低内存占用
- 快速启动与构建
- 低运行时延迟
- 显式能力(capabilities
- 小巧、无依赖的产物
## Developing Zerolang
## 开发 Zerolang
Build the local compiler:
构建本地编译器:
```sh
pnpm install
@@ -144,7 +150,7 @@ make -C native/zero-c
bin/zero --version
```
Useful checks:
有用的检查:
```sh
pnpm run docs:build
@@ -153,7 +159,7 @@ pnpm run native:test
pnpm run command-contracts
```
For local iteration:
本地迭代:
```sh
pnpm run conformance:local -- --list
@@ -161,4 +167,4 @@ pnpm run conformance:local -- --shard 1/4
pnpm run command-contracts:local
```
Read the docs at [zerolang.ai](https://zerolang.ai).
文档请见 [zerolang.ai](https://zerolang.ai).