schemas
目录定位
schemas/ 是认知引擎的数据契约包,属于 contract_core 背后的公共契约支撑面之一。
它与 behavior_contracts/、config_contexts/ 平行:
behavior_contracts = 行为契约
schemas = 数据契约
config_contexts = 配置上下文契约
本包负责定义跨模块传输所需的公共数据结构、字段边界、校验规则与序列化语义,用于约束 runtime、composition、observability、adapter、workflow 等模块之间传递的数据形状。
本包回答的问题是:
模块之间传递的数据长什么样、哪些字段有效、哪些字段必填、如何校验、如何序列化,以及如何防止裸 dict 在模块边界扩散。
本包不是行为契约层,也不是配置上下文契约层,更不是实现层。
behavior_contracts = 行为能力接口与边界
schemas = 公共数据结构与序列化边界
config_contexts = 配置上下文契约与 Config View
职责边界
本包负责:
- 定义跨模块公共数据模型。
- 定义跨模块 DTO、事件对象、结果对象、引用对象与错误对象。
- 定义字段类型、默认值、枚举范围与结构校验规则。
- 定义 JSON 序列化与反序列化边界。
- 为 behavior_contracts、config_contexts、runtime、composition、observability、adapter、workflow 等模块提供稳定数据契约。
- 作为
contract_core公共契约支撑面的一部分,被上层通过契约窗口理解和复用。
本包不负责:
- 不负责行为能力接口定义。
- 不负责配置事实来源。
- 不负责配置装配。
- 不负责配置消费上下文契约。
- 不负责业务执行逻辑。
- 不负责 IO、存储、外部 SDK 调用。
- 不负责系统装配。
- 不作为 observability_hub 内部候选模型的替代层。
与其他层的关系
与 contract_core 的关系
contract_core/是公共契约入口。schemas/是contract_core背后的正式契约支撑面之一。- 后续对外表达时,应把
schemas/归入公共契约支撑面,而不是归入历史遗留、独立主入口或实现侧能力目录。
与 behavior_contracts 的关系
behavior_contracts/负责行为能力契约。schemas/负责跨模块数据契约。- 二者同属公共契约支撑面,分别回答“能做什么”和“传递什么数据”。
- 行为契约需要引用数据对象时,应以明确业务接口方式引用
schemas/中已经稳定的数据模型,不得自造重复数据结构。
与 config_contexts 的关系
config_contexts/负责配置上下文契约与 Config View。schemas/负责普通跨模块业务数据、运行数据、事件数据、结果数据与引用数据。- 配置上下文对象默认归属
config_contexts/,不应混入普通业务数据契约。
与 config_assembly 的关系
config_assembly/负责从config/配置事实装配标准配置载荷。schemas/不读取config/,不执行配置装配。- 如需定义配置载荷的通用数据形状,应由
config_assembly与config_contexts明确边界后再判断是否沉淀到schemas/。
与 observability_hub 的关系
observability_hub/当前负责从RuntimeResult构建内部候选观察记录。EvidenceBundle当前仍是observability_hub内部候选模型,不是schemas/当前公共契约。- 如果后续
EvidenceBundle、RunRecord、EventTrace、ArtifactManifest等对象被多个模块稳定消费,再评估是否上升为schemas/公共数据契约。
硬性规则
- 跨模块传输不得依赖未声明结构的裸 dict。
- 进入公共模块边界的数据,应优先使用
schemas/中定义的数据模型。 schemas/不得依赖任何实现包。schemas/不得读取配置文件、环境变量或外部系统。schemas/不得承接业务执行逻辑。- 新增公共数据模型时,必须说明其消费方、生产方与稳定性边界。
- 修改公共数据模型时,必须同步评估 behavior_contracts、config_contexts、contract_core、runtime、composition、observability 与相关 adapter 的影响。
- 模块内部候选模型不得因为名称相似而直接搬入
schemas/;必须先通过真实链路与跨模块消费验证。
当前适合承接的内容
本包当前适合承接已经稳定的公共数据契约,例如:
- WorkflowInput
- WorkflowResult
- RuntimeInput
- RuntimeResult
- RuntimeEvent
- ArtifactDelta
- InvocationRef
- ErrorRecord
- SourceRef
以下内容当前不应直接作为已稳定公共契约宣传:
- EvidenceBundle
- RunRecord
- EventTrace
- ArtifactManifest
- InvocationBindingRecord
- 旧控制面记录组合相关对象
这些对象如需进入公共契约层,应在后续经过真实链路验证、跨模块消费确认和公共契约上升评估。
发布面口径
在 v0.5.0 单一发布面表达中,schemas/ 应归入:
v0.5.0 正式支撑面 / 公共契约支撑面
不应归入:
历史遗留资产
独立主入口
实现层
observability 内部候选模型层
一句话收口
schemas/ 是认知引擎的公共数据契约包,用于在 Python 环境中补齐类似 Rust struct / enum 所承载的数据边界能力,使跨模块数据传输依赖稳定公共模型,而不是裸 dict 与隐式字段约定。
Metadata
Release files for cognition-engine-schemas 0.5.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cognition_engine_schemas-0.5.4.tar.gz | 4.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cognition_engine_schemas-0.5.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.2 kB
Release files / cognition_engine_schemas-0.5.4.tar.gz
| Download URL | cognition_engine_schemas-0.5.4.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
255d833b8de3200d67ddacf3a6952104875b856e485a52f7d6ac6313378e5657
|
|
BLAKE2b-256 checksum How to use checksums |
7c82a5bde393cc933b1c07cb4f3f0daf56d4707659d8100f1c8ee2e8c78e3a62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 5, 2026.
Transparency logRelease files / cognition_engine_schemas-0.5.4-py3-none-any.whl
| Download URL | cognition_engine_schemas-0.5.4-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97c2e2f9db192787244c2277dfb3418e2eb6889228365f957caa0282c5eea163
|
|
BLAKE2b-256 checksum How to use checksums |
98cd61584e8b382311a9fb6042db3c08dc1d0e2f6f416a244aea7caac9dc4516
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 5, 2026.
Transparency logSecurity for cognition-engine-schemas 0.5.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for cognition_engine_schemas-0.5.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.