@nekro-nxt/contracts 0.0.0-stage → 0.2.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 NekroAI contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,7 @@
1
- # Temporary Holding Version
1
+ # 公共契约
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 该包拥有跨 Runtime、Adapter、持久化和进程边界共享的稳定 ID、消息内容、无损 JSON 类型与 Host API Contract Registry。公共 ID 由带前缀格式检查的 Zod brand 推导;HTTP Contract 同时声明 method、path、params、request、response 和 error Schema。它只描述线上和持久边界,不保存业务状态,也不包含 QQ、Web 或 Electron 特例。
4
+
5
+ Server 必须通过 Registry 解析请求并校验响应,Web Client 必须用同一 Registry 构造路径和验证返回值;不得使用只靠泛型声称响应正确的 `requestJson<T>()`。外部输入必须先通过本包解析函数验证;同进程内已经类型化的数据不重复解析。Desktop 实例描述额外区分宽松的 `InstanceDescriptorWireSchema` 与当前可执行的 `InstanceDescriptorSchema`:前者保留未来新增字段,并读取未知协议数字与 transport 字符串以生成明确的不兼容错误;后者只接受 protocol 1 的 loopback/固定 SPKI TLS,以及 protocol 2 的显式未加密 HTTP。用户可见消息词汇以 `../../docs/03-消息内容与投递协议.md` 为唯一设计事实源。
6
+
7
+ 本包与 [`@nekro-nxt/extension-format`](../extension-format/README.md) 以 MIT 许可发布到 npm,供社区服务与外部工具使用;NekroNXT 其余代码仍为 AGPL-3.0-only。