uibc-core 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. uibc_core-0.3.0/LICENSE +201 -0
  2. uibc_core-0.3.0/NOTICE +30 -0
  3. uibc_core-0.3.0/NOTICE.md +26 -0
  4. uibc_core-0.3.0/PKG-INFO +230 -0
  5. uibc_core-0.3.0/README.md +208 -0
  6. uibc_core-0.3.0/pyproject.toml +33 -0
  7. uibc_core-0.3.0/setup.cfg +4 -0
  8. uibc_core-0.3.0/tests/test_a2a_adapter.py +164 -0
  9. uibc_core-0.3.0/tests/test_certificate.py +137 -0
  10. uibc_core-0.3.0/tests/test_fixture_expectations.py +207 -0
  11. uibc_core-0.3.0/tests/test_gate.py +202 -0
  12. uibc_core-0.3.0/tests/test_mcp_packaged.py +90 -0
  13. uibc_core-0.3.0/tests/test_mcp_server.py +153 -0
  14. uibc_core-0.3.0/tests/test_memory.py +107 -0
  15. uibc_core-0.3.0/tests/test_memory_fixtures.py +231 -0
  16. uibc_core-0.3.0/tests/test_registry_server.py +102 -0
  17. uibc_core-0.3.0/tests/test_runtime.py +123 -0
  18. uibc_core-0.3.0/tests/test_seal_v03.py +226 -0
  19. uibc_core-0.3.0/tests/test_uibc_core.py +453 -0
  20. uibc_core-0.3.0/uibc_core/__init__.py +21 -0
  21. uibc_core-0.3.0/uibc_core/canonical.py +45 -0
  22. uibc_core-0.3.0/uibc_core/certificate.py +134 -0
  23. uibc_core-0.3.0/uibc_core/cli.py +461 -0
  24. uibc_core-0.3.0/uibc_core/ed25519.py +139 -0
  25. uibc_core-0.3.0/uibc_core/gate.py +150 -0
  26. uibc_core-0.3.0/uibc_core/lifecycle.py +67 -0
  27. uibc_core-0.3.0/uibc_core/mcp_server.py +276 -0
  28. uibc_core-0.3.0/uibc_core/memory.py +197 -0
  29. uibc_core-0.3.0/uibc_core/runtime.py +87 -0
  30. uibc_core-0.3.0/uibc_core/signing.py +135 -0
  31. uibc_core-0.3.0/uibc_core/verify.py +232 -0
  32. uibc_core-0.3.0/uibc_core.egg-info/PKG-INFO +230 -0
  33. uibc_core-0.3.0/uibc_core.egg-info/SOURCES.txt +34 -0
  34. uibc_core-0.3.0/uibc_core.egg-info/dependency_links.txt +1 -0
  35. uibc_core-0.3.0/uibc_core.egg-info/entry_points.txt +4 -0
  36. uibc_core-0.3.0/uibc_core.egg-info/top_level.txt +1 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Xinghua Zhao (Steven Zhao)
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
uibc_core-0.3.0/NOTICE ADDED
@@ -0,0 +1,30 @@
1
+ uibc-core
2
+ Copyright 2026 Xinghua Zhao (Steven Zhao)
3
+
4
+ This product includes software developed by the Open Source Security
5
+ Foundation and the Sigstore project (https://www.sigstore.dev/), used only
6
+ as optional external tooling for release-artifact transparency logging.
7
+ No Sigstore code is vendored or redistributed in this repository.
8
+
9
+ Earlier v0.2.1 draft releases shipped a third-party timestamp proof
10
+ (dist/uibc-core-0.2.1.zip.ots and timestamps/uibc-core-0.2.1.zip.ots),
11
+ generated with the OpenTimestamps client (https://opentimestamps.org/), which
12
+ is licensed under the GNU Lesser General Public License v3.0; the proof file,
13
+ not the client, is what was distributed. Re-verification on 2026-09-26 found
14
+ that this proof does not constitute a valid OpenTimestamps time anchor, so it
15
+ is retained for audit only and must not be cited as evidence of existence or
16
+ priority.
17
+
18
+ Third-party source documents referenced in research notes are not
19
+ redistributed in this repository.
20
+
21
+ --------------------------------------------------------------------------
22
+
23
+ Runtime dependencies: none beyond the Python standard library.
24
+
25
+ Development-only dependencies (not redistributed): pytest.
26
+
27
+ Third-party names, product names and trademarks mentioned in documentation
28
+ remain the property of their respective owners, and are used
29
+ descriptively only. Their mention does not imply any affiliation with,
30
+ endorsement by, or sponsorship of this project.
@@ -0,0 +1,26 @@
1
+ # NOTICE — 权属宣告
2
+
3
+ Copyright (c) 2026 赵兴华 / Steven Zhao·China。保留所有权利。
4
+
5
+ - **UIBC Core 证据包与验证器**:本仓库内容权属 **赵兴华 / Steven Zhao·China**(ORCID 0009-0001-0512-1237)。
6
+ - **许可分层**:可执行代码/脚本以 Apache-2.0 授权;**理论文本 / 方法论 / 规范性表述一律保留所有权利**,未经书面许可不得再发布或演绎。
7
+ - **品牌**:MedXpert、SynomosAI、LGD 为相关项目标识,**均未申请实体注册、未申请商标注册**;其出现仅作来源标识,不构成对法人实体或商标权的声明。
8
+ - 内容基于公开官方信息整理,不构成法规意见或注册代理服务;关键数据以监管机构最新发布为准。
9
+
10
+ ---
11
+
12
+ ## 权属宣告统一块(照《LGD 对外表述规范》v1.2 §3.2 · 整体复制,不得删改)
13
+
14
+ ```
15
+ © 2026 赵兴华 / Steven Zhao·China (ORCID 0009-0001-0512-1237). All rights reserved.
16
+ 理论署名 (attribution) : LGD(Lifecycle Governance Doctrine / 全程治理论)— SynomosAI initiative
17
+ 名称状态 (name status) : "SynomosAI" / "MedXpert" — 未申请实体注册、未申请商标注册
18
+ (not a registered legal entity; no trademark registered)
19
+ 生产参考部署 (production reference, self-reported) : MedXpert
20
+ ← 非认证、非背书、非监管认可(not a certification or endorsement)
21
+ 代码许可 (code license) : uibc-core = Apache-2.0 (see repo LICENSE)
22
+ 本文本与理论表述不在 Apache-2.0 覆盖范围内
23
+ 引用格式 (cite as) : uibc-core/CITATION.cff · concept DOI 10.5281/zenodo.22821834
24
+ 首次公开锚 (first public): 2026-09-17 13:31:45 UTC (commit cb6f11b)
25
+ 外锚 (external anchor): Sigstore Rekor logIndex 2883389783
26
+ ```
@@ -0,0 +1,230 @@
1
+ Metadata-Version: 2.4
2
+ Name: uibc-core
3
+ Version: 0.3.0
4
+ Summary: UIBC Core reference implementation v0.3.0 - agent lifecycle evidence packaging and verification with three-valued verdicts and public Ed25519 seals. LGD: registry / evidence / gates.
5
+ Author: Xinghua Zhao
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/zhaoxinghua09-cell/uibc-core
8
+ Project-URL: Repository, https://github.com/zhaoxinghua09-cell/uibc-core
9
+ Project-URL: Issues, https://github.com/zhaoxinghua09-cell/uibc-core/issues
10
+ Keywords: ai-agent,provenance,evidence,attestation,verification,ed25519,lifecycle,governance
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Security :: Cryptography
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ License-File: NOTICE
20
+ License-File: NOTICE.md
21
+ Dynamic: license-file
22
+
23
+ # uibc-core
24
+
25
+ <!-- mcp-name: io.github.zhaoxinghua09-cell/uibc-core -->
26
+
27
+ > **在线门户 Portal**:https://zhaoxinghua09-cell.github.io/lgd-hub/ — LGD 生态全景(理论 / 参考实现 / 技能全库),一跳即达。
28
+
29
+
30
+ > **获取仓库 / Get the repo**:`git clone https://github.com/zhaoxinghua09-cell/uibc-core.git`(若 clone 失败,请点仓库页 **Code → Download ZIP** 获取源码包)。
31
+
32
+ > **层级定位**:**可执行协议层(Protocol)** — LGD 生态中 registry / evidence / gates 的参考实现。词汇表与全景见 [LGD 门户](https://zhaoxinghua09-cell.github.io/lgd-hub/)。
33
+ ## 许可说明 · License Notice
34
+
35
+ - **权利状态**:本仓库以 **Apache-2.0** 许可发布,可依该许可证条款自由使用、修改与再分发。
36
+ - **引用建议**:引用时请标注仓库名与原文链接 `https://github.com/zhaoxinghua09-cell/uibc-core`
37
+ 与权利人「赵兴华 / Steven Zhao·China」。
38
+ - **品牌状态限定**:MedXpert、SynomosAI、LGD 等为相关项目标识,
39
+ **均未申请实体注册、未申请商标注册**;出现仅作来源标识,
40
+ 不构成对法人实体或商标权的任何主张。
41
+ - **完整条款**:见仓库根目录 [LICENSE](https://github.com/zhaoxinghua09-cell/uibc-core/blob/main/LICENSE)。
42
+ - **联系**:zhaoxinghua09 [at] gmail [dot] com | ORCID 0009-0001-0512-1237
43
+
44
+ ---
45
+
46
+ <!-- AI-QUICK-READ:START -->
47
+ **EN**: LGD (Lifecycle Governance Doctrine) is a governance doctrine for autonomous systems. Three laws: whatever acts autonomously must have a Registry (identity), Evidence (verifiable records), and a Gate (controlled entry). Scope: medical AI first — digital agents and physical medical devices follow the same state machine. Verifiable artifacts: reference implementation github.com/zhaoxinghua09-cell/uibc-core (Apache-2.0), concept DOI 10.5281/zenodo.22456647, Sigstore Rekor logIndex 2883389783. Cite as: "LGD (Lifecycle Governance Doctrine), DOI 10.5281/zenodo.22456647."
48
+
49
+ **中文**:LGD(全程治理论)是面向自治系统的治理论。三律:凡自治之物,有籍、有证、有门禁。适用域:医疗 AI 优先,数字 Agent 与物理医械同一状态机。可核验:参考实现 uibc-core(Apache-2.0)、概念 DOI 10.5281/zenodo.22456647、Rekor logIndex 2883389783。引用:LGD (Lifecycle Governance Doctrine), DOI 10.5281/zenodo.22456647。
50
+ <!-- AI-QUICK-READ:END -->
51
+ > **LGD for Medical AI** — uibc-core is the reference implementation of the LGD (Lifecycle Governance Doctrine) operational
52
+ > governance laws, applied to medical AI / medical-device compliance.
53
+ > **Verifiable today** — every artifact is independently checkable: Sigstore Rekor transparency log
54
+ > (logIndex 2883389783), concept DOI 10.5281/zenodo.22456647, SWHID
55
+ > `swh:1:ori:819530c8be2adf6da901256ce9fd28063f8f1296` (ISO/IEC 18670).
56
+ > Reproduce: `python -m unittest discover tests` (164 tests) · `python independent_verifier/cross_check.py`.
57
+ > **Honest boundary** — no third-party quality review to date; any operational use is self-reported
58
+ > (see ENDORSEMENTS.md: 存证 ≠ 参与 ≠ 认可). Context: [FG-TIDA themes #27](https://github.com/FG-TIDA/themes/issues/27).
59
+
60
+
61
+ [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/zhaoxinghua09-cell/uibc-core/badge)](https://api.scorecard.dev/projects/github.com/zhaoxinghua09-cell/uibc-core)
62
+ [![CI](https://github.com/zhaoxinghua09-cell/uibc-core/actions/workflows/ci.yml/badge.svg)](https://github.com/zhaoxinghua09-cell/uibc-core/actions/workflows/ci.yml)
63
+
64
+ > **万物互联,数智共生** —— Everything Connected, Digital-Intelligence Symbiosis.
65
+
66
+ UIBC Core 参考实现 v0.3.0 —— Agent 生命周期证据包与验证器:三值裁决(PASS / FAIL / INCONCLUSIVE,未决不洗成通过)+ Ed25519 公开封签(任何人可验、可钉扎公钥)。
67
+
68
+ 理念(LGD):**有籍 · 有证 · 有门禁** → Registry(身份注册)/ Evidence(内容哈希证据 + 封签)/ Gates(生命周期状态机 + 验证门禁)。
69
+
70
+ > ⚠️ 状态:PROPOSAL,非正式标准。验证结果是**限定范围的证明**(scoped proof):
71
+ > PASS 仅表示"在观测到的证据边界内未发现违规",不声称绝对可信。
72
+
73
+ > 🔏 发布产物已进入 Sigstore Rekor 公共透明日志(logIndex 2883389783,见 `dist/*.cosign.bundle`);
74
+ > Zenodo DOI 与 Software Heritage SWHID 见 CITATION.cff。
75
+ > 以上均为**存证**,非质量认可。
76
+
77
+ ## 安装 · Install
78
+
79
+ ```bash
80
+ pip install uibc-core
81
+ ```
82
+
83
+ 装好后:`uibc` 是命令行,`uibc-mcp` 是只读 MCP 服务器(stdio)。从源码跑见下方 Quickstart。
84
+
85
+ ## 5 分钟 Quickstart
86
+
87
+ **30 秒先看效果(无需任何准备):**
88
+
89
+ ```bash
90
+ python -m uibc_core.cli demo # 一键演示:建包→签封→验证 PASS→篡改→FAIL 捉获
91
+ ```
92
+
93
+ ```bash
94
+ pip install -e .
95
+
96
+ # 0. 生成封签密钥(可选,v0.2 推荐)
97
+ uibc keygen --out owner.key # 密钥自己保管,绝不放进包里
98
+
99
+ # 1. 建包
100
+ uibc init demo.uibc
101
+
102
+ # 2. 注册 agent(有籍)
103
+ uibc register demo.uibc --agent-id my-agent-001 --owner alice
104
+
105
+ # 3. 生命周期事件(门禁状态机管理)
106
+ uibc event demo.uibc --type ACTIVATE
107
+
108
+ # 4. 附加证据(有证:自动记录 SHA-256)
109
+ uibc evidence demo.uibc --type ACTION --file report.txt --note "agent action log"
110
+
111
+ # 5. 封包 + 签署(计算 Evidence Root 并写 HMAC 封签)
112
+ uibc submit demo.uibc --key owner.key
113
+
114
+ # 6. 验证(门禁):exit 0 = PASS
115
+ uibc verify demo.uibc --key owner.key # 严格模式:伪造/换钥包在 S6 被拦
116
+ uibc verify demo.uibc # 开放模式:仅完整性检查
117
+ ```
118
+
119
+ ## 运行测试(外人复现三件套)
120
+
121
+ ```bash
122
+ python -m unittest discover tests # 全量 164 用例(实测 `Ran 164 tests, OK`;MCP/Registry/A2A/runtime 合并计入;stress 7 场景单跑,见下条)
123
+ python -m unittest tests.stress_test # 压力 7 场景
124
+ python independent_verifier/cross_check.py # 独立第二实现交叉核验(70 项,0 分歧)
125
+ ```
126
+
127
+ 零第三方依赖,`pip install -e .` 可选(只为获得 `uibc` 短命令)。
128
+
129
+ ## 验证什么(v0.3 检查项)
130
+
131
+ | 检查 | 内容 |
132
+ |------|------|
133
+ | S1 | 包结构完整(manifest / identity / lifecycle / evidence index) |
134
+ | S2 | identity 与 manifest 的 agent_id 一致 |
135
+ | S3 | 生命周期状态机(REGISTER 开头、previous_event 链、REVOKE/RETIRE 终态、非法转移报 lifecycle state violation) |
136
+ | S4 | 证据文件 SHA-256 逐一重算比对(**内容篡改**由 S4 逐文件哈希与 S5 Evidence Root 捕捉;S3 只管生命周期事件序列与转移合法性,**不检测内容篡改**;封签(S6)作用于 identity+manifest,也不覆盖证据内容) |
137
+ | S5 | Evidence Root 重算比对 manifest |
138
+ | S6 | **封签签名**:Ed25519 封签(v0.3 新增)在开放模式下即可公开核验——包里带公钥,任何人可验;HMAC 封签(v0.2)需 `--key` 严格模式核对;未签包 INCONCLUSIVE。判定语义(三值裁决)见 `docs/verdict-and-seal-semantics.md` |
139
+
140
+ ## 验证模式(v0.3)
141
+
142
+ | 模式 | 命令 | 语义 |
143
+ |------|------|------|
144
+ | 开放 | `uibc verify pkg` | Ed25519 已签包 → 公开核验 S6(PASS/FAIL);HMAC 已签包 → S6 INCONCLUSIVE(对称封签无法公开核对);未签包 → INCONCLUSIVE。**v0.3 起裁决为三值:任一检查 INCONCLUSIVE,则总结果封顶 INCONCLUSIVE,不再藏在 PASS 之下** |
145
+ | 严格 | `uibc verify pkg --key owner.key` | 业主持钥:HMAC 封签必须存在且有效,伪造与换钥在 S6 被拦 |
146
+ | 钉扎 | `uibc verify pkg --pubkey owner.pub` | Ed25519 公钥钉扎:封签记录的公钥须与钉扎值一致,换钥重签在 S6 被拦 |
147
+
148
+ 仓库内 `examples/sample-package/` 是一个完整的已签样本包,外人零密钥即可验证(见 `examples/README.md`)。
149
+
150
+ ## 报告纪律(总档案 §16/§17)
151
+
152
+ 每份验证报告必须包含:`scope`(范围)、`limitations`(局限)、`checked`(查了什么)、`not_checked`(没查什么)。
153
+ 明确不查:生命周期事件签名(封签只覆盖 identity+manifest)、外部时间戳锚定、行为评估、记忆忠实性/连续性。非对称/第三方签名已于 v0.3 落地(Ed25519,纯标准库实现,RFC 8032 向量锁定)。
154
+
155
+ ## 已知边界(诚实清单)
156
+
157
+ - **HMAC 封签(v0.2 保留)为对称方案**:验证需持有密钥、无第三方可验证性、无不可否认性——这些缺口已由 v0.3 的 Ed25519 公开封签化解;HMAC 模式仅建议用于业主自验场景。注:v0.3 的 Ed25519 为纯 Python 实现(非恒定时间),大批量签名场景应替换为原生实现(接口不变)。
158
+ - **密钥单点失效(两种封签共有)**:私钥/种子一旦泄露或丢失,封签前提即崩塌,本版本无吊销/轮换机制。生产部署须将私钥纳入密钥管理(HSM / 分片 / 定期轮换);吊销列表留待后续版本。
159
+ - **换钥攻击只能靠钉扎检测**:攻击者可用自己的密钥重新签署整个包——其封签对自己的公钥是有效的;只有验证者钉扎了真业主的公钥(`--pubkey`,或 HMAC 的 `--key`)才在 S6 被拦。故业主应把公钥发布在可被钉扎之处(仓库、注册表条目、论文附带)。常设动机案例见 fixtures/malicious-keyswap 与 `uibc demo` 第 7–8 步
160
+ - Evidence Root 算法为临时版(sorted hashes 的 SHA-256),待 canonical serialization 定稿后升级为 Merkle 树
161
+ - 时间戳未做外部锚定(生产用 OTS/Rekor,见行动计划)
162
+
163
+ ## 生态组件(Ecosystem)
164
+
165
+ | 组件 | 位置 | 说明 |
166
+ |------|------|------|
167
+ | MCP server(只读) | `mcp_server/` | 7 个工具,stdio JSON-RPC |
168
+ | Registry 服务(只读) | `registry_server/` | 三大登记处 HTTP 查询;静态查询页 `registry/index.html` |
169
+ | A2A 适配器 | `adapters/a2a/` | JSON-RPC 2.0 over HTTP:`card` / `uibc/verify` / `uibc/gate` / `uibc/inspect` |
170
+ | 示范应用(完整生命周期) | `examples/showcase.py` | 一个 agent 的可验证生命周期;实录 `examples/SHOWCASE.md` |
171
+ | 失败语料 | `failure_corpus/` | 真实失败 F-001~F-006(根因/教训) |
172
+ | 赛事包 | `contest/` | 章程/赛题/评审/提交规范/内测实录 |
173
+ | AI 发现 | `llms.txt` + `ai/` | 机器可读入口 |
174
+ | Runtime hooks | `uibc_core/runtime.py` | 一行式 `record_action` / `seal` / `event` / `snapshot` |
175
+ | 英文文档 | `README.en.md` | English documentation |
176
+
177
+ ## 对应规范
178
+
179
+ - 《LGD/UIBC 历史讨论总档案 v0.1.0》§9-§26
180
+ - 《UIBC 工程实现摘录 v0.1.0》
181
+ - SPEC 提案:`docs/SPEC-PROPOSAL-v0.1.md`(v0.2 增补见文末)
182
+
183
+ ## Golden Fixtures (archive SS30)
184
+
185
+ Benchmark as executable evidence — eight mutation categories, each a runnable,
186
+ owner-signed submission.uibc package:
187
+
188
+ ```text
189
+ fixtures/ open 模式 strict(--key) 模式 变异
190
+ ├── clean.uibc PASS (S6 不定) PASS (S6 PASS) 基线
191
+ ├── tampered.uibc FAIL (S4) FAIL (S4) 证据内容改写
192
+ ├── deleted.uibc FAIL (S4) FAIL (S4) 证据文件删除
193
+ ├── duplicated.uibc FAIL (S5) FAIL (S5) 索引条目重复
194
+ ├── reordered.uibc FAIL (S3) FAIL (S3) 生命周期换序
195
+ ├── migrated.uibc FAIL (S5) FAIL (S5) 部分迁移未重封
196
+ ├── malicious.uibc PASS (S6 不定) FAIL (S6) 全自洽伪造——v0.1 盲区,
197
+ │ v0.2 严格模式已拦截
198
+ └── malicious-keyswap PASS (S6 不定) FAIL (S6) 换钥重签——仅业主密钥
199
+ 可检(v0.3 动机案例)
200
+ ```
201
+
202
+ **封印的作用域是 `identity+manifest`,不含证据内容。** 所以改写/删除/换序证据
203
+ **不会**让签名失效——上面前五行的 strict 结果只有 S4/S5/S3,S6 仍是 PASS,检测
204
+ 来自那些检查而非签名;只有动了 manifest 的伪造(`malicious`)才会破坏封印。
205
+ 请把 `S6=PASS` 读作"封印未被扰动",**不能**读作"内容为真"。
206
+
207
+ Regenerate + re-verify: `python fixtures/generate_fixtures.py` (writes
208
+ `fixtures/EXPECTED.md` with expected-vs-observed per archive SS31 fields,
209
+ both modes + attacker-key column).
210
+
211
+ 两个 fixtures 生成器都**带门禁**:实测结果与手工推导的期望矩阵逐格机器比对,
212
+ 任何偏差即以非零码退出。散文写的 Expected 列永远"不会失败",矩阵才会——
213
+ 上面那句 `S4+S6` 的错述,正是靠着这道门禁才被发现。
214
+
215
+ ## Memory Migration Fixtures (UIBC-MEM)
216
+
217
+ `python fixtures/generate_memory_fixtures.py` —— 22 个具名威胁,打的是可验证
218
+ 记忆迁移(M0 输入结构 / M1 条目完整 + 四项 Preservation):重复、注入、换 id、
219
+ 丢失、畸形输入、真空输入、换序、已记录边界、500 条规模。输出
220
+ `fixtures/MEMORY_EXPECTED.md`,同样门禁。
221
+
222
+ 其中三个 case 是**回归锁**,锁住这套语料挖出的真实缺陷(两者原本都是静默通过):
223
+ 往 target 塞一个与真条目同 `memory_id` 的假条目(被 dict 折叠吞掉,报告却写
224
+ "no injections"),以及空到空的迁移在四项 Preservation 上全拿 PASS。
225
+
226
+ ## Permanent Archive / 永久存档
227
+
228
+ [![Software Heritage](https://archive.softwareheritage.org/badge/origin/save/https://github.com/zhaoxinghua09-cell/uibc-core/)](https://archive.softwareheritage.org/browse/origin/?origin_url=https%3A%2F%2Fgithub.com%2Fzhaoxinghua09-cell%2Fuibc-core%2F)
229
+
230
+ - **Software Heritage Visit ID**: `2558386` — 本仓已由 Software Heritage 永久存档(不可篡改证据),为该生态资产的长期可引用性提供基础设施级保证。