@avatarsd-llc/libtracer 0.6.0 → 0.7.1

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/README.md CHANGED
@@ -61,5 +61,7 @@ step** — that keeps the polyglot conformance driver
61
61
 
62
62
  ## Releasing
63
63
 
64
- Tag the repo with `ts-vX.Y.Z` to trigger publish (see
65
- `.github/workflows/publish-npm.yml` once added).
64
+ Publishing is driven by the repo's release tag: `tools/sync-version.py` stamps
65
+ every artifact from the root `VERSION` file, so one `vX.Y.Z` tag releases the
66
+ TypeScript packages, the Rust crate and the C++ core at the same version
67
+ (`.github/workflows/publish-npm.yml`).
package/dist/codec.d.mts CHANGED
@@ -63,6 +63,9 @@ export type TYPE = number;
63
63
  * 0x0E SPEC is the in-band vertex-creation spec. 0x0F FWD and 0x10 FIELD are the
64
64
  * remote-operation frames (RFC-0004 / ADR-0035, the v1 fast-track range
65
65
  * 0x0F-0x1F). All are structured (opt.PL=1) and handled generically by the codec.
66
+ * 0x14 PATH_REF is the bound-path address form (RFC-0024 §4) and the one exception:
67
+ * its body is a bare fixed-stride 8-byte record array (opt.PL=0), so the decoder
68
+ * checks its shape by type.
66
69
  *
67
70
  * @readonly
68
71
  * @enum {number}
@@ -83,7 +86,12 @@ export const TYPE: Readonly<{
83
86
  SPEC: 14;
84
87
  FWD: 15;
85
88
  FIELD: 16;
89
+ PATH_REF: 20;
86
90
  }>;
91
+ /** @brief The `PATH_REF` element stride — 8 bytes, `(u32 index, u32 generation)` LE (RFC-0024 §4.4). */
92
+ export const PATH_REF_ELEMENT_BYTES: 8;
93
+ /** @brief The `PATH_REF` element-count bound — 255 elements / 2040 body bytes (RFC-0024 §4.3). */
94
+ export const MAX_PATH_REF_ELEMENTS: 255;
87
95
  export type ERROR = string;
88
96
  /**
89
97
  * @brief Decode failure reasons, named after the C++ `tr::wire::error_t` enum.
package/dist/codec.mjs CHANGED
@@ -22,6 +22,9 @@
22
22
  * 0x0E SPEC is the in-band vertex-creation spec. 0x0F FWD and 0x10 FIELD are the
23
23
  * remote-operation frames (RFC-0004 / ADR-0035, the v1 fast-track range
24
24
  * 0x0F-0x1F). All are structured (opt.PL=1) and handled generically by the codec.
25
+ * 0x14 PATH_REF is the bound-path address form (RFC-0024 §4) and the one exception:
26
+ * its body is a bare fixed-stride 8-byte record array (opt.PL=0), so the decoder
27
+ * checks its shape by type.
25
28
  *
26
29
  * @readonly
27
30
  * @enum {number}
@@ -42,7 +45,12 @@ export const TYPE = Object.freeze({
42
45
  SPEC: 0x0e,
43
46
  FWD: 0x0f,
44
47
  FIELD: 0x10,
48
+ PATH_REF: 0x14,
45
49
  });
50
+ /** @brief The `PATH_REF` element stride — 8 bytes, `(u32 index, u32 generation)` LE (RFC-0024 §4.4). */
51
+ export const PATH_REF_ELEMENT_BYTES = 8;
52
+ /** @brief The `PATH_REF` element-count bound — 255 elements / 2040 body bytes (RFC-0024 §4.3). */
53
+ export const MAX_PATH_REF_ELEMENTS = 255;
46
54
  /**
47
55
  * @brief Decode failure reasons, named after the C++ `tr::wire::error_t` enum.
48
56
  *
@@ -287,6 +295,17 @@ function parseOne(buf) {
287
295
  if (buf.length < header)
288
296
  throw new CodecError(ERROR.FRAME_TRUNCATED);
289
297
  const length = readLe(buf, 2, opt.ll ? 4 : 2);
298
+ // The one per-type structural rule (RFC-0024 §4.2/§4.3): a PATH_REF body is a bare
299
+ // fixed-stride 8-byte record array, so PL/LL are forbidden, the length is a whole number
300
+ // of elements, and the count is bounded at 255. Shape only — an element's MEANING is
301
+ // node-scoped and no codec can check it.
302
+ if (typeB === TYPE.PATH_REF &&
303
+ (opt.pl ||
304
+ opt.ll ||
305
+ length % PATH_REF_ELEMENT_BYTES !== 0 ||
306
+ length > MAX_PATH_REF_ELEMENTS * PATH_REF_ELEMENT_BYTES)) {
307
+ throw new CodecError(ERROR.FRAME_INVALID);
308
+ }
290
309
  const tsSize = opt.ts ? (opt.tf ? 4 : 8) : 0;
291
310
  const crcSize = opt.cr ? (opt.cw ? 2 : 4) : 0;
292
311
  const total = header + length + tsSize + crcSize;
package/dist/index.d.ts CHANGED
@@ -12,5 +12,5 @@ export declare const SPEC_VERSION: 1;
12
12
  * (core/src/frame.cpp), gated by the shared conformance vectors. Re-exported
13
13
  * from ./wire.ts (the subpath entry).
14
14
  */
