Add strict custom field registry

This commit is contained in:
2026-05-07 11:04:11 +08:00
parent 27e71d8c51
commit c1cc9132a4
20 changed files with 582 additions and 20 deletions

View File

@@ -13,6 +13,7 @@ README 面向准备使用 GSP 语言的人类和 AI。它说明 GSP 的用途、
| `README.md` | GSP 语言使用前说明。给人类和 AI 阅读。 |
| `gsp.schema.json` | GSP 第一版核心字段规范。使用 JSON Schema 表达,便于 AI、工具、编译器和实现模块识别。 |
| `gsp.manifest.schema.json` | GSP 工程 manifest 字段规范。 |
| `gsp.fields.schema.json` | GSP 工程自定义字段注册规范。 |
| `gsp.message.schema.json` | GSP agent 通信消息字段规范。 |
| `commands.md` | GSP Toolkit 命令规范。 |
| `ai-usage.md` | GSP 项目 AI 使用规则。 |
@@ -38,6 +39,46 @@ GSP 是一种游戏规格协议,不是具体游戏引擎、代码框架或资
GSP 不预设抽象和实体的硬边界。所有对象都先被视为 GSP再由 `title``context``resolution``with``refines` 和当前任务共同解释。
## 自定义字段
GSP 项目默认使用严格自定义字段策略。
```yaml
customFieldPolicy: strict
fieldRegistry: gsp.fields
```
非内置字段必须在 `gsp.fields` 中声明。
```yaml
gspFieldsVersion: 0.1
fields:
rewardTier:
type: string
allowed:
- common
- rare
- epic
scope:
type:
- mechanic
- feedback
```
支持类型:
```text
string
number
integer
boolean
array
object
```
未声明字段在 `strict` 模式下是 error。
## GSP 用来做什么
GSP 的核心作用是高效传递设计信息。