> For the complete documentation index, see [llms.txt](https://eurekabusiness.caiziii.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eurekabusiness.caiziii.com/mo-kuai-can-kao/architecture-contracts.md).

# 架构与设计契约

本文档面向附属模组作者，也适合需要排查整合包依赖的维护者。

## 模块关系

```
Core
 ├── Retail
 └── Restaurant
```

依赖方向固定为 `Core <- Retail` 与 `Core <- Restaurant`。Retail 与 Restaurant 互不依赖。

## Core

Core 提供稳定的公共契约、数据模型、注册生命周期、权限与持久化边界，以及通用 NPC、Worker 和 Work Order 扩展契约。Core 不依赖 Retail、Restaurant、客户端类或可选第三方模组。

## Retail

Retail 负责店铺、陈列基座、商品目录、定价、顾客购买、零售工作订单、交易记录和零售内容注册。Retail 可以消费 Core 的元素和顾客变体契约，但不能把零售规则写回 Core。

## Restaurant

Restaurant 是可选的餐饮内容模块，负责菜单、餐饮方块、餐饮订单和基于 Core 契约的餐厅任务扩展。Restaurant 不是 Retail 的依赖。

## 侧隔离

* `Common` 代码不能引用客户端专属类。
* 客户端负责呈现和输入，服务端负责店铺、权限、库存、价格、结算和持久化。
* 附属模组的服务端入口不得加载客户端渲染、Screen 或 HUD 类。
* 任何客户端请求都必须在服务端重新校验目标、距离、权限、库存、价格和完整物品数据。

## 注册生命周期

Core 与内容模块的公共扩展使用启动期注册器。注册窗口关闭后，注册表变成只读快照。附属模组应在注册生命周期提供的窗口内注册，不要在实体 tick、Screen 打开或交易回调中改变注册表。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://eurekabusiness.caiziii.com/mo-kuai-can-kao/architecture-contracts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
