@labacacia/nps-sdk 1.0.0-alpha.5 → 1.0.0-alpha.6

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 (361) hide show
  1. package/CHANGELOG.cn.md +2 -93
  2. package/CHANGELOG.md +2 -102
  3. package/CONTRIBUTING.cn.md +0 -0
  4. package/CONTRIBUTING.md +0 -0
  5. package/LICENSE +0 -0
  6. package/NOTICE +0 -0
  7. package/README.cn.md +5 -12
  8. package/README.md +5 -12
  9. package/doc/nps-sdk.core.cn.md +0 -0
  10. package/doc/nps-sdk.core.md +0 -0
  11. package/doc/nps-sdk.ncp.cn.md +0 -0
  12. package/doc/nps-sdk.ncp.md +0 -0
  13. package/doc/nps-sdk.ndp.cn.md +0 -0
  14. package/doc/nps-sdk.ndp.md +0 -0
  15. package/doc/nps-sdk.nop.cn.md +0 -0
  16. package/doc/nps-sdk.nop.md +0 -0
  17. package/doc/overview.cn.md +0 -0
  18. package/doc/overview.md +0 -0
  19. package/nip-ca-server/Dockerfile +0 -0
  20. package/nip-ca-server/README.md +1 -1
  21. package/nip-ca-server/db/001_init.sql +0 -0
  22. package/nip-ca-server/docker-compose.yml +0 -0
  23. package/nip-ca-server/package.json +0 -0
  24. package/nip-ca-server/src/ca.ts +0 -0
  25. package/nip-ca-server/src/db.ts +0 -0
  26. package/nip-ca-server/src/index.ts +0 -0
  27. package/nip-ca-server/tsconfig.json +0 -0
  28. package/package.json +1 -1
  29. package/src/core/anchor-cache.ts +0 -0
  30. package/src/core/cache.ts +0 -0
  31. package/src/core/canonical-json.ts +0 -0
  32. package/src/core/codec.ts +0 -0
  33. package/src/core/codecs/index.ts +0 -0
  34. package/src/core/codecs/ncp-codec.ts +0 -0
  35. package/src/core/codecs/tier1-json-codec.ts +0 -0
  36. package/src/core/codecs/tier2-msgpack-codec.ts +0 -0
  37. package/src/core/crypto-provider.ts +0 -0
  38. package/src/core/exceptions.ts +0 -0
  39. package/src/core/frame-header.ts +0 -0
  40. package/src/core/frame-registry.ts +0 -0
  41. package/src/core/frames.ts +0 -0
  42. package/src/core/index.ts +0 -0
  43. package/src/core/registry.ts +0 -0
  44. package/src/ncp/frames/anchor-frame.ts +0 -0
  45. package/src/ncp/frames/caps-frame.ts +0 -0
  46. package/src/ncp/frames/diff-frame.ts +0 -0
  47. package/src/ncp/frames/error-frame.ts +0 -0
  48. package/src/ncp/frames/hello-frame.ts +0 -0
  49. package/src/ncp/frames/stream-frame.ts +0 -0
  50. package/src/ncp/frames.ts +0 -0
  51. package/src/ncp/handshake.ts +0 -0
  52. package/src/ncp/ncp-patch-format.ts +0 -0
  53. package/src/ncp/registry.ts +0 -0
  54. package/src/ncp/stream-manager.ts +0 -0
  55. package/src/ndp/frames.ts +0 -0
  56. package/src/ndp/registry.ts +0 -0
  57. package/src/ndp/validator.ts +0 -0
  58. package/src/nip/identity.ts +0 -0
  59. package/src/nip/registry.ts +0 -0
  60. package/src/nip/x509/oids.ts +3 -4
  61. package/src/nop/client.ts +0 -0
  62. package/src/nop/frames.ts +0 -0
  63. package/src/nop/index.ts +0 -0
  64. package/src/nop/models.ts +0 -0
  65. package/src/nop/nop-types.ts +0 -0
  66. package/src/nop/registry.ts +0 -0
  67. package/src/nwp/client.ts +0 -0
  68. package/src/nwp/frames.ts +0 -0
  69. package/src/nwp/index.ts +0 -1
  70. package/src/nwp/registry.ts +0 -0
  71. package/src/setup.ts +0 -0
  72. package/tests/core/anchor-cache.test.ts +0 -0
  73. package/tests/core/codec.test.ts +0 -0
  74. package/tests/core/frame-registry.test.ts +0 -0
  75. package/tests/core.test.ts +0 -0
  76. package/tests/ncp/diff-binary-bitset.test.ts +0 -0
  77. package/tests/ncp/e2e-enc-reject.test.ts +0 -0
  78. package/tests/ncp/err-error-frame.test.ts +0 -0
  79. package/tests/ncp/frames.test.ts +0 -0
  80. package/tests/ncp/framing.test.ts +0 -0
  81. package/tests/ncp/hello-frame.test.ts +0 -0
  82. package/tests/ncp/inline-anchor.test.ts +0 -0
  83. package/tests/ncp/security.test.ts +0 -0
  84. package/tests/ncp/stream-window.test.ts +0 -0
  85. package/tests/ncp/stream.test.ts +0 -0
  86. package/tests/ncp/version-negotiation.test.ts +0 -0
  87. package/tests/nip.test.ts +0 -0
  88. package/tests/nop.test.ts +0 -0
  89. package/tests/nwp.test.ts +0 -0
  90. package/tsconfig.json +0 -0
  91. package/tsup.config.ts +0 -0
  92. package/vitest.config.ts +0 -0
  93. package/dist/core/anchor-cache.d.ts +0 -42
  94. package/dist/core/anchor-cache.d.ts.map +0 -1
  95. package/dist/core/anchor-cache.js +0 -104
  96. package/dist/core/anchor-cache.js.map +0 -1
  97. package/dist/core/cache.d.ts +0 -14
  98. package/dist/core/cache.d.ts.map +0 -1
  99. package/dist/core/cache.js +0 -80
  100. package/dist/core/cache.js.map +0 -1
  101. package/dist/core/canonical-json.d.ts +0 -12
  102. package/dist/core/canonical-json.d.ts.map +0 -1
  103. package/dist/core/canonical-json.js +0 -44
  104. package/dist/core/canonical-json.js.map +0 -1
  105. package/dist/core/codec.d.ts +0 -32
  106. package/dist/core/codec.d.ts.map +0 -1
  107. package/dist/core/codec.js +0 -119
  108. package/dist/core/codec.js.map +0 -1
  109. package/dist/core/codecs/index.d.ts +0 -4
  110. package/dist/core/codecs/index.d.ts.map +0 -1
  111. package/dist/core/codecs/index.js +0 -6
  112. package/dist/core/codecs/index.js.map +0 -1
  113. package/dist/core/codecs/ncp-codec.d.ts +0 -39
  114. package/dist/core/codecs/ncp-codec.d.ts.map +0 -1
  115. package/dist/core/codecs/ncp-codec.js +0 -93
  116. package/dist/core/codecs/ncp-codec.js.map +0 -1
  117. package/dist/core/codecs/tier1-json-codec.d.ts +0 -10
  118. package/dist/core/codecs/tier1-json-codec.d.ts.map +0 -1
  119. package/dist/core/codecs/tier1-json-codec.js +0 -28
  120. package/dist/core/codecs/tier1-json-codec.js.map +0 -1
  121. package/dist/core/codecs/tier2-msgpack-codec.d.ts +0 -10
  122. package/dist/core/codecs/tier2-msgpack-codec.d.ts.map +0 -1
  123. package/dist/core/codecs/tier2-msgpack-codec.js +0 -26
  124. package/dist/core/codecs/tier2-msgpack-codec.js.map +0 -1
  125. package/dist/core/crypto-provider.d.ts +0 -31
  126. package/dist/core/crypto-provider.d.ts.map +0 -1
  127. package/dist/core/crypto-provider.js +0 -10
  128. package/dist/core/crypto-provider.js.map +0 -1
  129. package/dist/core/exceptions.d.ts +0 -27
  130. package/dist/core/exceptions.d.ts.map +0 -1
  131. package/dist/core/exceptions.js +0 -52
  132. package/dist/core/exceptions.js.map +0 -1
  133. package/dist/core/frame-header.d.ts +0 -87
  134. package/dist/core/frame-header.d.ts.map +0 -1
  135. package/dist/core/frame-header.js +0 -185
  136. package/dist/core/frame-header.js.map +0 -1
  137. package/dist/core/frame-registry.d.ts +0 -35
  138. package/dist/core/frame-registry.d.ts.map +0 -1
  139. package/dist/core/frame-registry.js +0 -63
  140. package/dist/core/frame-registry.js.map +0 -1
  141. package/dist/core/frames.d.ts +0 -81
  142. package/dist/core/frames.d.ts.map +0 -1
  143. package/dist/core/frames.js +0 -154
  144. package/dist/core/frames.js.map +0 -1
  145. package/dist/core/index.d.ts +0 -11
  146. package/dist/core/index.d.ts.map +0 -1
  147. package/dist/core/index.js +0 -22
  148. package/dist/core/index.js.map +0 -1
  149. package/dist/core/registry.d.ts +0 -11
  150. package/dist/core/registry.d.ts.map +0 -1
  151. package/dist/core/registry.js +0 -17
  152. package/dist/core/registry.js.map +0 -1
  153. package/dist/core/status-codes.d.ts +0 -29
  154. package/dist/core/status-codes.d.ts.map +0 -1
  155. package/dist/core/status-codes.js +0 -39
  156. package/dist/core/status-codes.js.map +0 -1
  157. package/dist/index.d.ts +0 -2
  158. package/dist/index.d.ts.map +0 -1
  159. package/dist/index.js +0 -10
  160. package/dist/index.js.map +0 -1
  161. package/dist/ncp/frames/anchor-frame.d.ts +0 -29
  162. package/dist/ncp/frames/anchor-frame.d.ts.map +0 -1
  163. package/dist/ncp/frames/anchor-frame.js +0 -54
  164. package/dist/ncp/frames/anchor-frame.js.map +0 -1
  165. package/dist/ncp/frames/caps-frame.d.ts +0 -29
  166. package/dist/ncp/frames/caps-frame.d.ts.map +0 -1
  167. package/dist/ncp/frames/caps-frame.js +0 -29
  168. package/dist/ncp/frames/caps-frame.js.map +0 -1
  169. package/dist/ncp/frames/diff-frame.d.ts +0 -32
  170. package/dist/ncp/frames/diff-frame.d.ts.map +0 -1
  171. package/dist/ncp/frames/diff-frame.js +0 -37
  172. package/dist/ncp/frames/diff-frame.js.map +0 -1
  173. package/dist/ncp/frames/error-frame.d.ts +0 -16
  174. package/dist/ncp/frames/error-frame.d.ts.map +0 -1
  175. package/dist/ncp/frames/error-frame.js +0 -13
  176. package/dist/ncp/frames/error-frame.js.map +0 -1
  177. package/dist/ncp/frames/hello-frame.d.ts +0 -21
  178. package/dist/ncp/frames/hello-frame.d.ts.map +0 -1
  179. package/dist/ncp/frames/hello-frame.js +0 -25
  180. package/dist/ncp/frames/hello-frame.js.map +0 -1
  181. package/dist/ncp/frames/stream-frame.d.ts +0 -16
  182. package/dist/ncp/frames/stream-frame.d.ts.map +0 -1
  183. package/dist/ncp/frames/stream-frame.js +0 -18
  184. package/dist/ncp/frames/stream-frame.js.map +0 -1
  185. package/dist/ncp/frames.d.ts +0 -94
  186. package/dist/ncp/frames.d.ts.map +0 -1
  187. package/dist/ncp/frames.js +0 -192
  188. package/dist/ncp/frames.js.map +0 -1
  189. package/dist/ncp/handshake.d.ts +0 -30
  190. package/dist/ncp/handshake.d.ts.map +0 -1
  191. package/dist/ncp/handshake.js +0 -80
  192. package/dist/ncp/handshake.js.map +0 -1
  193. package/dist/ncp/index.d.ts +0 -12
  194. package/dist/ncp/index.d.ts.map +0 -1
  195. package/dist/ncp/index.js +0 -14
  196. package/dist/ncp/index.js.map +0 -1
  197. package/dist/ncp/ncp-error-codes.d.ts +0 -23
  198. package/dist/ncp/ncp-error-codes.d.ts.map +0 -1
  199. package/dist/ncp/ncp-error-codes.js +0 -34
  200. package/dist/ncp/ncp-error-codes.js.map +0 -1
  201. package/dist/ncp/ncp-patch-format.d.ts +0 -7
  202. package/dist/ncp/ncp-patch-format.d.ts.map +0 -1
  203. package/dist/ncp/ncp-patch-format.js +0 -13
  204. package/dist/ncp/ncp-patch-format.js.map +0 -1
  205. package/dist/ncp/preamble.d.ts +0 -47
  206. package/dist/ncp/preamble.d.ts.map +0 -1
  207. package/dist/ncp/preamble.js +0 -74
  208. package/dist/ncp/preamble.js.map +0 -1
  209. package/dist/ncp/registry.d.ts +0 -3
  210. package/dist/ncp/registry.d.ts.map +0 -1
  211. package/dist/ncp/registry.js +0 -13
  212. package/dist/ncp/registry.js.map +0 -1
  213. package/dist/ncp/stream-manager.d.ts +0 -57
  214. package/dist/ncp/stream-manager.d.ts.map +0 -1
  215. package/dist/ncp/stream-manager.js +0 -163
  216. package/dist/ncp/stream-manager.js.map +0 -1
  217. package/dist/ndp/dns-txt.d.ts +0 -35
  218. package/dist/ndp/dns-txt.d.ts.map +0 -1
  219. package/dist/ndp/dns-txt.js +0 -67
  220. package/dist/ndp/dns-txt.js.map +0 -1
  221. package/dist/ndp/frames.d.ts +0 -56
  222. package/dist/ndp/frames.d.ts.map +0 -1
  223. package/dist/ndp/frames.js +0 -87
  224. package/dist/ndp/frames.js.map +0 -1
  225. package/dist/ndp/index.d.ts +0 -6
  226. package/dist/ndp/index.d.ts.map +0 -1
  227. package/dist/ndp/index.js +0 -8
  228. package/dist/ndp/index.js.map +0 -1
  229. package/dist/ndp/ndp-registry.d.ts +0 -13
  230. package/dist/ndp/ndp-registry.d.ts.map +0 -1
  231. package/dist/ndp/ndp-registry.js +0 -104
  232. package/dist/ndp/ndp-registry.js.map +0 -1
  233. package/dist/ndp/registry.d.ts +0 -3
  234. package/dist/ndp/registry.d.ts.map +0 -1
  235. package/dist/ndp/registry.js +0 -10
  236. package/dist/ndp/registry.js.map +0 -1
  237. package/dist/ndp/validator.d.ts +0 -18
  238. package/dist/ndp/validator.d.ts.map +0 -1
  239. package/dist/ndp/validator.js +0 -48
  240. package/dist/ndp/validator.js.map +0 -1
  241. package/dist/nip/acme/client.d.ts +0 -31
  242. package/dist/nip/acme/client.d.ts.map +0 -1
  243. package/dist/nip/acme/client.js +0 -136
  244. package/dist/nip/acme/client.js.map +0 -1
  245. package/dist/nip/acme/index.d.ts +0 -6
  246. package/dist/nip/acme/index.d.ts.map +0 -1
  247. package/dist/nip/acme/index.js +0 -8
  248. package/dist/nip/acme/index.js.map +0 -1
  249. package/dist/nip/acme/jws.d.ts +0 -31
  250. package/dist/nip/acme/jws.d.ts.map +0 -1
  251. package/dist/nip/acme/jws.js +0 -76
  252. package/dist/nip/acme/jws.js.map +0 -1
  253. package/dist/nip/acme/messages.d.ts +0 -71
  254. package/dist/nip/acme/messages.d.ts.map +0 -1
  255. package/dist/nip/acme/messages.js +0 -4
  256. package/dist/nip/acme/messages.js.map +0 -1
  257. package/dist/nip/acme/server.d.ts +0 -41
  258. package/dist/nip/acme/server.d.ts.map +0 -1
  259. package/dist/nip/acme/server.js +0 -458
  260. package/dist/nip/acme/server.js.map +0 -1
  261. package/dist/nip/acme/wire.d.ts +0 -19
  262. package/dist/nip/acme/wire.d.ts.map +0 -1
  263. package/dist/nip/acme/wire.js +0 -21
  264. package/dist/nip/acme/wire.js.map +0 -1
  265. package/dist/nip/assurance-level.d.ts +0 -19
  266. package/dist/nip/assurance-level.d.ts.map +0 -1
  267. package/dist/nip/assurance-level.js +0 -38
  268. package/dist/nip/assurance-level.js.map +0 -1
  269. package/dist/nip/cert-format.d.ts +0 -5
  270. package/dist/nip/cert-format.d.ts.map +0 -1
  271. package/dist/nip/cert-format.js +0 -6
  272. package/dist/nip/cert-format.js.map +0 -1
  273. package/dist/nip/error-codes.d.ts +0 -25
  274. package/dist/nip/error-codes.d.ts.map +0 -1
  275. package/dist/nip/error-codes.js +0 -32
  276. package/dist/nip/error-codes.js.map +0 -1
  277. package/dist/nip/frames.d.ts +0 -53
  278. package/dist/nip/frames.d.ts.map +0 -1
  279. package/dist/nip/frames.js +0 -106
  280. package/dist/nip/frames.js.map +0 -1
  281. package/dist/nip/identity.d.ts +0 -18
  282. package/dist/nip/identity.d.ts.map +0 -1
  283. package/dist/nip/identity.js +0 -94
  284. package/dist/nip/identity.js.map +0 -1
  285. package/dist/nip/index.d.ts +0 -10
  286. package/dist/nip/index.d.ts.map +0 -1
  287. package/dist/nip/index.js +0 -13
  288. package/dist/nip/index.js.map +0 -1
  289. package/dist/nip/registry.d.ts +0 -3
  290. package/dist/nip/registry.d.ts.map +0 -1
  291. package/dist/nip/registry.js +0 -10
  292. package/dist/nip/registry.js.map +0 -1
  293. package/dist/nip/verifier.d.ts +0 -23
  294. package/dist/nip/verifier.d.ts.map +0 -1
  295. package/dist/nip/verifier.js +0 -90
  296. package/dist/nip/verifier.js.map +0 -1
  297. package/dist/nip/x509/builder.d.ts +0 -35
  298. package/dist/nip/x509/builder.d.ts.map +0 -1
  299. package/dist/nip/x509/builder.js +0 -59
  300. package/dist/nip/x509/builder.js.map +0 -1
  301. package/dist/nip/x509/index.d.ts +0 -4
  302. package/dist/nip/x509/index.d.ts.map +0 -1
  303. package/dist/nip/x509/index.js +0 -6
  304. package/dist/nip/x509/index.js.map +0 -1
  305. package/dist/nip/x509/oids.d.ts +0 -17
  306. package/dist/nip/x509/oids.d.ts.map +0 -1
  307. package/dist/nip/x509/oids.js +0 -23
  308. package/dist/nip/x509/oids.js.map +0 -1
  309. package/dist/nip/x509/verifier.d.ts +0 -26
  310. package/dist/nip/x509/verifier.d.ts.map +0 -1
  311. package/dist/nip/x509/verifier.js +0 -171
  312. package/dist/nip/x509/verifier.js.map +0 -1
  313. package/dist/nop/client.d.ts +0 -34
  314. package/dist/nop/client.d.ts.map +0 -1
  315. package/dist/nop/client.js +0 -90
  316. package/dist/nop/client.js.map +0 -1
  317. package/dist/nop/frames.d.ts +0 -65
  318. package/dist/nop/frames.d.ts.map +0 -1
  319. package/dist/nop/frames.js +0 -148
  320. package/dist/nop/frames.js.map +0 -1
  321. package/dist/nop/index.d.ts +0 -5
  322. package/dist/nop/index.d.ts.map +0 -1
  323. package/dist/nop/index.js +0 -7
  324. package/dist/nop/index.js.map +0 -1
  325. package/dist/nop/models.d.ts +0 -58
  326. package/dist/nop/models.d.ts.map +0 -1
  327. package/dist/nop/models.js +0 -50
  328. package/dist/nop/models.js.map +0 -1
  329. package/dist/nop/nop-types.d.ts +0 -136
  330. package/dist/nop/nop-types.d.ts.map +0 -1
  331. package/dist/nop/nop-types.js +0 -44
  332. package/dist/nop/nop-types.js.map +0 -1
  333. package/dist/nop/registry.d.ts +0 -3
  334. package/dist/nop/registry.d.ts.map +0 -1
  335. package/dist/nop/registry.js +0 -11
  336. package/dist/nop/registry.js.map +0 -1
  337. package/dist/nwp/client.d.ts +0 -22
  338. package/dist/nwp/client.d.ts.map +0 -1
  339. package/dist/nwp/client.js +0 -101
  340. package/dist/nwp/client.js.map +0 -1
  341. package/dist/nwp/error-codes.d.ts +0 -42
  342. package/dist/nwp/error-codes.d.ts.map +0 -1
  343. package/dist/nwp/error-codes.js +0 -53
  344. package/dist/nwp/error-codes.js.map +0 -1
  345. package/dist/nwp/frames.d.ts +0 -46
  346. package/dist/nwp/frames.d.ts.map +0 -1
  347. package/dist/nwp/frames.js +0 -81
  348. package/dist/nwp/frames.js.map +0 -1
  349. package/dist/nwp/index.d.ts +0 -5
  350. package/dist/nwp/index.d.ts.map +0 -1
  351. package/dist/nwp/index.js +0 -7
  352. package/dist/nwp/index.js.map +0 -1
  353. package/dist/nwp/registry.d.ts +0 -3
  354. package/dist/nwp/registry.d.ts.map +0 -1
  355. package/dist/nwp/registry.js +0 -9
  356. package/dist/nwp/registry.js.map +0 -1
  357. package/dist/setup.d.ts +0 -10
  358. package/dist/setup.d.ts.map +0 -1
  359. package/dist/setup.js +0 -29
  360. package/dist/setup.js.map +0 -1
  361. package/src/nwp/error-codes.ts +0 -62
