@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
@@ -1,37 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- // Copyright (c) 2026 LabAcacia / INNO LOTUS PTY LTD
3
- //
4
- // DiffFrame (0x02) — Incremental data patch
5
- // NPS-1 §4.2
6
- import { NcpError, EncodingTier } from "../../core/frame-header.js";
7
- import { isValidPatchFormat } from "../ncp-patch-format.js";
8
- /**
9
- * Validate DiffFrame base_seq against current sequence.
10
- * @throws {NcpError} NCP-STREAM-SEQ-GAP if sequences don't match.
11
- */
12
- export function validateDiffSeq(frame, currentSeq) {
13
- if (frame.base_seq !== currentSeq) {
14
- throw new NcpError("NCP-STREAM-SEQ-GAP", `DiffFrame base_seq=${frame.base_seq} does not match current seq=${currentSeq}`);
15
- }
16
- }
17
- /**
18
- * Validate DiffFrame patch_format against the encoding tier.
19
- *
20
- * binary_bitset is only supported on Tier-2 (MsgPack) frames.
21
- * Unknown patch_format values are also rejected.
22
- *
23
- * @throws {NcpError} NCP-DIFF-FORMAT-UNSUPPORTED if binary_bitset on non-Tier-2,
24
- * or if patch_format is an unknown value.
25
- */
26
- export function validateDiffFrame(frame, encodingTier) {
27
- const fmt = frame.patch_format;
28
- // Unknown patch_format
29
- if (fmt !== undefined && !isValidPatchFormat(fmt)) {
30
- throw new NcpError("NCP-DIFF-FORMAT-UNSUPPORTED", `Unknown patch_format "${String(fmt)}"`);
31
- }
32
- // binary_bitset requires Tier-2 MsgPack
33
- if (fmt === "binary_bitset" && encodingTier !== EncodingTier.MsgPack) {
34
- throw new NcpError("NCP-DIFF-FORMAT-UNSUPPORTED", "patch_format=binary_bitset requires Tier-2 MsgPack encoding");
35
- }
36
- }
37
- //# sourceMappingURL=diff-frame.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"diff-frame.js","sourceRoot":"","sources":["../../../src/ncp/frames/diff-frame.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,oDAAoD;AACpD,EAAE;AACF,4CAA4C;AAC5C,aAAa;AAEb,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAoB,MAAM,wBAAwB,CAAC;AAkB9E;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAgB,EAAE,UAAkB;IAClE,IAAI,KAAK,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;QAClC,MAAM,IAAI,QAAQ,CAChB,oBAAoB,EACpB,sBAAsB,KAAK,CAAC,QAAQ,+BAA+B,UAAU,EAAE,CAChF,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAgB,EAChB,YAAmC;IAEnC,MAAM,GAAG,GAAG,KAAK,CAAC,YAAY,CAAC;IAE/B,uBAAuB;IACvB,IAAI,GAAG,KAAK,SAAS,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,QAAQ,CAChB,6BAA6B,EAC7B,yBAAyB,MAAM,CAAC,GAAG,CAAC,GAAG,CACxC,CAAC;IACJ,CAAC;IAED,wCAAwC;IACxC,IAAI,GAAG,KAAK,eAAe,IAAI,YAAY,KAAK,YAAY,CAAC,OAAO,EAAE,CAAC;QACrE,MAAM,IAAI,QAAQ,CAChB,6BAA6B,EAC7B,6DAA6D,CAC9D,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,16 +0,0 @@
1
- /** Unified error frame shared across all NPS protocol layers. */
2
- export interface ErrorFrame {
3
- /** Fixed value "0xFE". */
4
- frame: string;
5
- /** NPS status code, e.g. "NPS-CLIENT-NOT-FOUND". */
6
- status: string;
7
- /** Protocol-level error code, e.g. "NCP-ANCHOR-NOT-FOUND". */
8
- error: string;
9
- /** Human-readable error description. */
10
- message?: string;
11
- /** Structured error details (e.g. anchor_ref, stream_id). */
12
- details?: Record<string, unknown>;
13
- }
14
- /** Type guard for ErrorFrame. */
15
- export declare function isErrorFrame(obj: unknown): obj is ErrorFrame;
16
- //# sourceMappingURL=error-frame.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-frame.d.ts","sourceRoot":"","sources":["../../../src/ncp/frames/error-frame.ts"],"names":[],"mappings":"AAMA,iEAAiE;AACjE,MAAM,WAAW,UAAU;IACzB,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,iCAAiC;AACjC,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,UAAU,CAI5D"}
@@ -1,13 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- // Copyright (c) 2026 LabAcacia / INNO LOTUS PTY LTD
3
- //
4
- // ErrorFrame (0xFE) — Unified error frame for all NPS protocol layers
5
- // NPS-1 §4.7
6
- /** Type guard for ErrorFrame. */
7
- export function isErrorFrame(obj) {
8
- if (typeof obj !== "object" || obj === null)
9
- return false;
10
- const o = obj;
11
- return o.frame === "0xFE" && typeof o.status === "string" && typeof o.error === "string";
12
- }
13
- //# sourceMappingURL=error-frame.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-frame.js","sourceRoot":"","sources":["../../../src/ncp/frames/error-frame.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,oDAAoD;AACpD,EAAE;AACF,sEAAsE;AACtE,aAAa;AAgBb,iCAAiC;AACjC,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC1D,MAAM,CAAC,GAAG,GAA8B,CAAC;IACzC,OAAO,CAAC,CAAC,KAAK,KAAK,MAAM,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC;AAC3F,CAAC"}
@@ -1,21 +0,0 @@
1
- export interface HelloFrame {
2
- frame: string;
3
- nps_version: string;
4
- min_version?: string;
5
- supported_encodings: string[];
6
- supported_protocols: string[];
7
- agent_id?: string;
8
- max_frame_payload?: number;
9
- ext_support?: boolean;
10
- max_concurrent_streams?: number;
11
- e2e_enc_algorithms?: string[];
12
- }
13
- /**
14
- * Validate a HelloFrame.
15
- *
16
- * Required fields: nps_version, supported_encodings (non-empty), supported_protocols (non-empty).
17
- *
18
- * @throws {NcpError} NPS-CLIENT-BAD-FRAME if any required field is missing or empty.
19
- */
20
- export declare function validateHelloFrame(frame: HelloFrame): void;
21
- //# sourceMappingURL=hello-frame.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hello-frame.d.ts","sourceRoot":"","sources":["../../../src/ncp/frames/hello-frame.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAqB1D"}
@@ -1,25 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- // Copyright (c) 2026 LabAcacia / INNO LOTUS PTY LTD
3
- //
4
- // HelloFrame (0x06) — Native-mode client handshake
5
- // NPS-1 §4.6
6
- import { NcpError } from "../../core/frame-header.js";
7
- /**
8
- * Validate a HelloFrame.
9
- *
10
- * Required fields: nps_version, supported_encodings (non-empty), supported_protocols (non-empty).
11
- *
12
- * @throws {NcpError} NPS-CLIENT-BAD-FRAME if any required field is missing or empty.
13
- */
14
- export function validateHelloFrame(frame) {
15
- if (!frame.nps_version) {
16
- throw new NcpError("NPS-CLIENT-BAD-FRAME", "HelloFrame missing required field: nps_version");
17
- }
18
- if (!frame.supported_encodings || frame.supported_encodings.length === 0) {
19
- throw new NcpError("NPS-CLIENT-BAD-FRAME", "HelloFrame missing required field: supported_encodings (must be non-empty)");
20
- }
21
- if (!frame.supported_protocols || frame.supported_protocols.length === 0) {
22
- throw new NcpError("NPS-CLIENT-BAD-FRAME", "HelloFrame missing required field: supported_protocols (must be non-empty)");
23
- }
24
- }
25
- //# sourceMappingURL=hello-frame.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hello-frame.js","sourceRoot":"","sources":["../../../src/ncp/frames/hello-frame.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,oDAAoD;AACpD,EAAE;AACF,mDAAmD;AACnD,aAAa;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAetD;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAiB;IAClD,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;QACvB,MAAM,IAAI,QAAQ,CAChB,sBAAsB,EACtB,gDAAgD,CACjD,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,mBAAmB,IAAI,KAAK,CAAC,mBAAmB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzE,MAAM,IAAI,QAAQ,CAChB,sBAAsB,EACtB,4EAA4E,CAC7E,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,mBAAmB,IAAI,KAAK,CAAC,mBAAmB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzE,MAAM,IAAI,QAAQ,CAChB,sBAAsB,EACtB,4EAA4E,CAC7E,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,16 +0,0 @@
1
- export interface StreamFrame {
2
- frame: string;
3
- stream_id: string;
4
- seq: number;
5
- is_last: boolean;
6
- anchor_ref?: string;
7
- data: unknown[];
8
- window_size?: number;
9
- error_code?: string;
10
- }
11
- /**
12
- * Validate stream_id is a valid UUID v4.
13
- * @throws {NcpError} NPS-CLIENT-BAD-FRAME if stream_id is not a valid UUID v4.
14
- */
15
- export declare function validateStreamFrame(frame: StreamFrame): void;
16
- //# sourceMappingURL=stream-frame.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-frame.d.ts","sourceRoot":"","sources":["../../../src/ncp/frames/stream-frame.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAO5D"}
@@ -1,18 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- // Copyright (c) 2026 LabAcacia / INNO LOTUS PTY LTD
3
- //
4
- // StreamFrame (0x03) — Streaming data chunks with flow control
5
- // NPS-1 §4.3
6
- import { NcpError } from "../../core/frame-header.js";
7
- // UUID v4 format: xxxxxxxx-xxxx-4xxx-[89ab]xxx-xxxxxxxxxxxx
8
- const UUID_V4_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
9
- /**
10
- * Validate stream_id is a valid UUID v4.
11
- * @throws {NcpError} NPS-CLIENT-BAD-FRAME if stream_id is not a valid UUID v4.
12
- */
13
- export function validateStreamFrame(frame) {
14
- if (!UUID_V4_RE.test(frame.stream_id)) {
15
- throw new NcpError("NPS-CLIENT-BAD-FRAME", `stream_id "${frame.stream_id}" is not a valid UUID v4`);
16
- }
17
- }
18
- //# sourceMappingURL=stream-frame.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream-frame.js","sourceRoot":"","sources":["../../../src/ncp/frames/stream-frame.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,oDAAoD;AACpD,EAAE;AACF,+DAA+D;AAC/D,aAAa;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAatD,4DAA4D;AAC5D,MAAM,UAAU,GACd,wEAAwE,CAAC;AAE3E;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAkB;IACpD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,QAAQ,CAChB,sBAAsB,EACtB,cAAc,KAAK,CAAC,SAAS,0BAA0B,CACxD,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,94 +0,0 @@
1
- import { EncodingTier, FrameType } from "../core/frames.js";
2
- import type { NpsFrame } from "../core/codec.js";
3
- export interface SchemaField {
4
- name: string;
5
- type: string;
6
- semantic?: string;
7
- nullable?: boolean;
8
- }
9
- export interface FrameSchema {
10
- fields: readonly SchemaField[];
11
- }
12
- export declare class AnchorFrame implements NpsFrame {
13
- readonly anchorId: string;
14
- readonly schema: FrameSchema;
15
- readonly ttl: number;
16
- readonly frameType = FrameType.ANCHOR;
17
- readonly preferredTier = EncodingTier.MSGPACK;
18
- constructor(anchorId: string, schema: FrameSchema, ttl?: number);
19
- toDict(): Record<string, unknown>;
20
- static fromDict(data: Record<string, unknown>): AnchorFrame;
21
- }
22
- export interface JsonPatchOperation {
23
- op: string;
24
- path: string;
25
- value?: unknown;
26
- }
27
- export declare class DiffFrame implements NpsFrame {
28
- readonly anchorRef: string;
29
- readonly baseSeq: number;
30
- readonly patch: readonly JsonPatchOperation[];
31
- readonly entityId?: string | undefined;
32
- readonly frameType = FrameType.DIFF;
33
- readonly preferredTier = EncodingTier.MSGPACK;
34
- constructor(anchorRef: string, baseSeq: number, patch: readonly JsonPatchOperation[], entityId?: string | undefined);
35
- toDict(): Record<string, unknown>;
36
- static fromDict(data: Record<string, unknown>): DiffFrame;
37
- }
38
- export declare class StreamFrame implements NpsFrame {
39
- readonly streamId: string;
40
- readonly seq: number;
41
- readonly isLast: boolean;
42
- readonly data: readonly Record<string, unknown>[];
43
- readonly anchorRef?: string | undefined;
44
- readonly windowSize?: number | undefined;
45
- readonly frameType = FrameType.STREAM;
46
- readonly preferredTier = EncodingTier.MSGPACK;
47
- constructor(streamId: string, seq: number, isLast: boolean, data: readonly Record<string, unknown>[], anchorRef?: string | undefined, windowSize?: number | undefined);
48
- toDict(): Record<string, unknown>;
49
- static fromDict(data: Record<string, unknown>): StreamFrame;
50
- }
51
- export declare class CapsFrame implements NpsFrame {
52
- readonly anchorRef: string;
53
- readonly count: number;
54
- readonly data: readonly Record<string, unknown>[];
55
- readonly nextCursor?: string | undefined;
56
- readonly tokenEst?: number | undefined;
57
- readonly cached?: boolean | undefined;
58
- readonly tokenizerUsed?: string | undefined;
59
- readonly frameType = FrameType.CAPS;
60
- readonly preferredTier = EncodingTier.MSGPACK;
61
- constructor(anchorRef: string, count: number, data: readonly Record<string, unknown>[], nextCursor?: string | undefined, tokenEst?: number | undefined, cached?: boolean | undefined, tokenizerUsed?: string | undefined);
62
- toDict(): Record<string, unknown>;
63
- static fromDict(data: Record<string, unknown>): CapsFrame;
64
- }
65
- export declare class ErrorFrame implements NpsFrame {
66
- readonly status: string;
67
- readonly error: string;
68
- readonly message?: string | undefined;
69
- readonly details?: Record<string, unknown> | undefined;
70
- readonly frameType = FrameType.ERROR;
71
- readonly preferredTier = EncodingTier.MSGPACK;
72
- constructor(status: string, error: string, message?: string | undefined, details?: Record<string, unknown> | undefined);
73
- toDict(): Record<string, unknown>;
74
- static fromDict(data: Record<string, unknown>): ErrorFrame;
75
- }
76
- export declare class HelloFrame implements NpsFrame {
77
- readonly npsVersion: string;
78
- readonly supportedEncodings: readonly string[];
79
- readonly supportedProtocols: readonly string[];
80
- minVersion?: string | undefined;
81
- agentId?: string | undefined;
82
- maxFramePayload: number;
83
- extSupport: boolean;
84
- maxConcurrentStreams: number;
85
- e2eEncAlgorithms?: readonly string[] | undefined;
86
- readonly frameType = FrameType.HELLO;
87
- readonly preferredTier = EncodingTier.JSON;
88
- static readonly DEFAULT_MAX_FRAME_PAYLOAD = 65535;
89
- static readonly DEFAULT_MAX_CONCURRENT_STREAMS = 32;
90
- constructor(npsVersion: string, supportedEncodings: readonly string[], supportedProtocols: readonly string[], minVersion?: string | undefined, agentId?: string | undefined, maxFramePayload?: number, extSupport?: boolean, maxConcurrentStreams?: number, e2eEncAlgorithms?: readonly string[] | undefined);
91
- toDict(): Record<string, unknown>;
92
- static fromDict(data: Record<string, unknown>): HelloFrame;
93
- }
94
- //# sourceMappingURL=frames.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../src/ncp/frames.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAIjD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAO,MAAM,CAAC;IAClB,IAAI,EAAO,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC;CAChC;AAID,qBAAa,WAAY,YAAW,QA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rC,oBAAoB,GAAE,MAAkD,EACxE,gBAAgB,CAAC,EAAK,SAAS,MAAM,EAAE,YAAA;IAGzD,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAcjC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU;CAa3D"}
@@ -1,192 +0,0 @@
1
- // Copyright 2026 INNO LOTUS PTY LTD
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { EncodingTier, FrameType } from "../core/frames.js";
4
- // ── AnchorFrame ───────────────────────────────────────────────────────────────
5
- export class AnchorFrame {
6
- anchorId;
7
- schema;
8
- ttl;
9
- frameType = FrameType.ANCHOR;
10
- preferredTier = EncodingTier.MSGPACK;
11
- constructor(anchorId, schema, ttl = 3600) {
12
- this.anchorId = anchorId;
13
- this.schema = schema;
14
- this.ttl = ttl;
15
- }
16
- toDict() {
17
- return {
18
- anchor_id: this.anchorId,
19
- schema: { fields: this.schema.fields.map((f) => ({ ...f })) },
20
- ttl: this.ttl,
21
- };
22
- }
23
- static fromDict(data) {
24
- const schemaRaw = data["schema"];
25
- return new AnchorFrame(data["anchor_id"], { fields: schemaRaw.fields }, data["ttl"] ?? 3600);
26
- }
27
- }
28
- // ── DiffFrame ─────────────────────────────────────────────────────────────────
29
- export class DiffFrame {
30
- anchorRef;
31
- baseSeq;
32
- patch;
33
- entityId;
34
- frameType = FrameType.DIFF;
35
- preferredTier = EncodingTier.MSGPACK;
36
- constructor(anchorRef, baseSeq, patch, entityId) {
37
- this.anchorRef = anchorRef;
38
- this.baseSeq = baseSeq;
39
- this.patch = patch;
40
- this.entityId = entityId;
41
- }
42
- toDict() {
43
- return {
44
- anchor_ref: this.anchorRef,
45
- base_seq: this.baseSeq,
46
- patch: this.patch.map((p) => ({ ...p })),
47
- entity_id: this.entityId ?? null,
48
- };
49
- }
50
- static fromDict(data) {
51
- return new DiffFrame(data["anchor_ref"], data["base_seq"], data["patch"], data["entity_id"] ?? undefined);
52
- }
53
- }
54
- // ── StreamFrame ───────────────────────────────────────────────────────────────
55
- export class StreamFrame {
56
- streamId;
57
- seq;
58
- isLast;
59
- data;
60
- anchorRef;
61
- windowSize;
62
- frameType = FrameType.STREAM;
63
- preferredTier = EncodingTier.MSGPACK;
64
- constructor(streamId, seq, isLast, data, anchorRef, windowSize) {
65
- this.streamId = streamId;
66
- this.seq = seq;
67
- this.isLast = isLast;
68
- this.data = data;
69
- this.anchorRef = anchorRef;
70
- this.windowSize = windowSize;
71
- }
72
- toDict() {
73
- return {
74
- stream_id: this.streamId,
75
- seq: this.seq,
76
- is_last: this.isLast,
77
- data: this.data,
78
- anchor_ref: this.anchorRef ?? null,
79
- window_size: this.windowSize ?? null,
80
- };
81
- }
82
- static fromDict(data) {
83
- return new StreamFrame(data["stream_id"], data["seq"], data["is_last"], data["data"], data["anchor_ref"] ?? undefined, data["window_size"] ?? undefined);
84
- }
85
- }
86
- // ── CapsFrame ─────────────────────────────────────────────────────────────────
87
- export class CapsFrame {
88
- anchorRef;
89
- count;
90
- data;
91
- nextCursor;
92
- tokenEst;
93
- cached;
94
- tokenizerUsed;
95
- frameType = FrameType.CAPS;
96
- preferredTier = EncodingTier.MSGPACK;
97
- constructor(anchorRef, count, data, nextCursor, tokenEst, cached, tokenizerUsed) {
98
- this.anchorRef = anchorRef;
99
- this.count = count;
100
- this.data = data;
101
- this.nextCursor = nextCursor;
102
- this.tokenEst = tokenEst;
103
- this.cached = cached;
104
- this.tokenizerUsed = tokenizerUsed;
105
- }
106
- toDict() {
107
- return {
108
- anchor_ref: this.anchorRef,
109
- count: this.count,
110
- data: this.data,
111
- next_cursor: this.nextCursor ?? null,
112
- token_est: this.tokenEst ?? null,
113
- cached: this.cached ?? null,
114
- tokenizer_used: this.tokenizerUsed ?? null,
115
- };
116
- }
117
- static fromDict(data) {
118
- return new CapsFrame(data["anchor_ref"], data["count"], data["data"], data["next_cursor"] ?? undefined, data["token_est"] ?? undefined, data["cached"] ?? undefined, data["tokenizer_used"] ?? undefined);
119
- }
120
- }
121
- // ── ErrorFrame ────────────────────────────────────────────────────────────────
122
- export class ErrorFrame {
123
- status;
124
- error;
125
- message;
126
- details;
127
- frameType = FrameType.ERROR;
128
- preferredTier = EncodingTier.MSGPACK;
129
- constructor(status, error, message, details) {
130
- this.status = status;
131
- this.error = error;
132
- this.message = message;
133
- this.details = details;
134
- }
135
- toDict() {
136
- return {
137
- status: this.status,
138
- error: this.error,
139
- message: this.message ?? null,
140
- details: this.details ?? null,
141
- };
142
- }
143
- static fromDict(data) {
144
- return new ErrorFrame(data["status"], data["error"], data["message"] ?? undefined, data["details"] ?? undefined);
145
- }
146
- }
147
- // ── HelloFrame ────────────────────────────────────────────────────────────────
148
- // NPS-1 §4.6 — Native-mode handshake (0x06). Always Tier-1 JSON: encoding
149
- // is not yet negotiated when this frame is sent.
150
- export class HelloFrame {
151
- npsVersion;
152
- supportedEncodings;
153
- supportedProtocols;
154
- minVersion;
155
- agentId;
156
- maxFramePayload;
157
- extSupport;
158
- maxConcurrentStreams;
159
- e2eEncAlgorithms;
160
- frameType = FrameType.HELLO;
161
- preferredTier = EncodingTier.JSON;
162
- static DEFAULT_MAX_FRAME_PAYLOAD = 0xFFFF;
163
- static DEFAULT_MAX_CONCURRENT_STREAMS = 32;
164
- constructor(npsVersion, supportedEncodings, supportedProtocols, minVersion, agentId, maxFramePayload = HelloFrame.DEFAULT_MAX_FRAME_PAYLOAD, extSupport = false, maxConcurrentStreams = HelloFrame.DEFAULT_MAX_CONCURRENT_STREAMS, e2eEncAlgorithms) {
165
- this.npsVersion = npsVersion;
166
- this.supportedEncodings = supportedEncodings;
167
- this.supportedProtocols = supportedProtocols;
168
- this.minVersion = minVersion;
169
- this.agentId = agentId;
170
- this.maxFramePayload = maxFramePayload;
171
- this.extSupport = extSupport;
172
- this.maxConcurrentStreams = maxConcurrentStreams;
173
- this.e2eEncAlgorithms = e2eEncAlgorithms;
174
- }
175
- toDict() {
176
- return {
177
- nps_version: this.npsVersion,
178
- supported_encodings: [...this.supportedEncodings],
179
- supported_protocols: [...this.supportedProtocols],
180
- min_version: this.minVersion ?? null,
181
- agent_id: this.agentId ?? null,
182
- max_frame_payload: this.maxFramePayload,
183
- ext_support: this.extSupport,
184
- max_concurrent_streams: this.maxConcurrentStreams,
185
- e2e_enc_algorithms: this.e2eEncAlgorithms ? [...this.e2eEncAlgorithms] : null,
186
- };
187
- }
188
- static fromDict(data) {
189
- return new HelloFrame(data["nps_version"], data["supported_encodings"] ?? [], data["supported_protocols"] ?? [], data["min_version"] ?? undefined, data["agent_id"] ?? undefined, data["max_frame_payload"] ?? HelloFrame.DEFAULT_MAX_FRAME_PAYLOAD, data["ext_support"] ?? false, data["max_concurrent_streams"] ?? HelloFrame.DEFAULT_MAX_CONCURRENT_STREAMS, data["e2e_enc_algorithms"] ?? undefined);
190
- }
191
- }
192
- //# sourceMappingURL=frames.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"frames.js","sourceRoot":"","sources":["../../src/ncp/frames.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAgB5D,iFAAiF;AAEjF,MAAM,OAAO,WAAW;IAKJ;IACA;IACA;IANT,SAAS,GAAO,SAAS,CAAC,MAAM,CAAC;IACjC,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC;IAE9C,YACkB,QAAgB,EAChB,MAAqB,EACrB,MAAmB,IAAI;QAFvB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,WAAM,GAAN,MAAM,CAAe;QACrB,QAAG,GAAH,GAAG,CAAoB;IACtC,CAAC;IAEJ,MAAM;QACJ,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,QAAQ;YACxB,MAAM,EAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,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 +0,0 @@
1
- /**
2
- * Negotiate the session NPS version between client and server.
3
- *
4
- * Session version = numeric min of client.nps_version and server.nps_version
5
- * (component-wise — "0.9" < "0.10" < "1.0").
6
- * If the effective client minimum (min_version ?? nps_version) > server.nps_version,
7
- * the versions are incompatible.
8
- *
9
- * Spec: NPS-1 §2.6
10
- */
11
- export declare function negotiateVersion(client: {
12
- nps_version: string;
13
- min_version?: string;
14
- }, server: {
15
- nps_version: string;
16
- }): {
17
- session_version: string;
18
- compatible: boolean;
19
- error_code?: string;
20
- };
21
- /**
22
- * Negotiate the encoding between client and server preferred lists.
23
- *
24
- * Returns the first mutually supported encoding, preferring "msgpack" over "json".
25
- * Returns null if there is no intersection.
26
- */
27
- export declare function negotiateEncoding(client: string[], server: string[]): {
28
- encoding: string | null;
29
- };
30
- //# sourceMappingURL=handshake.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handshake.d.ts","sourceRoot":"","sources":["../../src/ncp/handshake.ts"],"names":[],"mappings":"AAgCA;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,EACrD,MAAM,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAmBvE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EAAE,EAChB,MAAM,EAAE,MAAM,EAAE,GACf;IAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAmB7B"}
@@ -1,80 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- // Copyright (c) 2026 LabAcacia / INNO LOTUS PTY LTD
3
- //
4
- // Handshake — Version negotiation and encoding negotiation
5
- // NPS-1 §2.6
6
- /**
7
- * Parse a "major.minor" (optionally "major.minor.patch") version string into a
8
- * tuple of numeric components. Invalid parts become NaN which makes subsequent
9
- * comparisons return false in both directions (safe failure).
10
- */
11
- function parseVersion(v) {
12
- return v.split(".").map((p) => Number.parseInt(p, 10));
13
- }
14
- /**
15
- * Numeric component-wise comparison of two version strings.
16
- * Returns negative if a < b, zero if equal, positive if a > b.
17
- * Avoids the lexicographic pitfall where "0.9" > "0.10".
18
- */
19
- function compareVersions(a, b) {
20
- const partsA = parseVersion(a);
21
- const partsB = parseVersion(b);
22
- const len = Math.max(partsA.length, partsB.length);
23
- for (let i = 0; i < len; i += 1) {
24
- const x = partsA[i] ?? 0;
25
- const y = partsB[i] ?? 0;
26
- if (x !== y)
27
- return x - y;
28
- }
29
- return 0;
30
- }
31
- /**
32
- * Negotiate the session NPS version between client and server.
33
- *
34
- * Session version = numeric min of client.nps_version and server.nps_version
35
- * (component-wise — "0.9" < "0.10" < "1.0").
36
- * If the effective client minimum (min_version ?? nps_version) > server.nps_version,
37
- * the versions are incompatible.
38
- *
39
- * Spec: NPS-1 §2.6
40
- */
41
- export function negotiateVersion(client, server) {
42
- const clientMin = client.min_version ?? client.nps_version;
43
- const serverVersion = server.nps_version;
44
- if (compareVersions(clientMin, serverVersion) > 0) {
45
- return {
46
- session_version: serverVersion,
47
- compatible: false,
48
- error_code: "NCP-VERSION-INCOMPATIBLE",
49
- };
50
- }
51
- // Session version = component-wise min of client.nps_version and server.nps_version
52
- const sessionVersion = compareVersions(client.nps_version, serverVersion) <= 0
53
- ? client.nps_version
54
- : serverVersion;
55
- return { session_version: sessionVersion, compatible: true };
56
- }
57
- /**
58
- * Negotiate the encoding between client and server preferred lists.
59
- *
60
- * Returns the first mutually supported encoding, preferring "msgpack" over "json".
61
- * Returns null if there is no intersection.
62
- */
63
- export function negotiateEncoding(client, server) {
64
- const serverSet = new Set(server);
65
- // Prefer msgpack over json (and over any other encoding)
66
- if (client.includes("msgpack") && serverSet.has("msgpack")) {
67
- return { encoding: "msgpack" };
68
- }
69
- if (client.includes("json") && serverSet.has("json")) {
70
- return { encoding: "json" };
71
- }
72
- // Fall back to first intersection in client-preference order
73
- for (const enc of client) {
74
- if (serverSet.has(enc)) {
75
- return { encoding: enc };
76
- }
77
- }
78
- return { encoding: null };
79
- }
80
- //# sourceMappingURL=handshake.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handshake.js","sourceRoot":"","sources":["../../src/ncp/handshake.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,oDAAoD;AACpD,EAAE;AACF,2DAA2D;AAC3D,aAAa;AAEb;;;;GAIG;AACH,SAAS,YAAY,CAAC,CAAS;IAC7B,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CAAC,CAAS,EAAE,CAAS;IAC3C,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAChC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACzB,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAA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AAE,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAC"}
@@ -1,12 +0,0 @@
1
- export * from "./frames/anchor-frame.js";
2
- export * from "./frames/caps-frame.js";
3
- export * from "./frames/diff-frame.js";
4
- export * from "./frames/error-frame.js";
5
- export * from "./frames/hello-frame.js";
6
- export * from "./frames/stream-frame.js";
7
- export * from "./ncp-error-codes.js";
8
- export * from "./ncp-patch-format.js";
9
- export * from "./handshake.js";
10
- export * from "./stream-manager.js";
11
- export * from "./preamble.js";
12
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ncp/index.ts"],"names":[],"mappings":"AAEA,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC"}
package/dist/ncp/index.js DELETED
@@ -1,14 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- // Copyright (c) 2026 LabAcacia / INNO LOTUS PTY LTD
3
- export * from "./frames/anchor-frame.js";
4
- export * from "./frames/caps-frame.js";
5
- export * from "./frames/diff-frame.js";
6
- export * from "./frames/error-frame.js";
7
- export * from "./frames/hello-frame.js";
8
- export * from "./frames/stream-frame.js";
9
- export * from "./ncp-error-codes.js";
10
- export * from "./ncp-patch-format.js";
11
- export * from "./handshake.js";
12
- export * from "./stream-manager.js";
13
- export * from "./preamble.js";
14
- //# sourceMappingURL=index.js.map