@labacacia/nps-sdk 1.0.0-alpha.13 → 1.0.0-alpha.15
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/CHANGELOG.cn.md +8 -133
- package/CHANGELOG.md +18 -180
- package/README.cn.md +63 -4
- package/README.md +63 -4
- package/dist/conformance.d.ts +55 -0
- package/dist/conformance.d.ts.map +1 -0
- package/dist/conformance.js +100 -0
- package/dist/conformance.js.map +1 -0
- package/dist/core/codec.d.ts +5 -0
- package/dist/core/codec.d.ts.map +1 -1
- package/dist/core/codec.js +38 -1
- package/dist/core/codec.js.map +1 -1
- package/dist/core/codecs/ncp-codec.d.ts.map +1 -1
- package/dist/core/codecs/ncp-codec.js +20 -2
- package/dist/core/codecs/ncp-codec.js.map +1 -1
- package/dist/core/codecs/tier3-binary-vector-codec.d.ts +9 -0
- package/dist/core/codecs/tier3-binary-vector-codec.d.ts.map +1 -0
- package/dist/core/codecs/tier3-binary-vector-codec.js +155 -0
- package/dist/core/codecs/tier3-binary-vector-codec.js.map +1 -0
- package/dist/core/frame-header.d.ts +3 -1
- package/dist/core/frame-header.d.ts.map +1 -1
- package/dist/core/frame-header.js +2 -1
- package/dist/core/frame-header.js.map +1 -1
- package/dist/core/frames.d.ts +4 -1
- package/dist/core/frames.d.ts.map +1 -1
- package/dist/core/frames.js +3 -0
- package/dist/core/frames.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/ndp/federation.d.ts +8 -0
- package/dist/ndp/federation.d.ts.map +1 -0
- package/dist/ndp/federation.js +23 -0
- package/dist/ndp/federation.js.map +1 -0
- package/dist/ndp/frames.d.ts +4 -4
- package/dist/ndp/frames.d.ts.map +1 -1
- package/dist/ndp/frames.js +44 -9
- package/dist/ndp/frames.js.map +1 -1
- package/dist/ndp/index.d.ts +1 -0
- package/dist/ndp/index.d.ts.map +1 -1
- package/dist/ndp/index.js +1 -0
- package/dist/ndp/index.js.map +1 -1
- package/dist/ndp/ndp-error-codes.d.ts +2 -0
- package/dist/ndp/ndp-error-codes.d.ts.map +1 -1
- package/dist/ndp/ndp-error-codes.js +4 -0
- package/dist/ndp/ndp-error-codes.js.map +1 -1
- package/dist/ndp/validator.d.ts.map +1 -1
- package/dist/ndp/validator.js +5 -4
- package/dist/ndp/validator.js.map +1 -1
- package/dist/nip/ca-client.d.ts +93 -0
- package/dist/nip/ca-client.d.ts.map +1 -0
- package/dist/nip/ca-client.js +83 -0
- package/dist/nip/ca-client.js.map +1 -0
- package/dist/nip/frames.d.ts +18 -8
- package/dist/nip/frames.d.ts.map +1 -1
- package/dist/nip/frames.js +71 -19
- package/dist/nip/frames.js.map +1 -1
- package/dist/nip/index.d.ts +1 -0
- package/dist/nip/index.d.ts.map +1 -1
- package/dist/nip/index.js +1 -0
- package/dist/nip/index.js.map +1 -1
- package/dist/nwp/frames.d.ts.map +1 -1
- package/dist/nwp/frames.js +2 -1
- package/dist/nwp/frames.js.map +1 -1
- package/dist/nwp/index.d.ts +1 -0
- package/dist/nwp/index.d.ts.map +1 -1
- package/dist/nwp/index.js +1 -0
- package/dist/nwp/index.js.map +1 -1
- package/dist/nwp/native-server.d.ts +39 -0
- package/dist/nwp/native-server.d.ts.map +1 -0
- package/dist/nwp/native-server.js +131 -0
- package/dist/nwp/native-server.js.map +1 -0
- package/package.json +5 -1
package/CHANGELOG.cn.md
CHANGED
|
@@ -8,144 +8,20 @@
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
## [1.0.0-alpha.
|
|
12
|
-
|
|
13
|
-
### 新增
|
|
14
|
-
|
|
15
|
-
- **NCP v0.8 — `NopFrame`(0x07)**:新增 keepalive/心跳帧类;`HelloFrame.pingIntervalMs`(默认 `0`);新增 `NCP_KEEPALIVE_TIMEOUT` / `NCP_REKEY_REQUIRED` 错误码。
|
|
16
|
-
- **NWP v0.14 — manifest 版本化**:`manifest_version` 改为 `uint32` 单调递增计数器;新增 `manifest_updated_at`(ISO 8601);`X-NWM-Version` 响应头常量。
|
|
17
|
-
- **NIP v0.10 — `node_roles`**:`IdentFrameOptions.nodeRoles` / `IdentFrame.nodeRoles`(`readonly string[] | null`);新增 `CERT_NODE_ROLES_MISMATCH` 错误码。
|
|
18
|
-
- **NDP v0.9 — spawn schema + 心跳**:`AnnounceFrame.spawn_spec_ref` 改为结构化 `Record<string,unknown>` 对象;`AnnounceFrame.heartbeat_interval_ms`(默认 `60000`);新增 `NDP_ANNOUNCE_STALE` 错误码。
|
|
19
|
-
- **NOP v0.7 — 结果 TTL**:`TaskFrame.resultTtlSeconds`(默认 `3600`);新增 `NOP_TASK_RESULT_EXPIRED` / `NOP_STREAM_NAK_UNRESOLVABLE` 错误码。
|
|
20
|
-
|
|
21
|
-
### 套件同步
|
|
22
|
-
|
|
23
|
-
本版本跟进 NPS 套件 `v1.0.0-alpha.13`。NCP v0.8 / NWP v0.14 / NIP v0.10 / NDP v0.9 / NOP v0.7。
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## [1.0.0-alpha.8] —— 2026-05-28
|
|
28
|
-
|
|
29
|
-
### 套件同步
|
|
30
|
-
|
|
31
|
-
本版本跟进 NPS 套件 `v1.0.0-alpha.8`。
|
|
32
|
-
|
|
33
|
-
套件 alpha.8 亮点:.NET SDK 落地 RFC-0005 `ReputationPolicyEvaluator`;
|
|
34
|
-
cgn_limit 预执行拦截;RFC-0002 与 RFC-0005 晋级为 Accepted。
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
## [1.0.0-alpha.7] —— 2026-05-17
|
|
39
|
-
|
|
40
|
-
### 新增
|
|
41
|
-
|
|
42
|
-
- **`nip/reputation-client.ts` — `ReputationLogClient`(NPS-RFC-0004 Phase 2)**:基于 fetch 的声誉日志 operator 完整客户端。`submitEntry`、`queryEntries`、`getSth`、`getProof`、`getGossipSth`。`verifyInclusion` 使用 `@noble/hashes/sha256` 在本地执行 RFC 9162 §2.1.3.2 Merkle audit-path 验证。`signEntry` / `verifyEntry` 使用 `@noble/ed25519` 签名验证条目。Wire 类型:`ReputationLogEntry`、`SignedTreeHead`、`InclusionProof`、`ObservationWindow`。`AnchorTopologyError` 携带 `nwpErrorCode` + `npsStatus`。30 条回归测试。从 `@labacacia/nps-sdk/nip` 重新导出。
|
|
43
|
-
|
|
44
|
-
- **`nwp/anchor-client.ts` — `AnchorNodeClient`(NPS-CR-0002)**:基于 fetch 的 Anchor Node 拓扑查询客户端。`getSnapshot`(topology.snapshot)和 `subscribe` async generator(topology.stream NDJSON)。判别联合类型 `TopologyEvent`,包含 `member_joined`、`member_left`、`member_updated`、`anchor_state`、`resync_required` 五种 kind。`AnchorTopologyError` 处理协议错误。24 条回归测试。
|
|
45
|
-
|
|
46
|
-
### 跟随套件
|
|
47
|
-
|
|
48
|
-
本次跟随 NPS 套件 `v1.0.0-alpha.7`。
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## [1.0.0-alpha.6] —— 2026-05-14
|
|
11
|
+
## [1.0.0-alpha.15] —— 2026-06-28
|
|
53
12
|
|
|
54
13
|
### 变更
|
|
55
14
|
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
- **`nwp/index.ts` — 移除 `NwpErrorCodes` 重导出(Breaking)**:从桶文件中移除了 `export * as NwpErrorCodes from "./error-codes.js"`。如需使用,请直接从 `@labacacia/nps-sdk/nwp/error-codes` 导入。
|
|
59
|
-
|
|
60
|
-
- **版本升级至 `1.0.0-alpha.6`** —— 与 NPS 套件 alpha.6 版本同步。
|
|
61
|
-
|
|
62
|
-
---
|
|
15
|
+
- 套件级 alpha.15 同步:对齐包元数据、当前 README / 版本 banner、分发源树以及 release-prep 说明到 NPS-Dev。
|
|
16
|
+
- 承载源事实树中的 NCP Tier-3 BinaryVector、入站 NWP Bridge server 加固、NIP canonical trust/revoke,以及 NDP discovery canonical-form 对齐。
|
|
63
17
|
|
|
64
|
-
## [1.0.0-alpha.
|
|
18
|
+
## [1.0.0-alpha.14] —— 2026-06-26
|
|
65
19
|
|
|
66
|
-
###
|
|
67
|
-
|
|
68
|
-
- **NWP 错误码常量** —— 新增 `NwpErrorCodes` 命名空间,从 `@labacacia/nps-sdk/nwp` 导出,包含全部 30 个 NWP wire 错误码(auth、query、action、task、subscribe、infrastructure、manifest、topology、reserved-type)。此前版本均未提供。
|
|
69
|
-
- **`NpsStatusCodes.NPS_SERVER_UNSUPPORTED`** —— 在 `src/core/status-codes.ts` 新增状态码 `"NPS-SERVER-UNSUPPORTED"`(HTTP 501),符合 spec/status-codes.md alpha.5 更新。
|
|
70
|
-
- **`NDP.resolveWithDns` —— DNS TXT 回退解析** —— 新增 `InMemoryNdpRegistry.resolveWithDns(target, resolver?)`,当内存注册表无匹配时回退查询 `_nps-node.{host}` TXT 记录(NPS-4 §5)。新增 `DnsTxtLookup` 接口 + `SystemDnsTxtLookup`(Node.js `dns.promises`);`parseNpsTxtRecord` + `extractHostFromTarget` 从 `@labacacia/nps-sdk/ndp` 导出。测试数:284 → 294。
|
|
71
|
-
|
|
72
|
-
### 变更
|
|
73
|
-
|
|
74
|
-
- **`AssuranceLevel.fromWire("")` 返回 `Anonymous`** —— `if (wire == null)` 改为 `if (!wire)`,使 `""` 返回 `Anonymous` 而非 `Unknown`(spec §5.1.1 向后兼容修复)。
|
|
75
|
-
- **版本升至 `1.0.0-alpha.5`** —— 与 NPS 套件 alpha.5 同步。
|
|
76
|
-
|
|
77
|
-
### 修复
|
|
78
|
-
|
|
79
|
-
- **`REPUTATION_GOSSIP_FORK` / `REPUTATION_GOSSIP_SIG_INVALID`** —— 向 `src/nip/error-codes.ts` 新增两个 NIP 声誉 gossip 错误码(RFC-0004 Phase 3)。
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## [1.0.0-alpha.4] —— 2026-04-30
|
|
84
|
-
|
|
85
|
-
### 新增
|
|
86
|
-
|
|
87
|
-
- **NPS-RFC-0001 Phase 2 —— NCP 连接前导(TypeScript helper 跟进)。**
|
|
88
|
-
`src/ncp/preamble.ts` 暴露 `writePreamble(stream)` /
|
|
89
|
-
`readPreamble(stream)`,往返字面量 `b"NPS/1.0\n"` 哨兵;
|
|
90
|
-
`tests/ncp/preamble.test.ts` 覆盖。让 TypeScript SDK 与 .NET /
|
|
91
|
-
Python / Go / Java 在 alpha.4 的 preamble helper 持平。
|
|
92
|
-
- **NPS-RFC-0002 Phase A/B —— X.509 NID 证书 + ACME `agent-01`
|
|
93
|
-
(TypeScript 端口)。** 新增 `src/nip/` 子模块:
|
|
94
|
-
- `nip/x509/` —— X.509 NID 证书 builder + verifier
|
|
95
|
-
(`x509.Builder`、`x509.Verifier`)。
|
|
96
|
-
- `nip/acme/` —— ACME `agent-01` 客户端 + 服务端参考实现
|
|
97
|
-
(`AcmeServer`、`AcmeClient`);按 NPS-RFC-0002 Phase B 的 JWS
|
|
98
|
-
签名 wire 包络。
|
|
99
|
-
- `nip/assurance-level.ts` —— Agent 身份保证等级
|
|
100
|
-
(`anonymous` / `attested` / `verified`),承接 NPS-RFC-0003。
|
|
101
|
-
- `nip/cert-format.ts` —— IdentFrame `cert_format` 判别器
|
|
102
|
-
(`v1` Ed25519 vs. `x509`)。
|
|
103
|
-
- `nip/error-codes.ts` —— NIP 错误码命名空间。
|
|
104
|
-
- `nip/verifier.ts` —— dual-trust IdentFrame 验证器(v1 + X.509)。
|
|
105
|
-
- 20 个新测试覆盖 preamble 往返、X.509 签发 + 解析、dual-trust 验证、
|
|
106
|
-
ACME agent-01 全流程。总数:284 tests 全绿(alpha.3 时 264)。
|
|
107
|
-
|
|
108
|
-
### 变更
|
|
109
|
-
|
|
110
|
-
- 分发版本升至 `1.0.0-alpha.4`。
|
|
111
|
-
- `src/nip/frames.ts` —— IdentFrame wire 形状扩展,可携带可选的
|
|
112
|
-
`cert_format` 判别器 + `x509_chain` 字段,与 v1 Ed25519 字段并存。
|
|
113
|
-
alpha.3 写出的 v1 IdentFrame 仍可被 alpha.4 验签。
|
|
114
|
-
|
|
115
|
-
### npm 发布说明
|
|
116
|
-
|
|
117
|
-
- 本仓库 / tag 是 `@labacacia/nps-sdk` `1.0.0-alpha.4` 的权威参考。
|
|
118
|
-
延续 alpha.3 的情况,npm publish 可能需要带 2FA-bypass 的 granular
|
|
119
|
-
access token —— 如果 npm registry 上的版本暂时落后于本仓库 tag,
|
|
120
|
-
以 tag 为准;下一次 registry cut 后 `npm install` 即可解析到本
|
|
121
|
-
commit。
|
|
122
|
-
|
|
123
|
-
### 套件级 alpha.4 要点
|
|
124
|
-
|
|
125
|
-
- **NPS-RFC-0002 X.509 + ACME** —— 完整跨 SDK 端口波(.NET / Java /
|
|
126
|
-
Python / TypeScript / Go / Rust)。
|
|
127
|
-
- **NPS-CR-0002 —— Anchor Node topology 查询** —— `topology.snapshot`
|
|
128
|
-
/ `topology.stream`(.NET 参考 + L2 conformance)。TypeScript 消费
|
|
129
|
-
侧 helper 后续版本跟进。
|
|
130
|
-
- **`nps-registry` SQLite 实仓** + **`nps-ledger` Phase 2**
|
|
131
|
-
(RFC 9162 Merkle + STH + inclusion proof)已在 daemon 仓库交付。
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
## [1.0.0-alpha.3] —— 2026-04-25
|
|
136
|
-
|
|
137
|
-
### Changed
|
|
138
|
-
|
|
139
|
-
- 版本升级至 `1.0.0-alpha.3`,与 NPS `v1.0.0-alpha.3` 套件同步。本次 TypeScript SDK 无功能变更。
|
|
140
|
-
- 264 tests, ≥98% 覆盖率仍全绿。
|
|
141
|
-
|
|
142
|
-
### 套件级 alpha.3 要点(各语言 helper 在 alpha.4 跟进)
|
|
20
|
+
### Added
|
|
143
21
|
|
|
144
|
-
-
|
|
145
|
-
-
|
|
146
|
-
-
|
|
147
|
-
- **NPS-CR-0001 —— Anchor / Bridge 节点拆分。** 旧的 "Gateway Node" 角色更名为 **Anchor Node**;"NPS↔外部协议翻译" 单独成为 **Bridge Node** 类型。AnnounceFrame 新增 `node_kind` / `cluster_anchor` / `bridge_protocols`。源代码层面变更落在 `spec/` + .NET 参考实现。
|
|
148
|
-
- **6 个 NPS 常驻 daemon。** NPS-Dev 新建 `daemons/` 目录,定义 `npsd` / `nps-runner` / `nps-gateway` / `nps-registry` / `nps-cloud-ca` / `nps-ledger`;其中 `npsd` 提供 L1 功能性参考实现,其余为 Phase 1 骨架。
|
|
22
|
+
- `@labacacia/nps-sdk/nip` 下新增 `NipCaClient`:远程 NIP CA 的类型化客户端,覆盖 discovery、CRL、agent/node 注册、X.509 注册、续签、撤销和校验。
|
|
23
|
+
- `@labacacia/nps-sdk/nwp` 下新增 `NwpNativeNodeServer`:native-mode NWP 服务端 helper,用于在已建立的 NCP stream 上分发 QueryFrame/ActionFrame。
|
|
24
|
+
- `@labacacia/nps-sdk/conformance`:TC-N1/TC-N2 一致性用例目录、manifest helper 和校验器,用于 CI/自认证流程。
|
|
149
25
|
|
|
150
26
|
---
|
|
151
27
|
|
|
@@ -176,6 +52,5 @@ cgn_limit 预执行拦截;RFC-0002 与 RFC-0005 晋级为 Accepted。
|
|
|
176
52
|
|
|
177
53
|
作为 NPS 套件 `v1.0.0-alpha.1` 的一部分首次公开 alpha。
|
|
178
54
|
|
|
179
|
-
[1.0.0-alpha.7]: https://github.com/labacacia/NPS-sdk-ts/releases/tag/v1.0.0-alpha.7
|
|
180
55
|
[1.0.0-alpha.2]: https://github.com/LabAcacia/nps/releases/tag/v1.0.0-alpha.2
|
|
181
56
|
[1.0.0-alpha.1]: https://github.com/LabAcacia/nps/releases/tag/v1.0.0-alpha.1
|
package/CHANGELOG.md
CHANGED
|
@@ -8,197 +8,36 @@ Until NPS reaches v1.0 stable, every repository in the suite is synchronized to
|
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
## [1.0.0-alpha.
|
|
12
|
-
|
|
13
|
-
### Added
|
|
14
|
-
|
|
15
|
-
- **NCP v0.8 — `NopFrame` (0x07)**: New keepalive/heartbeat frame class; `HelloFrame.pingIntervalMs` (`number`, default `0`); `NCP_KEEPALIVE_TIMEOUT` / `NCP_REKEY_REQUIRED` error codes.
|
|
16
|
-
- **NWP v0.14 — manifest versioning**: `manifest_version` changed to `uint32` monotonic counter; `manifest_updated_at` (ISO 8601); `X-NWM-Version` response header constant.
|
|
17
|
-
- **NIP v0.10 — `node_roles`**: `IdentFrameOptions.nodeRoles` / `IdentFrame.nodeRoles` (`readonly string[] | null`); `CERT_NODE_ROLES_MISMATCH` error code.
|
|
18
|
-
- **NDP v0.9 — spawn schema + heartbeat**: `AnnounceFrame.spawn_spec_ref` changed to structured `Record<string,unknown>` object (NdpSpawnSpecRef); `AnnounceFrame.heartbeat_interval_ms` (`number`, default `60000`); `NDP_ANNOUNCE_STALE` error code.
|
|
19
|
-
- **NOP v0.7 — result TTL**: `TaskFrame.resultTtlSeconds` (`number`, default `3600`); `NOP_TASK_RESULT_EXPIRED` / `NOP_STREAM_NAK_UNRESOLVABLE` error codes.
|
|
20
|
-
|
|
21
|
-
### Tracking the suite
|
|
22
|
-
|
|
23
|
-
This release tracks NPS suite `v1.0.0-alpha.13`. NCP v0.8 / NWP v0.14 / NIP v0.10 / NDP v0.9 / NOP v0.7.
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## [1.0.0-alpha.11] — 2026-05-31
|
|
28
|
-
|
|
29
|
-
### Added
|
|
30
|
-
|
|
31
|
-
- **NWP — `SubscribeFrame` CR-0006** (Breaking rewrite): Changed from class to interface; wire format updated — `subscriptionId` (UUID v4), `filter` (`Record<string,unknown>?`), `heartbeatIntervalMs` (`number?`), `maxEvents` (`number?`), `cursor` (`string?`). `subscribeFrameToNpsFrame()` / `subscribeFrameFromDict()` standalone helpers. **Wire breaking change vs alpha.8–10.**
|
|
32
|
-
- **NOP — AlignStream ack/NAK**: `AlignStreamFrame` gains `ackSeq` and `nakSeq` (`number?`) for NOP v0.6 sliding-window acknowledgement.
|
|
33
|
-
- **NOP — Saga compensation**: `TaskFrame.compensationPolicy`; `DelegateFrame.targetClusterAnchor`; `AggregateStrategy.WEIGHTED_FIRST_K` / `MERGE_ALL`.
|
|
34
|
-
- **NDP — `GraphFrame` §5** (Breaking rewrite): `NdpGraphNode`, `NdpGraphEdge` interfaces; `GraphFrame` with `graphId`, `nodes`, `edges`, `ttl`, `metadata`. Max 256 nodes / 1024 edges.
|
|
35
|
-
- **NDP — `SecurityProfile`**: `LOCAL_DEV` / `ORG_PRIVATE` / `PUBLIC_FEDERATED` const.
|
|
36
|
-
- **NIP — `IdentFrame.ocspStaple`**: base64url DER OCSP response field; `IdentReputationPolicyHint` interface.
|
|
37
|
-
|
|
38
|
-
### Tracking the suite
|
|
39
|
-
|
|
40
|
-
This release tracks NPS suite `v1.0.0-alpha.11`. NCP v0.7 / NWP v0.13 / NIP v0.9 / NDP v0.8 / NOP v0.6.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## [1.0.0-alpha.10] — 2026-05-28
|
|
45
|
-
|
|
46
|
-
### Added
|
|
47
|
-
|
|
48
|
-
- **NOP — Saga compensation**: `DagNode` interface with `compensateAction` / `compensateParamsMapping`; `TaskState.COMPENSATING` / `COMPENSATED`; `CompensationPolicy` object.
|
|
49
|
-
- **NDP — `SecurityProfile`**: `LOCAL_DEV` / `ORG_PRIVATE` / `PUBLIC_FEDERATED` const.
|
|
50
|
-
- **NIP — `IdentReputationPolicyHint`**: Reputation policy hint interface; `IdentMetadata` interface.
|
|
51
|
-
|
|
52
|
-
### Tracking the suite
|
|
53
|
-
|
|
54
|
-
This release tracks NPS suite `v1.0.0-alpha.10`.
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## [1.0.0-alpha.9] — 2026-05-28
|
|
59
|
-
|
|
60
|
-
### Added
|
|
61
|
-
|
|
62
|
-
- **NWP — `SubscribeFrame` (0x12)**: Initial `SubscribeFrame` class (pre-CR-0006 format — replaced in alpha.11).
|
|
63
|
-
- **NWP — `ReputationPolicy` / `RepOutcome`**: RFC-0005 reputation types.
|
|
64
|
-
|
|
65
|
-
### Tracking the suite
|
|
66
|
-
|
|
67
|
-
This release tracks NPS suite `v1.0.0-alpha.9`.
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## [1.0.0-alpha.8] — 2026-05-28
|
|
72
|
-
|
|
73
|
-
### Tracking the suite
|
|
74
|
-
|
|
75
|
-
This release tracks NPS suite `v1.0.0-alpha.8`.
|
|
76
|
-
|
|
77
|
-
Suite highlights: RFC-0005 `ReputationPolicyEvaluator` in .NET SDK; cgn_limit
|
|
78
|
-
pre-execution enforcement; RFC-0002 and RFC-0005 promoted to Accepted.
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
## [1.0.0-alpha.7] — 2026-05-17
|
|
83
|
-
|
|
84
|
-
### Added
|
|
85
|
-
|
|
86
|
-
- **`nip/reputation-client.ts` — `ReputationLogClient` (NPS-RFC-0004 Phase 2)**: Full fetch-based client for the reputation-log operator API. `submitEntry`, `queryEntries`, `getSth`, `getProof`, `getGossipSth`. `verifyInclusion` performs RFC 9162 §2.1.3.2 Merkle audit-path verification locally using `@noble/hashes/sha256`. `signEntry` / `verifyEntry` sign and verify entries with `@noble/ed25519`. Wire types: `ReputationLogEntry`, `SignedTreeHead`, `InclusionProof`, `ObservationWindow`. `AnchorTopologyError` carries `nwpErrorCode` + `npsStatus`. 30 regression tests. Re-exported from `@labacacia/nps-sdk/nip`.
|
|
87
|
-
|
|
88
|
-
- **`nwp/anchor-client.ts` — `AnchorNodeClient` (NPS-CR-0002)**: Fetch-based client for Anchor Node topology queries. `getSnapshot` (topology.snapshot) and `subscribe` async generator (topology.stream NDJSON). Discriminated-union `TopologyEvent` with kinds: `member_joined`, `member_left`, `member_updated`, `anchor_state`, `resync_required`. `AnchorTopologyError` for protocol errors. 24 regression tests.
|
|
89
|
-
|
|
90
|
-
### Tracking the suite
|
|
91
|
-
|
|
92
|
-
This release tracks NPS suite `v1.0.0-alpha.7`.
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## [1.0.0-alpha.6] — 2026-05-14
|
|
11
|
+
## [1.0.0-alpha.15] — 2026-06-28
|
|
97
12
|
|
|
98
13
|
### Changed
|
|
99
14
|
|
|
100
|
-
-
|
|
101
|
-
|
|
102
|
-
- **`nwp/index.ts` — `NwpErrorCodes` re-export removed (Breaking)**: `export * as NwpErrorCodes from "./error-codes.js"` removed from the barrel. Import directly from `@labacacia/nps-sdk/nwp/error-codes` if needed.
|
|
15
|
+
- Suite-wide alpha.15 sync: aligned package metadata, current README/version banners, distribution source trees, and release-prep notes with NPS-Dev.
|
|
16
|
+
- Carries the NCP Tier-3 BinaryVector, inbound NWP Bridge server hardening, NIP canonical trust/revoke, and NDP discovery canonical-form alignment delivered by the source-of-truth tree.
|
|
103
17
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
## [1.0.0-alpha.5] — 2026-05-01
|
|
18
|
+
## [1.0.0-alpha.14] — 2026-06-26
|
|
109
19
|
|
|
110
20
|
### Added
|
|
111
|
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
- **`NDP.resolveWithDns` — DNS TXT fallback resolution** — new `InMemoryNdpRegistry.resolveWithDns(target, resolver?)` falls back to `_nps-node.{host}` TXT record lookup (NPS-4 §5) when no in-memory entry matches. New `DnsTxtLookup` interface + `SystemDnsTxtLookup` (Node.js `dns.promises`); `parseNpsTxtRecord` + `extractHostFromTarget` helpers exported from `@labacacia/nps-sdk/ndp`. Tests: 284 → 294.
|
|
115
|
-
|
|
116
|
-
### Changed
|
|
117
|
-
|
|
118
|
-
- **`AssuranceLevel.fromWire("")` returns `Anonymous`** — `if (wire == null)` changed to `if (!wire)` so `""` returns `Anonymous` instead of `Unknown` (spec §5.1.1 backward-compat fix).
|
|
119
|
-
- **Version bump to `1.0.0-alpha.5`** — synchronized with NPS suite alpha.5 release.
|
|
120
|
-
|
|
121
|
-
### Fixed
|
|
122
|
-
|
|
123
|
-
- **`REPUTATION_GOSSIP_FORK` / `REPUTATION_GOSSIP_SIG_INVALID`** — two new NIP reputation gossip error codes added to `src/nip/error-codes.ts` (RFC-0004 Phase 3).
|
|
21
|
+
- `NipCaClient` under `@labacacia/nps-sdk/nip`: typed remote NIP CA client for discovery, CRL, agent/node registration, X.509 registration, renewal, revocation, and verification.
|
|
22
|
+
- `NwpNativeNodeServer` under `@labacacia/nps-sdk/nwp`: native-mode NWP serving helper for dispatching QueryFrame/ActionFrame over an already established NCP stream.
|
|
23
|
+
- `@labacacia/nps-sdk/conformance`: TC-N1/TC-N2 conformance catalog, manifest helper, and validator for CI/self-certification flows.
|
|
124
24
|
|
|
125
25
|
---
|
|
126
26
|
|
|
127
|
-
## [1.0.0-alpha.
|
|
27
|
+
## [1.0.0-alpha.11] — 2026-05-28
|
|
128
28
|
|
|
129
29
|
### Added
|
|
130
30
|
|
|
131
|
-
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
- `nip/acme/` — ACME `agent-01` client + server reference
|
|
142
|
-
(`AcmeServer`, `AcmeClient`); JWS-signed wire envelope per
|
|
143
|
-
NPS-RFC-0002 Phase B.
|
|
144
|
-
- `nip/assurance-level.ts` — agent identity assurance levels
|
|
145
|
-
(`anonymous` / `attested` / `verified`) per NPS-RFC-0003.
|
|
146
|
-
- `nip/cert-format.ts` — IdentFrame `cert_format` discriminator
|
|
147
|
-
(`v1` Ed25519 vs. `x509`).
|
|
148
|
-
- `nip/error-codes.ts` — NIP error code namespace strings.
|
|
149
|
-
- `nip/verifier.ts` — dual-trust IdentFrame verifier (v1 + X.509).
|
|
150
|
-
- 20 new tests covering preamble round-trip, X.509 issuance + parsing,
|
|
151
|
-
dual-trust verification, and ACME agent-01 round-trip. Total: 284
|
|
152
|
-
tests green (was 264 at alpha.3).
|
|
153
|
-
|
|
154
|
-
### Changed
|
|
155
|
-
|
|
156
|
-
- Distribution version bumped to `1.0.0-alpha.4`.
|
|
157
|
-
- `src/nip/frames.ts` — IdentFrame wire shape extended with optional
|
|
158
|
-
`cert_format` discriminator + `x509_chain` field alongside the
|
|
159
|
-
existing v1 Ed25519 fields. v1 IdentFrames written by alpha.3
|
|
160
|
-
consumers continue to verify unchanged.
|
|
161
|
-
|
|
162
|
-
### Note: npm publish status
|
|
163
|
-
|
|
164
|
-
- This repo / tag is the canonical `1.0.0-alpha.4` reference for
|
|
165
|
-
`@labacacia/nps-sdk`. As at the alpha.3 ship cycle, npm publish
|
|
166
|
-
may require a granular access token with 2FA-bypass enabled — if
|
|
167
|
-
the registry version lags this repo's tag, the tag is the
|
|
168
|
-
authoritative artifact and `npm install` against the next
|
|
169
|
-
registry cut will resolve to this commit.
|
|
170
|
-
|
|
171
|
-
### Suite-wide highlights at alpha.4
|
|
172
|
-
|
|
173
|
-
- **NPS-RFC-0002 X.509 + ACME** — full cross-SDK port wave (.NET /
|
|
174
|
-
Java / Python / TypeScript / Go / Rust). Servers can now issue
|
|
175
|
-
dual-trust IdentFrames (v1 Ed25519 + X.509 leaf cert chained to a
|
|
176
|
-
self-signed root) and self-onboard NIDs over ACME's `agent-01`
|
|
177
|
-
challenge type.
|
|
178
|
-
- **NPS-CR-0002 — Anchor Node topology queries** — `topology.snapshot`
|
|
179
|
-
/ `topology.stream` query types (.NET reference + L2 conformance
|
|
180
|
-
suite). TypeScript consumer-side helpers planned for a later
|
|
181
|
-
release.
|
|
182
|
-
- **`nps-registry` SQLite-backed real registry** + **`nps-ledger`
|
|
183
|
-
Phase 2** (RFC 9162 Merkle + STH + inclusion proofs) shipped in the
|
|
184
|
-
daemon repos.
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## [1.0.0-alpha.3] — 2026-04-25
|
|
189
|
-
|
|
190
|
-
### Changed
|
|
191
|
-
|
|
192
|
-
- Version bump to `1.0.0-alpha.3` for suite-wide synchronization with the NPS `v1.0.0-alpha.3` release. No functional changes in the TypeScript SDK at this milestone.
|
|
193
|
-
- 264 tests, ≥98% coverage still green.
|
|
194
|
-
|
|
195
|
-
### Suite-wide highlights at alpha.3 (per-language helpers planned for alpha.4)
|
|
196
|
-
|
|
197
|
-
- **NPS-RFC-0001 — NCP connection preamble** (Accepted). Native-mode connections now begin with the literal `b"NPS/1.0\n"` (8 bytes). Reference helper landed in the .NET SDK; TypeScript helper deferred to alpha.4.
|
|
198
|
-
- **NPS-RFC-0003 — Agent identity assurance levels** (Accepted). NIP IdentFrame and NWM gain a tri-state `assurance_level` (`anonymous`/`attested`/`verified`). Reference types landed in .NET; TypeScript parity deferred to alpha.4.
|
|
199
|
-
- **NPS-RFC-0004 — NID reputation log (CT-style)** (Accepted). Append-only Merkle log entry shape published; reference signer landed in .NET (and shipped as the `nps-ledger` daemon Phase 1). TypeScript helpers deferred to alpha.4.
|
|
200
|
-
- **NPS-CR-0001 — Anchor / Bridge node split.** The legacy "Gateway Node" role is renamed to **Anchor Node**; the "translate NPS↔external protocol" role is now its own **Bridge Node** type. AnnounceFrame gained `node_kind` / `cluster_anchor` / `bridge_protocols`. Source-of-truth changes are in `spec/` + the .NET reference implementation.
|
|
201
|
-
- **6 NPS resident daemons.** New `daemons/` tree in NPS-Dev defines `npsd` / `nps-runner` / `nps-gateway` / `nps-registry` / `nps-cloud-ca` / `nps-ledger`; `npsd` ships an L1-functional reference and the rest ship as Phase 1 skeletons.
|
|
31
|
+
- NOP saga compensation: `DagNode.compensate_action/compensate_params_mapping`, `TaskFrame.compensation_policy`, `TaskState.COMPENSATING/COMPENSATED`, `CompensationPolicy` constants (alpha.9 parity)
|
|
32
|
+
- NOP `AggregateStrategy.WEIGHTED_FIRST_K` and `MERGE_ALL` (alpha.11)
|
|
33
|
+
- NOP `DelegateFrame.target_cluster_anchor`, `AlignStreamFrame.ack_seq/nak_seq` (alpha.11)
|
|
34
|
+
- NDP security profiles: `SecurityProfile` constants + registry enforcement (alpha.9 parity)
|
|
35
|
+
- NDP ephemeral TTL cap (60 s) in registry (alpha.9 parity)
|
|
36
|
+
- NDP `AnnounceFrame` alpha.9 fields: node_roles, cluster_anchor, spawn_spec_ref, bridge_protocols, activation_mode, activation_endpoint
|
|
37
|
+
- NDP `GraphFrame` / `NdpGraphEdge` redesigned to NPS-4 §5 topology snapshot format (alpha.11)
|
|
38
|
+
- NIP `IdentReputationPolicyHint` and `IdentMetadata.reputation_policy` (alpha.10 parity)
|
|
39
|
+
- NIP `IdentFrame.ocsp_staple` (alpha.11)
|
|
40
|
+
- NWP `SubscribeFrame` and NWM `trust_anchors` field (alpha.11)
|
|
202
41
|
|
|
203
42
|
---
|
|
204
43
|
|
|
@@ -229,6 +68,5 @@ This release tracks NPS suite `v1.0.0-alpha.7`.
|
|
|
229
68
|
|
|
230
69
|
First public alpha as part of the NPS suite `v1.0.0-alpha.1` release.
|
|
231
70
|
|
|
232
|
-
[1.0.0-alpha.7]: https://github.com/labacacia/NPS-sdk-ts/releases/tag/v1.0.0-alpha.7
|
|
233
71
|
[1.0.0-alpha.2]: https://github.com/LabAcacia/nps/releases/tag/v1.0.0-alpha.2
|
|
234
72
|
[1.0.0-alpha.1]: https://github.com/LabAcacia/nps/releases/tag/v1.0.0-alpha.1
|
package/README.cn.md
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
[English Version](./README.md) | 中文版
|
|
2
2
|
|
|
3
3
|
# @labacacia/nps-sdk — TypeScript / Node.js
|
|
4
|
+
[](../../LICENSE)
|
|
5
|
+
[](../../CHANGELOG.cn.md)
|
|
6
|
+
[]()
|
|
7
|
+
[]()
|
|
8
|
+
[]()
|
|
9
|
+
[]()
|
|
10
|
+
[]()
|
|
4
11
|
|
|
5
12
|
面向 **Neural Protocol Suite (NPS)** 的 TypeScript SDK —— 为 AI Agent 设计的协议族。
|
|
6
13
|
属 [LabAcacia](https://github.com/LabAcacia) / INNO LOTUS PTY LTD 开源生态。
|
|
7
14
|
|
|
8
15
|
## 状态
|
|
9
16
|
|
|
10
|
-
**v1.0.0-alpha.
|
|
17
|
+
**v1.0.0-alpha.15 — RFC-0002 跨 SDK 端口波(第三棒)** · 5 个协议 · 271 个测试 · 覆盖率 ≥ 98%
|
|
11
18
|
|
|
12
|
-
|
|
19
|
+
Alpha.14 候选新增:远程 NIP CA 类型化客户端(`NipCaClient`)、native-mode NWP 服务端 helper(`NwpNativeNodeServer`)和 TC-N1/TC-N2 一致性 manifest helper(`@labacacia/nps-sdk/conformance`)。
|
|
13
20
|
|
|
14
21
|
| 协议 | 类 | 状态 |
|
|
15
22
|
|------|----|------|
|
|
16
23
|
| NCP — Neural Communication Protocol | 帧、编解码器 | ✅ |
|
|
17
|
-
| NWP — Neural Web Protocol | `NwpClient` | ✅ |
|
|
24
|
+
| NWP — Neural Web Protocol | `NwpClient`、`NwpNativeNodeServer` | ✅ |
|
|
18
25
|
| NIP — Neural Identity Protocol | `NipIdentity`、`NipIdentVerifier`(RFC-0002 §8.1 双信任)、`AssuranceLevel`(RFC-0003)、`nip.x509` + `nip.acme` | ✅ |
|
|
19
26
|
| NDP — Neural Discovery Protocol | `InMemoryNdpRegistry`、`NdpAnnounceValidator` | ✅ |
|
|
20
27
|
| NOP — Neural Orchestration Protocol | `NopClient` | ✅ |
|
|
@@ -28,7 +35,7 @@
|
|
|
28
35
|
## 安装
|
|
29
36
|
|
|
30
37
|
```bash
|
|
31
|
-
npm install @labacacia/nps-sdk
|
|
38
|
+
npm install @labacacia/nps-sdk
|
|
32
39
|
```
|
|
33
40
|
|
|
34
41
|
> **对等依赖:** Node.js 22+
|
|
@@ -61,6 +68,20 @@ import { ActionFrame } from "@labacacia/nps-sdk/nwp";
|
|
|
61
68
|
const result = await client.invoke(new ActionFrame("summarise", { maxTokens: 500 }));
|
|
62
69
|
```
|
|
63
70
|
|
|
71
|
+
### NWP —— native 服务端
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { NwpNativeNodeServer } from "@labacacia/nps-sdk/nwp";
|
|
75
|
+
|
|
76
|
+
const server = new NwpNativeNodeServer({
|
|
77
|
+
queryHandler: () => [{ id: 42 }],
|
|
78
|
+
actionHandler: (action) => ({ action: action.actionId }),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// `source`/`sink` 已完成 NCP preamble、TLS 和 Hello negotiation。
|
|
82
|
+
await server.serve(source, sink);
|
|
83
|
+
```
|
|
84
|
+
|
|
64
85
|
### NIP —— Ed25519 身份
|
|
65
86
|
|
|
66
87
|
```typescript
|
|
@@ -76,6 +97,43 @@ const sig = loaded.sign({ action: "announce", nid: "urn:nps:node:example.com:
|
|
|
76
97
|
const ok = loaded.verify({ action: "announce", nid: "urn:nps:node:example.com:data" }, sig);
|
|
77
98
|
```
|
|
78
99
|
|
|
100
|
+
### NIP —— 远程 CA Client
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { NipCaClient } from "@labacacia/nps-sdk/nip";
|
|
104
|
+
|
|
105
|
+
const ca = new NipCaClient("https://ca.example.com", { routePrefix: "/nip" });
|
|
106
|
+
const discovery = await ca.getDiscovery();
|
|
107
|
+
const ident = await ca.registerAgent(
|
|
108
|
+
{ identifier: "agent-a", pub_key: "ed25519:<pub>", capabilities: ["nwp:query"] },
|
|
109
|
+
"token",
|
|
110
|
+
);
|
|
111
|
+
const status = await ca.verifyAgent(ident.nid);
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 一致性 Manifest
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
import {
|
|
118
|
+
NODE_L1,
|
|
119
|
+
catalogForProfile,
|
|
120
|
+
createConformanceManifest,
|
|
121
|
+
validateConformanceManifest,
|
|
122
|
+
} from "@labacacia/nps-sdk/conformance";
|
|
123
|
+
|
|
124
|
+
const results = catalogForProfile(NODE_L1).map((c) => ({ id: c.id, result: "pass" as const }));
|
|
125
|
+
const manifest = createConformanceManifest({
|
|
126
|
+
profile: NODE_L1,
|
|
127
|
+
iutName: "my-node",
|
|
128
|
+
iutVersion: "1.0.0-alpha.15",
|
|
129
|
+
iutNid: "urn:nps:node:example.com:my-node",
|
|
130
|
+
peerName: "labacacia-fixture",
|
|
131
|
+
peerVersion: "1.0.0-alpha.15",
|
|
132
|
+
results,
|
|
133
|
+
});
|
|
134
|
+
const validation = validateConformanceManifest(manifest);
|
|
135
|
+
```
|
|
136
|
+
|
|
79
137
|
### NDP —— 注册表和签名校验
|
|
80
138
|
|
|
81
139
|
```typescript
|
|
@@ -116,6 +174,7 @@ import { ... } from "@labacacia/nps-sdk/nwp"; // NwpClient、QueryFrame
|
|
|
116
174
|
import { ... } from "@labacacia/nps-sdk/nip"; // NipIdentity、IdentFrame、TrustFrame、RevokeFrame
|
|
117
175
|
import { ... } from "@labacacia/nps-sdk/ndp"; // InMemoryNdpRegistry、NdpAnnounceValidator、AnnounceFrame、…
|
|
118
176
|
import { ... } from "@labacacia/nps-sdk/nop"; // NopClient、NopTaskStatus、TaskFrame、…
|
|
177
|
+
import { ... } from "@labacacia/nps-sdk/conformance"; // TC-N1/TC-N2 目录和 manifest 校验器
|
|
119
178
|
```
|
|
120
179
|
|
|
121
180
|
## NCP 编解码
|
package/README.md
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
English | [中文版](./README.cn.md)
|
|
2
2
|
|
|
3
3
|
# @labacacia/nps-sdk — TypeScript / Node.js
|
|
4
|
+
[](../../LICENSE)
|
|
5
|
+
[](../../CHANGELOG.md)
|
|
6
|
+
[]()
|
|
7
|
+
[]()
|
|
8
|
+
[]()
|
|
9
|
+
[]()
|
|
10
|
+
[]()
|
|
4
11
|
|
|
5
12
|
TypeScript SDK for the **Neural Protocol Suite** (NPS) — a protocol suite designed for AI Agents.
|
|
6
13
|
Part of the [LabAcacia](https://github.com/LabAcacia) / INNO LOTUS PTY LTD open-source ecosystem.
|
|
7
14
|
|
|
8
15
|
## Status
|
|
9
16
|
|
|
10
|
-
**v1.0.0-alpha.
|
|
17
|
+
**v1.0.0-alpha.15 — RFC-0002 cross-SDK port (third language)** · 5 protocols · 271 tests · ≥ 98% coverage
|
|
11
18
|
|
|
12
|
-
|
|
19
|
+
Alpha.15 additions: typed remote NIP CA client (`NipCaClient`), native-mode NWP serving helper (`NwpNativeNodeServer`), and TC-N1/TC-N2 conformance manifest helpers (`@labacacia/nps-sdk/conformance`).
|
|
13
20
|
|
|
14
21
|
| Protocol | Class | Status |
|
|
15
22
|
|----------|-------|--------|
|
|
16
23
|
| NCP — Neural Communication Protocol | Framing, codec | ✅ |
|
|
17
|
-
| NWP — Neural Web Protocol | `NwpClient` | ✅ |
|
|
24
|
+
| NWP — Neural Web Protocol | `NwpClient`, `NwpNativeNodeServer` | ✅ |
|
|
18
25
|
| NIP — Neural Identity Protocol | `NipIdentity`, `NipIdentVerifier` (RFC-0002 §8.1 dual-trust), `AssuranceLevel` (RFC-0003), `nip.x509` + `nip.acme` | ✅ |
|
|
19
26
|
| NDP — Neural Discovery Protocol | `InMemoryNdpRegistry`, `NdpAnnounceValidator` | ✅ |
|
|
20
27
|
| NOP — Neural Orchestration Protocol | `NopClient` | ✅ |
|
|
@@ -28,7 +35,7 @@ Part of the [LabAcacia](https://github.com/LabAcacia) / INNO LOTUS PTY LTD open-
|
|
|
28
35
|
## Installation
|
|
29
36
|
|
|
30
37
|
```bash
|
|
31
|
-
npm install @labacacia/nps-sdk
|
|
38
|
+
npm install @labacacia/nps-sdk
|
|
32
39
|
```
|
|
33
40
|
|
|
34
41
|
> **Peer requirement:** Node.js 22+
|
|
@@ -61,6 +68,20 @@ import { ActionFrame } from "@labacacia/nps-sdk/nwp";
|
|
|
61
68
|
const result = await client.invoke(new ActionFrame("summarise", { maxTokens: 500 }));
|
|
62
69
|
```
|
|
63
70
|
|
|
71
|
+
### NWP — native serving
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { NwpNativeNodeServer } from "@labacacia/nps-sdk/nwp";
|
|
75
|
+
|
|
76
|
+
const server = new NwpNativeNodeServer({
|
|
77
|
+
queryHandler: () => [{ id: 42 }],
|
|
78
|
+
actionHandler: (action) => ({ action: action.actionId }),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// `source`/`sink` are already past NCP preamble, TLS, and Hello negotiation.
|
|
82
|
+
await server.serve(source, sink);
|
|
83
|
+
```
|
|
84
|
+
|
|
64
85
|
### NIP — Ed25519 identity
|
|
65
86
|
|
|
66
87
|
```typescript
|
|
@@ -76,6 +97,43 @@ const sig = loaded.sign({ action: "announce", nid: "urn:nps:node:example.com:
|
|
|
76
97
|
const ok = loaded.verify({ action: "announce", nid: "urn:nps:node:example.com:data" }, sig);
|
|
77
98
|
```
|
|
78
99
|
|
|
100
|
+
### NIP — remote CA client
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { NipCaClient } from "@labacacia/nps-sdk/nip";
|
|
104
|
+
|
|
105
|
+
const ca = new NipCaClient("https://ca.example.com", { routePrefix: "/nip" });
|
|
106
|
+
const discovery = await ca.getDiscovery();
|
|
107
|
+
const ident = await ca.registerAgent(
|
|
108
|
+
{ identifier: "agent-a", pub_key: "ed25519:<pub>", capabilities: ["nwp:query"] },
|
|
109
|
+
"token",
|
|
110
|
+
);
|
|
111
|
+
const status = await ca.verifyAgent(ident.nid);
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Conformance manifest
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
import {
|
|
118
|
+
NODE_L1,
|
|
119
|
+
catalogForProfile,
|
|
120
|
+
createConformanceManifest,
|
|
121
|
+
validateConformanceManifest,
|
|
122
|
+
} from "@labacacia/nps-sdk/conformance";
|
|
123
|
+
|
|
124
|
+
const results = catalogForProfile(NODE_L1).map((c) => ({ id: c.id, result: "pass" as const }));
|
|
125
|
+
const manifest = createConformanceManifest({
|
|
126
|
+
profile: NODE_L1,
|
|
127
|
+
iutName: "my-node",
|
|
128
|
+
iutVersion: "1.0.0-alpha.15",
|
|
129
|
+
iutNid: "urn:nps:node:example.com:my-node",
|
|
130
|
+
peerName: "labacacia-fixture",
|
|
131
|
+
peerVersion: "1.0.0-alpha.15",
|
|
132
|
+
results,
|
|
133
|
+
});
|
|
134
|
+
const validation = validateConformanceManifest(manifest);
|
|
135
|
+
```
|
|
136
|
+
|
|
79
137
|
### NDP — registry and signature validation
|
|
80
138
|
|
|
81
139
|
```typescript
|
|
@@ -116,6 +174,7 @@ import { ... } from "@labacacia/nps-sdk/nwp"; // NwpClient, QueryFrame, A
|
|
|
116
174
|
import { ... } from "@labacacia/nps-sdk/nip"; // NipIdentity, IdentFrame, TrustFrame, RevokeFrame
|
|
117
175
|
import { ... } from "@labacacia/nps-sdk/ndp"; // InMemoryNdpRegistry, NdpAnnounceValidator, AnnounceFrame, …
|
|
118
176
|
import { ... } from "@labacacia/nps-sdk/nop"; // NopClient, NopTaskStatus, TaskFrame, …
|
|
177
|
+
import { ... } from "@labacacia/nps-sdk/conformance"; // TC-N1/TC-N2 catalogs and manifest validator
|
|
119
178
|
```
|
|
120
179
|
|
|
121
180
|
## NCP Codec
|