package/CHANGELOG.cn.md CHANGED
@@ -8,94 +8,6 @@
8
8
 
9
9
  ---
10
10
 
11
- ## [1.0.0-alpha.5] —— 2026-05-01
12
-
13
- ### 新增
14
-
15
- - **NWP 错误码常量** —— 新增 `NwpErrorCodes` 命名空间,从 `@labacacia/nps-sdk/nwp` 导出,包含全部 30 个 NWP wire 错误码(auth、query、action、task、subscribe、infrastructure、manifest、topology、reserved-type)。此前版本均未提供。
16
- - **`NpsStatusCodes.NPS_SERVER_UNSUPPORTED`** —— 在 `src/core/status-codes.ts` 新增状态码 `"NPS-SERVER-UNSUPPORTED"`(HTTP 501),符合 spec/status-codes.md alpha.5 更新。
17
- - **`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。
18
-
19
- ### 变更
20
-
21
- - **`AssuranceLevel.fromWire("")` 返回 `Anonymous`** —— `if (wire == null)` 改为 `if (!wire)`,使 `""` 返回 `Anonymous` 而非 `Unknown`(spec §5.1.1 向后兼容修复)。
22
- - **版本升至 `1.0.0-alpha.5`** —— 与 NPS 套件 alpha.5 同步。
23
-
24
- ### 修复
25
-
26
- - **`REPUTATION_GOSSIP_FORK` / `REPUTATION_GOSSIP_SIG_INVALID`** —— 向 `src/nip/error-codes.ts` 新增两个 NIP 声誉 gossip 错误码(RFC-0004 Phase 3)。
27
-
28
- ---
29
-
30
- ## [1.0.0-alpha.4] —— 2026-04-30
31
-
32
- ### 新增
33
-
34
- - **NPS-RFC-0001 Phase 2 —— NCP 连接前导(TypeScript helper 跟进)。**
35
- `src/ncp/preamble.ts` 暴露 `writePreamble(stream)` /
36
- `readPreamble(stream)`,往返字面量 `b"NPS/1.0\n"` 哨兵;
37
- `tests/ncp/preamble.test.ts` 覆盖。让 TypeScript SDK 与 .NET /
38
- Python / Go / Java 在 alpha.4 的 preamble helper 持平。
39
- - **NPS-RFC-0002 Phase A/B —— X.509 NID 证书 + ACME `agent-01`
40
- (TypeScript 端口)。** 新增 `src/nip/` 子模块:
41
- - `nip/x509/` —— X.509 NID 证书 builder + verifier
42
- (`x509.Builder`、`x509.Verifier`)。
43
- - `nip/acme/` —— ACME `agent-01` 客户端 + 服务端参考实现
44
- (`AcmeServer`、`AcmeClient`);按 NPS-RFC-0002 Phase B 的 JWS
45
- 签名 wire 包络。
46
- - `nip/assurance-level.ts` —— Agent 身份保证等级
47
- (`anonymous` / `attested` / `verified`),承接 NPS-RFC-0003。
48
- - `nip/cert-format.ts` —— IdentFrame `cert_format` 判别器
49
- (`v1` Ed25519 vs. `x509`)。
50
- - `nip/error-codes.ts` —— NIP 错误码命名空间。
51
- - `nip/verifier.ts` —— dual-trust IdentFrame 验证器(v1 + X.509)。
52
- - 20 个新测试覆盖 preamble 往返、X.509 签发 + 解析、dual-trust 验证、
53
- ACME agent-01 全流程。总数:284 tests 全绿(alpha.3 时 264)。
54
-
55
- ### 变更
56
-
57
- - 分发版本升至 `1.0.0-alpha.4`。
58
- - `src/nip/frames.ts` —— IdentFrame wire 形状扩展,可携带可选的
59
- `cert_format` 判别器 + `x509_chain` 字段,与 v1 Ed25519 字段并存。
60
- alpha.3 写出的 v1 IdentFrame 仍可被 alpha.4 验签。
61
-
62
- ### npm 发布说明
63
-
64
- - 本仓库 / tag 是 `@labacacia/nps-sdk` `1.0.0-alpha.4` 的权威参考。
65
- 延续 alpha.3 的情况,npm publish 可能需要带 2FA-bypass 的 granular
66
- access token —— 如果 npm registry 上的版本暂时落后于本仓库 tag,
67
- 以 tag 为准;下一次 registry cut 后 `npm install` 即可解析到本
68
- commit。
69
-
70
- ### 套件级 alpha.4 要点
71
-
72
- - **NPS-RFC-0002 X.509 + ACME** —— 完整跨 SDK 端口波(.NET / Java /
73
- Python / TypeScript / Go / Rust)。
74
- - **NPS-CR-0002 —— Anchor Node topology 查询** —— `topology.snapshot`
75
- / `topology.stream`(.NET 参考 + L2 conformance)。TypeScript 消费
76
- 侧 helper 后续版本跟进。
77
- - **`nps-registry` SQLite 实仓** + **`nps-ledger` Phase 2**
78
- (RFC 9162 Merkle + STH + inclusion proof)已在 daemon 仓库交付。
79
-
80
- ---
81
-
82
- ## [1.0.0-alpha.3] —— 2026-04-25
83
-
84
- ### Changed
85
-
86
- - 版本升级至 `1.0.0-alpha.3`,与 NPS `v1.0.0-alpha.3` 套件同步。本次 TypeScript SDK 无功能变更。
87
- - 264 tests, ≥98% 覆盖率仍全绿。
88
-
89
- ### 套件级 alpha.3 要点(各语言 helper 在 alpha.4 跟进)
90
-
91
- - **NPS-RFC-0001 —— NCP 连接前导**(Accepted)。原生模式连接现以字面量 `b"NPS/1.0\n"`(8 字节)开头。.NET SDK 已落地参考实现;TypeScript helper 在 alpha.4 跟进。
92
- - **NPS-RFC-0003 —— Agent 身份保证等级**(Accepted)。NIP IdentFrame 与 NWM 新增三态 `assurance_level`(`anonymous`/`attested`/`verified`)。.NET 参考类型已落地;TypeScript 同步在 alpha.4。
93
- - **NPS-RFC-0004 —— NID 声誉日志(CT 风格)**(Accepted)。append-only Merkle 日志条目结构发布;.NET 参考签名器已落地(并以 `nps-ledger` daemon Phase 1 形态发布)。TypeScript helper 在 alpha.4 跟进。
94
- - **NPS-CR-0001 —— Anchor / Bridge 节点拆分。** 旧的 "Gateway Node" 角色更名为 **Anchor Node**;"NPS↔外部协议翻译" 单独成为 **Bridge Node** 类型。AnnounceFrame 新增 `node_kind` / `cluster_anchor` / `bridge_protocols`。源代码层面变更落在 `spec/` + .NET 参考实现。
95
- - **6 个 NPS 常驻 daemon。** NPS-Dev 新建 `daemons/` 目录,定义 `npsd` / `nps-runner` / `nps-gateway` / `nps-registry` / `nps-cloud-ca` / `nps-ledger`;其中 `npsd` 提供 L1 功能性参考实现,其余为 Phase 1 骨架。
96
-
97
- ---
98
-
99
11
  ## [1.0.0-alpha.2] —— 2026-04-19
100
12
 
101
13
  ### Fixed
@@ -123,8 +35,5 @@
123
35
 
124
36
  作为 NPS 套件 `v1.0.0-alpha.1` 的一部分首次公开 alpha。
125
37
 
126
- [1.0.0-alpha.5]: https://github.com/labacacia/NPS-sdk-ts/releases/tag/v1.0.0-alpha.5
127
- [1.0.0-alpha.4]: https://gitee.com/labacacia/NPS-sdk-ts/releases/tag/v1.0.0-alpha.4
128
- [1.0.0-alpha.3]: https://github.com/LabAcacia/NPS-Dev/releases/tag/v1.0.0-alpha.3
129
- [1.0.0-alpha.2]: https://github.com/LabAcacia/NPS-Dev/releases/tag/v1.0.0-alpha.2
130
- [1.0.0-alpha.1]: https://github.com/LabAcacia/NPS-Dev/releases/tag/v1.0.0-alpha.1
38
+ [1.0.0-alpha.2]: https://github.com/LabAcacia/nps/releases/tag/v1.0.0-alpha.2
39
+ [1.0.0-alpha.1]: https://github.com/LabAcacia/nps/releases/tag/v1.0.0-alpha.1
package/CHANGELOG.md CHANGED
@@ -8,103 +8,6 @@ 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.5] — 2026-05-01
12
-
13
- ### Added
14
-
15
- - **NWP error code constants** — new `NwpErrorCodes` namespace exported from `@labacacia/nps-sdk/nwp` with all 30 NWP wire error codes (auth, query, action, task, subscribe, infrastructure, manifest, topology, reserved-type). Missing from previous releases.
16
- - **`NpsStatusCodes.NPS_SERVER_UNSUPPORTED`** — new status code `"NPS-SERVER-UNSUPPORTED"` (HTTP 501) in `src/core/status-codes.ts`, per spec/status-codes.md alpha.5 update.
17
- - **`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.
18
-
19
- ### Changed
20
-
21
- - **`AssuranceLevel.fromWire("")` returns `Anonymous`** — `if (wire == null)` changed to `if (!wire)` so `""` returns `Anonymous` instead of `Unknown` (spec §5.1.1 backward-compat fix).
22
- - **Version bump to `1.0.0-alpha.5`** — synchronized with NPS suite alpha.5 release.
23
-
24
- ### Fixed
25
-
26
- - **`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).
27
-
28
- ---
29
-
30
- ## [1.0.0-alpha.4] — 2026-04-30
31
-
32
- ### Added
33
-
34
- - **NPS-RFC-0001 Phase 2 — NCP connection preamble (TypeScript helper
35
- parity).** `src/ncp/preamble.ts` exposes `writePreamble(stream)` and
36
- `readPreamble(stream)` round-tripping the literal `b"NPS/1.0\n"`
37
- sentinel; matched by `tests/ncp/preamble.test.ts`. Brings TypeScript
38
- in line with the .NET / Python / Go / Java preamble helpers shipped
39
- at alpha.4.
40
- - **NPS-RFC-0002 Phase A/B — X.509 NID certificates + ACME `agent-01`
41
- (TypeScript port).** New surface under `src/nip/`:
42
- - `nip/x509/` — X.509 NID certificate builder + verifier
43
- (`x509.Builder`, `x509.Verifier`).
44
- - `nip/acme/` — ACME `agent-01` client + server reference
45
- (`AcmeServer`, `AcmeClient`); JWS-signed wire envelope per
46
- NPS-RFC-0002 Phase B.
47
- - `nip/assurance-level.ts` — agent identity assurance levels
48
- (`anonymous` / `attested` / `verified`) per NPS-RFC-0003.
49
- - `nip/cert-format.ts` — IdentFrame `cert_format` discriminator
50
- (`v1` Ed25519 vs. `x509`).
51
- - `nip/error-codes.ts` — NIP error code namespace strings.
52
- - `nip/verifier.ts` — dual-trust IdentFrame verifier (v1 + X.509).
53
- - 20 new tests covering preamble round-trip, X.509 issuance + parsing,
54
- dual-trust verification, and ACME agent-01 round-trip. Total: 284
55
- tests green (was 264 at alpha.3).
56
-
57
- ### Changed
58
-
59
- - Distribution version bumped to `1.0.0-alpha.4`.
60
- - `src/nip/frames.ts` — IdentFrame wire shape extended with optional
61
- `cert_format` discriminator + `x509_chain` field alongside the
62
- existing v1 Ed25519 fields. v1 IdentFrames written by alpha.3
63
- consumers continue to verify unchanged.
64
-
65
- ### Note: npm publish status
66
-
67
- - This repo / tag is the canonical `1.0.0-alpha.4` reference for
68
- `@labacacia/nps-sdk`. As at the alpha.3 ship cycle, npm publish
69
- may require a granular access token with 2FA-bypass enabled — if
70
- the registry version lags this repo's tag, the tag is the
71
- authoritative artifact and `npm install` against the next
72
- registry cut will resolve to this commit.
73
-
74
- ### Suite-wide highlights at alpha.4
75
-
76
- - **NPS-RFC-0002 X.509 + ACME** — full cross-SDK port wave (.NET /
77
- Java / Python / TypeScript / Go / Rust). Servers can now issue
78
- dual-trust IdentFrames (v1 Ed25519 + X.509 leaf cert chained to a
79
- self-signed root) and self-onboard NIDs over ACME's `agent-01`
80
- challenge type.
81
- - **NPS-CR-0002 — Anchor Node topology queries** — `topology.snapshot`
82
- / `topology.stream` query types (.NET reference + L2 conformance
83
- suite). TypeScript consumer-side helpers planned for a later
84
- release.
85
- - **`nps-registry` SQLite-backed real registry** + **`nps-ledger`
86
- Phase 2** (RFC 9162 Merkle + STH + inclusion proofs) shipped in the
87
- daemon repos.
88
-
89
- ---
90
-
91
- ## [1.0.0-alpha.3] — 2026-04-25
92
-
93
- ### Changed
94
-
95
- - 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.
96
- - 264 tests, ≥98% coverage still green.
97
-
98
- ### Suite-wide highlights at alpha.3 (per-language helpers planned for alpha.4)
99
-
100
- - **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.
101
- - **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.
102
- - **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.
103
- - **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.
104
- - **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.
105
-
106
- ---
107
-
108
11
  ## [1.0.0-alpha.2] — 2026-04-19
109
12
 
110
13
  ### Fixed
@@ -132,8 +35,5 @@ Until NPS reaches v1.0 stable, every repository in the suite is synchronized to
132
35
 
133
36
  First public alpha as part of the NPS suite `v1.0.0-alpha.1` release.
134
37
 
135
- [1.0.0-alpha.5]: https://github.com/labacacia/NPS-sdk-ts/releases/tag/v1.0.0-alpha.5
136
- [1.0.0-alpha.4]: https://github.com/labacacia/NPS-sdk-ts/releases/tag/v1.0.0-alpha.4
137
- [1.0.0-alpha.3]: https://github.com/LabAcacia/NPS-Dev/releases/tag/v1.0.0-alpha.3
138
- [1.0.0-alpha.2]: https://github.com/LabAcacia/NPS-Dev/releases/tag/v1.0.0-alpha.2
139
- [1.0.0-alpha.1]: https://github.com/LabAcacia/NPS-Dev/releases/tag/v1.0.0-alpha.1
38
+ [1.0.0-alpha.2]: https://github.com/LabAcacia/nps/releases/tag/v1.0.0-alpha.2
39
+ [1.0.0-alpha.1]: https://github.com/LabAcacia/nps/releases/tag/v1.0.0-alpha.1
File without changes
package/CONTRIBUTING.md CHANGED
File without changes
package/LICENSE CHANGED
File without changes
package/NOTICE CHANGED
File without changes
package/README.cn.md CHANGED
@@ -7,24 +7,17 @@
7
7
 
8
8
  ## 状态
9
9
 
10
- **v1.0.0-alpha.5 —— NWP 错误码 + NPS 状态码扩展** · 5 个协议 · 284 个测试 · 覆盖率 ≥ 98%
10
+ **v1.0.0-alpha.6 RFC-0002 SDK 端口波(第三棒)** · 5 个协议 · 271 个测试 · 覆盖率 ≥ 98%
11
11
 
12
12
  | 协议 | 类 | 状态 |
13
13
  |------|----|------|
14
14
  | NCP — Neural Communication Protocol | 帧、编解码器 | ✅ |
15
- | NWP — Neural Web Protocol | `NwpClient`、`NwpErrorCodes` | ✅ |
15
+ | NWP — Neural Web Protocol | `NwpClient` | ✅ |
16
16
  | NIP — Neural Identity Protocol | `NipIdentity`、`NipIdentVerifier`(RFC-0002 §8.1 双信任)、`AssuranceLevel`(RFC-0003)、`nip.x509` + `nip.acme` | ✅ |
17
- | NDP — Neural Discovery Protocol | `InMemoryNdpRegistry`、`NdpAnnounceValidator`、`resolveWithDns`(DNS TXT 回退)、`DnsTxtLookup`、`SystemDnsTxtLookup`、`parseNpsTxtRecord` | ✅ |
17
+ | NDP — Neural Discovery Protocol | `InMemoryNdpRegistry`、`NdpAnnounceValidator` | ✅ |
18
18
  | NOP — Neural Orchestration Protocol | `NopClient` | ✅ |
19
19
 
20
- **alpha.5 新增:**
21
-
22
- - `NwpErrorCodes` —— 从 `@labacacia/nps-sdk/nwp` 导出,包含 30 个 NWP wire 错误码字符串常量(`NWP-AUTH-*`、`NWP-QUERY-*`、`NWP-TOPOLOGY-*`、`NWP-RESERVED-TYPE-UNSUPPORTED` 等)。
23
- - `NpsStatusCodes.NPS_SERVER_UNSUPPORTED` —— 新状态码 `"NPS-SERVER-UNSUPPORTED"`(HTTP 501)。
24
- - `NipErrorCodes.REPUTATION_GOSSIP_FORK` / `.REPUTATION_GOSSIP_SIG_INVALID` —— RFC-0004 Phase 3 gossip 错误码。
25
- - `AssuranceLevel.fromWire("")` 改为返回 `Anonymous`(spec §5.1.1 修复)。
26
-
27
- **alpha.4 新增** —— 完整的 NPS-RFC-0002 X.509 + ACME `agent-01` NID 证书原语:
20
+ **早期新增** —— 完整的 NPS-RFC-0002 X.509 + ACME `agent-01` NID 证书原语:
28
21
 
29
22
  - `nip.x509` —— `issueLeaf` / `issueRoot` / `verify`(基于 `@peculiar/x509` + 原生 Web Crypto Ed25519)。
30
23
  - `nip.acme` —— `AcmeClient` + 进程内 `AcmeServer` + JWS / messages helpers(RFC 8555 + RFC 8037 EdDSA)。
@@ -165,4 +158,4 @@ npm run build
165
158
 
166
159
  ## 许可证
167
160
 
168
- Apache 2.0 —— 详见 [LICENSE](../../LICENSE)。
161
+ Apache 2.0 —— 详见 [LICENSE](https://github.com/labacacia/NPS-Dev/blob/main/LICENSE)。
package/README.md CHANGED
@@ -7,24 +7,17 @@ Part of the [LabAcacia](https://github.com/LabAcacia) / INNO LOTUS PTY LTD open-
7
7
 
8
8
  ## Status
9
9
 
10
- **v1.0.0-alpha.5NWP error codes + NPS status code extension** · 5 protocols · 284 tests · ≥ 98% coverage
10
+ **v1.0.0-alpha.6RFC-0002 cross-SDK port (third language)** · 5 protocols · 271 tests · ≥ 98% coverage
11
11
 
12
12
  | Protocol | Class | Status |
13
13
  |----------|-------|--------|
14
14
  | NCP — Neural Communication Protocol | Framing, codec | ✅ |
15
- | NWP — Neural Web Protocol | `NwpClient`, `NwpErrorCodes` | ✅ |
15
+ | NWP — Neural Web Protocol | `NwpClient` | ✅ |
16
16
  | NIP — Neural Identity Protocol | `NipIdentity`, `NipIdentVerifier` (RFC-0002 §8.1 dual-trust), `AssuranceLevel` (RFC-0003), `nip.x509` + `nip.acme` | ✅ |
17
- | NDP — Neural Discovery Protocol | `InMemoryNdpRegistry`, `NdpAnnounceValidator`, `resolveWithDns` (DNS TXT fallback), `DnsTxtLookup`, `SystemDnsTxtLookup`, `parseNpsTxtRecord` | ✅ |
17
+ | NDP — Neural Discovery Protocol | `InMemoryNdpRegistry`, `NdpAnnounceValidator` | ✅ |
18
18
  | NOP — Neural Orchestration Protocol | `NopClient` | ✅ |
19
19
 
20
- **alpha.5 additions:**
21
-
22
- - `NwpErrorCodes` — exported from `@labacacia/nps-sdk/nwp`; 30 NWP wire error code constants (`NWP-AUTH-*`, `NWP-QUERY-*`, `NWP-TOPOLOGY-*`, `NWP-RESERVED-TYPE-UNSUPPORTED`, …).
23
- - `NpsStatusCodes.NPS_SERVER_UNSUPPORTED` — new `"NPS-SERVER-UNSUPPORTED"` status code (HTTP 501) in `src/core/status-codes.ts`.
24
- - `NipErrorCodes.REPUTATION_GOSSIP_FORK` / `.REPUTATION_GOSSIP_SIG_INVALID` — RFC-0004 Phase 3 gossip error codes.
25
- - `AssuranceLevel.fromWire("")` returns `Anonymous` instead of `Unknown` (spec §5.1.1 fix).
26
-
27
- **alpha.4 additions** — Full NPS-RFC-0002 X.509 + ACME `agent-01` NID certificate primitives:
20
+ **Earlier additions** — Full NPS-RFC-0002 X.509 + ACME `agent-01` NID certificate primitives:
28
21
 
29
22
  - `nip.x509` — `issueLeaf` / `issueRoot` / `verify` (built on `@peculiar/x509` + native Web Crypto Ed25519).
30
23
  - `nip.acme` — `AcmeClient` + in-process `AcmeServer` + JWS / message helpers (RFC 8555 + EdDSA per RFC 8037).
@@ -165,4 +158,4 @@ node node_modules/tsup/dist/cli-default.js
165
158
 
166
159
  ## License
167
160
 
168
- Apache 2.0 — see [LICENSE](../../LICENSE)
161
+ Apache 2.0 — see [LICENSE](https://github.com/labacacia/NPS-Dev/blob/main/LICENSE)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/doc/overview.md CHANGED
File without changes
File without changes
@@ -25,7 +25,7 @@ docker compose up -d
25
25
 
26
26
  ## API
27
27
 
28
- Same endpoints as all other NIP CA Server implementations — see [NPS-3 §8](../../spec/NPS-3-NIP.md).
28
+ Same endpoints as all other NIP CA Server implementations — see [NPS-3 §8](https://github.com/labacacia/NPS-Release/blob/main/spec/NPS-3-NIP.md).
29
29
 
30
30
  ## Local Development
31
31
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labacacia/nps-sdk",
3
- "version": "1.0.0-alpha.5",
3
+ "version": "1.0.0-alpha.6",
4
4
  "description": "TypeScript SDK for the Neural Protocol Suite (NPS) — NCP, NWP, NIP, NDP, NOP",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
File without changes
package/src/core/cache.ts CHANGED
File without changes
File without changes
package/src/core/codec.ts CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/src/core/index.ts CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/src/ncp/frames.ts CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
package/src/ndp/frames.ts CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -4,12 +4,11 @@
4
4
  /**
5
5
  * OID constants for NPS X.509 certificates per NPS-RFC-0002 §4.
6
6
  *
7
- * The 1.3.6.1.4.1.99999 arc is provisional pending IANA Private Enterprise
8
- * Number assignment (RFC-0002 §10 OQ-2). All implementations MUST update
9
- * these constants when the official PEN is granted.
7
+ * The 1.3.6.1.4.1.65715 arc is the LabAcacia IANA-assigned Private Enterprise
8
+ * Number (PEN 65715, NPS-CR-0004, 2026-05-08).
10
9
  */
11
10
 
12
- export const LAB_ACACIA_PEN_ARC = "1.3.6.1.4.1.99999";
11
+ export const LAB_ACACIA_PEN_ARC = "1.3.6.1.4.1.65715";
13
12
  export const EKU_ARC = `${LAB_ACACIA_PEN_ARC}.1`;
14
13
  export const EXTENSION_ARC = `${LAB_ACACIA_PEN_ARC}.2`;
15
14
 
package/src/nop/client.ts CHANGED
File without changes
package/src/nop/frames.ts CHANGED
File without changes
package/src/nop/index.ts CHANGED
File without changes
package/src/nop/models.ts CHANGED
File without changes
File without changes
File without changes
package/src/nwp/client.ts CHANGED
File without changes
package/src/nwp/frames.ts CHANGED
File without changes
package/src/nwp/index.ts CHANGED
@@ -4,4 +4,3 @@
4
4
  export * from "./frames.js";
5
5
  export * from "./registry.js";
6
6
  export * from "./client.js";
7
- export * as NwpErrorCodes from "./error-codes.js";
File without changes
package/src/setup.ts CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/tests/nip.test.ts CHANGED
File without changes
package/tests/nop.test.ts CHANGED
File without changes
package/tests/nwp.test.ts CHANGED
File without changes
package/tsconfig.json CHANGED
File without changes
package/tsup.config.ts CHANGED
File without changes
package/vitest.config.ts CHANGED
File without changes
@@ -1,42 +0,0 @@
1
- import type { AnchorFrame } from "../ncp/frames/anchor-frame.js";
2
- /**
3
- * AnchorFrame cache with:
4
- * - TTL-based expiry (NPS-1 §5.3)
5
- * - LRU eviction at maxSize (NPS-1 §9, default 1000)
6
- * - Anchor poisoning detection (NPS-1 §7.2)
7
- */
8
- export declare class AnchorCache {
9
- private readonly cache;
10
- private readonly maxSize;
11
- private readonly getNow;
12
- constructor(options?: {
13
- maxSize?: number;
14
- getNow?: () => number;
15
- });
16
- /**
17
- * Cache an AnchorFrame.
18
- *
19
- * - ttl=0: frame is valid but not cached (NPS-1 §4.1)
20
- * - Same anchor_id + same schema: idempotent (no-op)
21
- * - Same anchor_id + different schema: NCP-ANCHOR-ID-MISMATCH (poison detection)
22
- *
23
- * @throws {NcpError} NCP-ANCHOR-ID-MISMATCH on anchor poisoning.
24
- */
25
- set(frame: AnchorFrame): void;
26
- /**
27
- * Get a cached AnchorFrame by anchor_id.
28
- *
29
- * @returns The cached frame, or null if not found or expired.
30
- */
31
- get(anchorId: string): AnchorFrame | null;
32
- /**
33
- * Get a cached AnchorFrame, throwing if not found.
34
- * @throws {NcpError} NCP-ANCHOR-NOT-FOUND if not in cache or expired.
35
- */
36
- getRequired(anchorId: string): AnchorFrame;
37
- /** Current cache size. */
38
- get size(): number;
39
- /** Evict the least recently accessed entry. */
40
- private evictLru;
41
- }
42
- //# sourceMappingURL=anchor-cache.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"anchor-cache.d.ts","sourceRoot":"","sources":["../../src/core/anchor-cache.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAQjE;;;;;GAKG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAE1B,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,MAAM,CAAA;KAAE;IAKjE;;;;;;;;OAQG;IACH,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAiC7B;;;;OAIG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAczC;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW;IAW1C,0BAA0B;IAC1B,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,+CAA+C;IAC/C,OAAO,CAAC,QAAQ;CAejB"}