15
- export { TYPE, ERROR, CodecError, decode, encode, equal, crc32c, crc16ccitt, } from './wire.js';
15
+ export { TYPE, PATH_REF_ELEMENT_BYTES, MAX_PATH_REF_ELEMENTS, ERROR, CodecError, decode, encode, equal, crc32c, crc16ccitt, } from './wire.js';
16
16
  export type { Opt, Timestamp, Crc, Trailer, Tlv } from './wire.js';
package/dist/index.js CHANGED
@@ -14,4 +14,4 @@ export const SPEC_VERSION = 1;
14
14
  * (core/src/frame.cpp), gated by the shared conformance vectors. Re-exported
15
15
  * from ./wire.ts (the subpath entry).
16
16
  */
17
- export { TYPE, ERROR, CodecError, decode, encode, equal, crc32c, crc16ccitt, } from './wire.js';
17
+ export { TYPE, PATH_REF_ELEMENT_BYTES, MAX_PATH_REF_ELEMENTS, ERROR, CodecError, decode, encode, equal, crc32c, crc16ccitt, } from './wire.js';
package/dist/wire.d.ts CHANGED
@@ -7,5 +7,5 @@
7
7
  * L0/L1/L4 subpaths (./mem, ./view, ./graph) are reserved for when those layers
8
8
  * land in TS — see docs/adr/0033-npm-subpackage-monorepo.md.
9
9
  */
10
- export { TYPE, ERROR, CodecError, decode, encode, equal, crc32c, crc16ccitt, } from './codec.mjs';
10
+ export { TYPE, PATH_REF_ELEMENT_BYTES, MAX_PATH_REF_ELEMENTS, ERROR, CodecError, decode, encode, equal, crc32c, crc16ccitt, } from './codec.mjs';
11
11
  export type { Opt, Timestamp, Crc, Trailer, Tlv } from './codec.mjs';
package/dist/wire.js CHANGED
@@ -9,4 +9,4 @@
9
9
  * L0/L1/L4 subpaths (./mem, ./view, ./graph) are reserved for when those layers
10
10
  * land in TS — see docs/adr/0033-npm-subpackage-monorepo.md.
11
11
  */
12
- export { TYPE, ERROR, CodecError, decode, encode, equal, crc32c, crc16ccitt, } from './codec.mjs';
12
+ export { TYPE, PATH_REF_ELEMENT_BYTES, MAX_PATH_REF_ELEMENTS, ERROR, CodecError, decode, encode, equal, crc32c, crc16ccitt, } from './codec.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avatarsd-llc/libtracer",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "TypeScript core for libtracer — a lightweight decentralized graph-based networking protocol. Native pure-TS implementation (in-process codec; no transports), conformance-gated against the shared vectors.",
5
5
  "author": "avatarsd LLC",
6
6
  "license": "Apache-2.0",