@avatarsd-llc/libtracer 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/codec.d.mts CHANGED
@@ -1,54 +1,52 @@
1
1
  /**
2
- * CRC-32C (Castagnoli): reflected poly 0x82F63B78, init/xor 0xFFFFFFFF.
2
+ * @brief CRC-32C (Castagnoli): reflected poly 0x82F63B78, init/xor 0xFFFFFFFF.
3
3
  *
4
4
  * @param {Uint8Array} data
5
5
  * @returns {number} unsigned 32-bit
6
6
  */
7
7
  export function crc32c(data: Uint8Array): number;
8
8
  /**
9
- * CRC-16-CCITT (FALSE): poly 0x1021, MSB-first, init 0xFFFF, no final xor.
9
+ * @brief CRC-16-CCITT (FALSE): poly 0x1021, MSB-first, init 0xFFFF, no final xor.
10
10
  *
11
11
  * @param {Uint8Array} data
12
12
  * @returns {number} unsigned 16-bit
13
13
  */
14
14
  export function crc16ccitt(data: Uint8Array): number;
15
15
  /**
16
- * Decode exactly one TLV that fills `input` into a TLV tree. Nesting is parsed
17
- * ITERATIVELY with an explicit stack (recursion is forbidden) and capped at
18
- * {@link MAX_DEPTH}. Trailing bytes after the root => FRAME_INVALID.
16
+ * @brief Decode exactly one TLV that fills `input` into a TLV tree.
17
+ *
18
+ * Nesting is parsed ITERATIVELY with an explicit stack (recursion is
19
+ * forbidden); the stack is a growable array, so depth is bounded only by this
20
+ * receiver's memory (RFC-0006 — no depth constant). Trailing bytes after the
21
+ * root => FRAME_INVALID.
19
22
  *
20
23
  * @param {Uint8Array} input
21
24
  * @returns {Tlv}
22
25
  */
23
26
  export function decode(input: Uint8Array): Tlv;
24
27
  /**
25
- * Encode a TLV tree back to wire bytes, recomputing the trailer CRC from the
26
- * body (+ timestamp bytes) when opt.CR is set. Mirrors `encode` in frame.cpp.
28
+ * @brief Encode a TLV tree back to wire bytes, recomputing the trailer CRC from
29
+ * the body (+ timestamp bytes) when opt.CR is set. Mirrors `encode` in frame.cpp.
27
30
  *
28
31
  * @param {Tlv} tlv
29
32
  * @returns {Uint8Array}
30
33
  */
31
34
  export function encode(tlv: Tlv): Uint8Array;
32
35
  /**
33
- * Structural + byte-content equality of two TLV trees.
36
+ * @brief Structural + byte-content equality of two TLV trees.
34
37
  *
35
38
  * @param {Tlv} a
36
39
  * @param {Tlv} b
37
40
  * @returns {boolean}
38
41
  */
39
42
  export function equal(a: Tlv, b: Tlv): boolean;
40
- /**
41
- * Core type-code registry (0x01-0x10). 0x05 is retired (was LIST, ADR-0003).
42
- * 0x0E SPEC is the in-band vertex-creation spec. 0x0F FWD and 0x10 FIELD are the
43
- * remote-operation frames (RFC-0004 / ADR-0035, the v1 fast-track range
44
- * 0x0F-0x1F). All are structured (opt.PL=1) and handled generically by the codec.
45
- */
46
43
  export type TYPE = number;
47
44
  /**
48
- * libtracer core wire codec — a pure-TypeScript/JavaScript port of the C++
49
- * reference codec in `core/src/frame.cpp`. It must match that implementation
50
- * byte-for-byte; correctness is gated by the SHARED conformance vectors under
51
- * `tests/conformance/vectors/v1/`.
45
+ * @brief libtracer core wire codec — a pure-TypeScript/JavaScript port of the
46
+ * C++ reference codec in `core/src/frame.cpp`.
47
+ *
48
+ * It must match that implementation byte-for-byte; correctness is gated by the
49
+ * SHARED conformance vectors under `tests/conformance/vectors/v1/`.
52
50
  *
53
51
  * The wire format is documented in `docs/reference/01-data-format.md`:
54
52
  * header (4 or 6 bytes) + payload + optional trailer (timestamp then CRC).
@@ -59,7 +57,9 @@ export type TYPE = number;
59
57
  * `tsc` for the published `@avatarsd-llc/libtracer` package.
60
58
  */
61
59
  /**
62
- * Core type-code registry (0x01-0x10). 0x05 is retired (was LIST, ADR-0003).
60
+ * @brief Core type-code registry (0x01-0x10).
61
+ *
62
+ * 0x05 is retired (was LIST, ADR-0003).
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.
@@ -84,36 +84,37 @@ export const TYPE: Readonly<{
84
84
  FWD: 15;
85
85
  FIELD: 16;
86
86
  }>;
87
- /**
88
- * Decode failure reasons, named after the C++ `tr::wire::error_t` enum.
89
- */
90
87
  export type ERROR = string;
91
88
  /**
92
- * Decode failure reasons, named after the C++ `tr::wire::error_t` enum.
89
+ * @brief Decode failure reasons, named after the C++ `tr::wire::error_t` enum.
93
90
  *
94
91
  * @readonly
95
92
  * @enum {string}
96
93
  */
97
94
  export const ERROR: Readonly<{
98
- FRAME_TRUNCATED: "FRAME_TRUNCATED";
99
- FRAME_INVALID: "FRAME_INVALID";
100
- FRAME_CRC_FAIL: "FRAME_CRC_FAIL";
95
+ FRAME_TRUNCATED: "FRAME_TRUNCATED"; /**< @brief Ran out of bytes. */
96
+ FRAME_INVALID: "FRAME_INVALID"; /**< @brief Reserved bit, type 0x00, trailing bytes. */
97
+ FRAME_CRC_FAIL: "FRAME_CRC_FAIL"; /**< @brief Trailer CRC mismatch. */
98
+ /**
99
+ * @brief Exceeds the receiver's decode resources (RFC-0006 — depth is
100
+ * resource-bounded, never a constant). This codec's work stack is a growable
101
+ * array, so decode() never throws it; the name remains for harness parity
102
+ * and for peers' ERROR frames.
103
+ */
101
104
  TLV_NESTING_TOO_DEEP: "TLV_NESTING_TOO_DEEP";
102
105
  }>;
103
- /** The iterative-parser depth cap (docs/reference/01 §iterative parsing). */
104
- export const MAX_DEPTH: 32;
105
106
  /**
106
- * A decode/encode error carrying one of {@link ERROR} as `.code`.
107
+ * @brief A decode/encode error carrying one of {@link ERROR} as `.code`.
107
108
  */
108
109
  export class CodecError extends Error {
109
- /** @param {string} code one of {@link ERROR} */
110
+ /**
111
+ * @brief Construct with the failure reason as message and `.code`.
112
+ * @param {string} code one of {@link ERROR}
113
+ */
110
114
  constructor(code: string);
111
115
  /** @type {string} */
112
116
  code: string;
113
117
  }
114
- /**
115
- * The 1-byte `opt` field, unpacked. Bits MSB->LSB: R | PL | TS | CR | LL | CW | TF | R.
116
- */
117
118
  export type Opt = {
118
119
  /**
119
120
  * bit 6: payload is structured (children, not opaque)
@@ -140,10 +141,6 @@ export type Opt = {
140
141
  */
141
142
  tf: boolean;
142
143
  };
143
- /**
144
- * A decoded wire timestamp. Absolute form is a u64 (BigInt) of ns since the Unix
145
- * epoch; relative form is a signed i32 ns offset from the parent timestamp.
146
- */
147
144
  export type Timestamp = {
148
145
  /**
149
146
  * false = absolute u64 ns; true = relative i32 ns
@@ -154,9 +151,6 @@ export type Timestamp = {
154
151
  */
155
152
  value: bigint;
156
153
  };
157
- /**
158
- * A decoded CRC. 16-bit values are zero-extended into `value`.
159
- */
160
154
  export type Crc = {
161
155
  width: "CRC32C" | "CRC16_CCITT";
162
156
  value: number;
@@ -165,11 +159,6 @@ export type Trailer = {
165
159
  ts: Timestamp | null;
166
160
  crc: Crc | null;
167
161
  };
168
- /**
169
- * A decoded TLV. For opaque TLVs (opt.PL=0) `payload` holds the bytes and
170
- * `children` is empty; for structured TLVs (opt.PL=1) `children` holds the
171
- * parsed sub-TLVs and `payload` is empty.
172
- */
173
162
  export type Tlv = {
174
163
  /**
175
164
  * a {@link TYPE} code (or a user/unknown code)
package/dist/codec.mjs CHANGED
@@ -1,10 +1,11 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // SPDX-FileCopyrightText: Copyright 2026 avatarsd LLC
3
3
  /**
4
- * libtracer core wire codec — a pure-TypeScript/JavaScript port of the C++
5
- * reference codec in `core/src/frame.cpp`. It must match that implementation
6
- * byte-for-byte; correctness is gated by the SHARED conformance vectors under
7
- * `tests/conformance/vectors/v1/`.
4
+ * @brief libtracer core wire codec — a pure-TypeScript/JavaScript port of the
5
+ * C++ reference codec in `core/src/frame.cpp`.
6
+ *
7
+ * It must match that implementation byte-for-byte; correctness is gated by the
8
+ * SHARED conformance vectors under `tests/conformance/vectors/v1/`.
8
9
  *
9
10
  * The wire format is documented in `docs/reference/01-data-format.md`:
10
11
  * header (4 or 6 bytes) + payload + optional trailer (timestamp then CRC).
@@ -15,7 +16,9 @@
15
16
  * `tsc` for the published `@avatarsd-llc/libtracer` package.
16
17
  */
17
18
  /**
18
- * Core type-code registry (0x01-0x10). 0x05 is retired (was LIST, ADR-0003).
19
+ * @brief Core type-code registry (0x01-0x10).
20
+ *
21
+ * 0x05 is retired (was LIST, ADR-0003).
19
22
  * 0x0E SPEC is the in-band vertex-creation spec. 0x0F FWD and 0x10 FIELD are the
20
23
  * remote-operation frames (RFC-0004 / ADR-0035, the v1 fast-track range
21
24
  * 0x0F-0x1F). All are structured (opt.PL=1) and handled generically by the codec.
@@ -41,26 +44,33 @@ export const TYPE = Object.freeze({
41
44
  FIELD: 0x10,
42
45
  });
43
46
  /**
44
- * Decode failure reasons, named after the C++ `tr::wire::error_t` enum.
47
+ * @brief Decode failure reasons, named after the C++ `tr::wire::error_t` enum.
45
48
  *
46
49
  * @readonly
47
50
  * @enum {string}
48
51
  */
49
52
  export const ERROR = Object.freeze({
50
- FRAME_TRUNCATED: 'FRAME_TRUNCATED', // ran out of bytes
51
- FRAME_INVALID: 'FRAME_INVALID', // reserved bit, type 0x00, trailing bytes
52
- FRAME_CRC_FAIL: 'FRAME_CRC_FAIL', // trailer CRC mismatch
53
- TLV_NESTING_TOO_DEEP: 'TLV_NESTING_TOO_DEEP', // depth cap exceeded
53
+ FRAME_TRUNCATED: 'FRAME_TRUNCATED' /**< @brief Ran out of bytes. */,
54
+ FRAME_INVALID: 'FRAME_INVALID' /**< @brief Reserved bit, type 0x00, trailing bytes. */,
55
+ FRAME_CRC_FAIL: 'FRAME_CRC_FAIL' /**< @brief Trailer CRC mismatch. */,
56
+ /**
57
+ * @brief Exceeds the receiver's decode resources (RFC-0006 — depth is
58
+ * resource-bounded, never a constant). This codec's work stack is a growable
59
+ * array, so decode() never throws it; the name remains for harness parity
60
+ * and for peers' ERROR frames.
61
+ */
62
+ TLV_NESTING_TOO_DEEP: 'TLV_NESTING_TOO_DEEP',
54
63
  });
55
- /** The iterative-parser depth cap (docs/reference/01 §iterative parsing). */
56
- export const MAX_DEPTH = 32;
57
- /** Reserved bits 7 and 0; non-zero => FRAME_INVALID. */
64
+ /** @brief Reserved bits 7 and 0; non-zero => FRAME_INVALID. */
58
65
  const RESERVED_MASK = 129;
59
66
  /**
60
- * A decode/encode error carrying one of {@link ERROR} as `.code`.
67
+ * @brief A decode/encode error carrying one of {@link ERROR} as `.code`.
61
68
  */
62
69
  export class CodecError extends Error {
63
- /** @param {string} code one of {@link ERROR} */
70
+ /**
71
+ * @brief Construct with the failure reason as message and `.code`.
72
+ * @param {string} code one of {@link ERROR}
73
+ */
64
74
  constructor(code) {
65
75
  super(code);
66
76
  this.name = 'CodecError';
@@ -69,7 +79,9 @@ export class CodecError extends Error {
69
79
  }
70
80
  }
71
81
  /**
72
- * The 1-byte `opt` field, unpacked. Bits MSB->LSB: R | PL | TS | CR | LL | CW | TF | R.
82
+ * @brief The 1-byte `opt` field, unpacked.
83
+ *
84
+ * Bits MSB->LSB: R | PL | TS | CR | LL | CW | TF | R.
73
85
  *
74
86
  * @typedef {object} Opt
75
87
  * @property {boolean} pl bit 6: payload is structured (children, not opaque)
@@ -80,29 +92,35 @@ export class CodecError extends Error {
80
92
  * @property {boolean} tf bit 1: timestamp form (false = abs u64, true = rel i32)
81
93
  */
82
94
  /**
83
- * A decoded wire timestamp. Absolute form is a u64 (BigInt) of ns since the Unix
84
- * epoch; relative form is a signed i32 ns offset from the parent timestamp.
95
+ * @brief A decoded wire timestamp.
96
+ *
97
+ * Absolute form is a u64 (BigInt) of ns since the Unix epoch; relative form is
98
+ * a signed i32 ns offset from the parent timestamp.
85
99
  *
86
100
  * @typedef {object} Timestamp
87
101
  * @property {boolean} relative false = absolute u64 ns; true = relative i32 ns
88
102
  * @property {bigint} value ns; BigInt to preserve the full u64 range exactly
89
103
  */
90
104
  /**
91
- * A decoded CRC. 16-bit values are zero-extended into `value`.
105
+ * @brief A decoded CRC. 16-bit values are zero-extended into `value`.
92
106
  *
93
107
  * @typedef {object} Crc
94
108
  * @property {'CRC32C'|'CRC16_CCITT'} width
95
109
  * @property {number} value
96
110
  */
97
111
  /**
112
+ * @brief A decoded TLV trailer: an optional timestamp and/or CRC.
113
+ *
98
114
  * @typedef {object} Trailer
99
115
  * @property {Timestamp|null} ts
100
116
  * @property {Crc|null} crc
101
117
  */
102
118
  /**
103
- * A decoded TLV. For opaque TLVs (opt.PL=0) `payload` holds the bytes and
104
- * `children` is empty; for structured TLVs (opt.PL=1) `children` holds the
105
- * parsed sub-TLVs and `payload` is empty.
119
+ * @brief A decoded TLV.
120
+ *
121
+ * For opaque TLVs (opt.PL=0) `payload` holds the bytes and `children` is empty;
122
+ * for structured TLVs (opt.PL=1) `children` holds the parsed sub-TLVs and
123
+ * `payload` is empty.
106
124
  *
107
125
  * @typedef {object} Tlv
108
126
  * @property {number} type a {@link TYPE} code (or a user/unknown code)
@@ -113,6 +131,7 @@ export class CodecError extends Error {
113
131
  */
114
132
  /* ------------------------------------------------------------------ opt --- */
115
133
  /**
134
+ * @brief Whether a reserved opt bit is set.
116
135
  * @param {number} b raw opt byte
117
136
  * @returns {boolean} true if a reserved bit (7 or 0) is set
118
137
  */
@@ -120,6 +139,7 @@ function reservedSet(b) {
120
139
  return (b & RESERVED_MASK) !== 0;
121
140
  }
122
141
  /**
142
+ * @brief Unpack a raw opt byte into its flags.
123
143
  * @param {number} b raw opt byte
124
144
  * @returns {Opt}
125
145
  */
@@ -134,6 +154,7 @@ function decodeOpt(b) {
134
154
  };
135
155
  }
136
156
  /**
157
+ * @brief Pack the flags back into the wire opt byte.
137
158
  * @param {Opt} o
138
159
  * @returns {number} packed opt byte
139
160
  */
@@ -147,7 +168,7 @@ function encodeOpt(o) {
147
168
  }
148
169
  /* --------------------------------------------------------------- endian --- */
149
170
  /**
150
- * Read `n` (<= 4) little-endian bytes at `off` as an unsigned Number.
171
+ * @brief Read `n` (<= 4) little-endian bytes at `off` as an unsigned Number.
151
172
  *
152
173
  * @param {Uint8Array} b
153
174
  * @param {number} off
@@ -161,7 +182,7 @@ function readLe(b, off, n) {
161
182
  return v;
162
183
  }
163
184
  /**
164
- * Read 8 little-endian bytes at `off` as an unsigned BigInt.
185
+ * @brief Read 8 little-endian bytes at `off` as an unsigned BigInt.
165
186
  *
166
187
  * @param {Uint8Array} b
167
188
  * @param {number} off
@@ -174,7 +195,7 @@ function readLe64(b, off) {
174
195
  return v;
175
196
  }
176
197
  /**
177
- * Append `n` (<= 4) little-endian bytes of unsigned Number `v`.
198
+ * @brief Append `n` (<= 4) little-endian bytes of unsigned Number `v`.
178
199
  *
179
200
  * @param {number[]} out
180
201
  * @param {number} v
@@ -185,7 +206,7 @@ function writeLe(out, v, n) {
185
206
  out.push((v >>> (8 * i)) & 0xff);
186
207
  }
187
208
  /**
188
- * Append 8 little-endian bytes of unsigned BigInt `v`.
209
+ * @brief Append 8 little-endian bytes of unsigned BigInt `v`.
189
210
  *
190
211
  * @param {number[]} out
191
212
  * @param {bigint} v
@@ -219,7 +240,7 @@ const CRC16_TABLE = (() => {
219
240
  return t;
220
241
  })();
221
242
  /**
222
- * CRC-32C (Castagnoli): reflected poly 0x82F63B78, init/xor 0xFFFFFFFF.
243
+ * @brief CRC-32C (Castagnoli): reflected poly 0x82F63B78, init/xor 0xFFFFFFFF.
223
244
  *
224
245
  * @param {Uint8Array} data
225
246
  * @returns {number} unsigned 32-bit
@@ -231,7 +252,7 @@ export function crc32c(data) {
231
252
  return (c ^ 0xffffffff) >>> 0;
232
253
  }
233
254
  /**
234
- * CRC-16-CCITT (FALSE): poly 0x1021, MSB-first, init 0xFFFF, no final xor.
255
+ * @brief CRC-16-CCITT (FALSE): poly 0x1021, MSB-first, init 0xFFFF, no final xor.
235
256
  *
236
257
  * @param {Uint8Array} data
237
258
  * @returns {number} unsigned 16-bit
@@ -246,8 +267,8 @@ export function crc16ccitt(data) {
246
267
  }
247
268
  /* --------------------------------------------------------------- decode --- */
248
269
  /**
249
- * Parse exactly one TLV at the front of `buf`, WITHOUT recursing into children.
250
- * Mirrors `parse_one` in frame.cpp.
270
+ * @brief Parse exactly one TLV at the front of `buf`, WITHOUT recursing into
271
+ * children. Mirrors `parse_one` in frame.cpp.
251
272
  *
252
273
  * @param {Uint8Array} buf
253
274
  * @returns {{tlv: Tlv, total: number, children: Uint8Array}}
@@ -319,9 +340,12 @@ function parseOne(buf) {
319
340
  return { tlv, total, children: payload };
320
341
  }
321
342
  /**
322
- * Decode exactly one TLV that fills `input` into a TLV tree. Nesting is parsed
323
- * ITERATIVELY with an explicit stack (recursion is forbidden) and capped at
324
- * {@link MAX_DEPTH}. Trailing bytes after the root => FRAME_INVALID.
343
+ * @brief Decode exactly one TLV that fills `input` into a TLV tree.
344
+ *
345
+ * Nesting is parsed ITERATIVELY with an explicit stack (recursion is
346
+ * forbidden); the stack is a growable array, so depth is bounded only by this
347
+ * receiver's memory (RFC-0006 — no depth constant). Trailing bytes after the
348
+ * root => FRAME_INVALID.
325
349
  *
326
350
  * @param {Uint8Array} input
327
351
  * @returns {Tlv}
@@ -348,9 +372,6 @@ export function decode(input) {
348
372
  parent.pos += done.total;
349
373
  continue;
350
374
  }
351
- // A child of `top` sits at depth == stack.length; reject at the cap.
352
- if (stack.length >= MAX_DEPTH)
353
- throw new CodecError(ERROR.TLV_NESTING_TOO_DEEP);
354
375
  const child = parseOne(top.payload.subarray(top.pos));
355
376
  if (child.tlv.opt.pl) {
356
377
  stack.push({ node: child.tlv, payload: child.children, pos: 0, total: child.total });
@@ -363,8 +384,8 @@ export function decode(input) {
363
384
  }
364
385
  /* --------------------------------------------------------------- encode --- */
365
386
  /**
366
- * Encode a TLV tree back to wire bytes, recomputing the trailer CRC from the
367
- * body (+ timestamp bytes) when opt.CR is set. Mirrors `encode` in frame.cpp.
387
+ * @brief Encode a TLV tree back to wire bytes, recomputing the trailer CRC from
388
+ * the body (+ timestamp bytes) when opt.CR is set. Mirrors `encode` in frame.cpp.
368
389
  *
369
390
  * @param {Tlv} tlv
370
391
  * @returns {Uint8Array}
@@ -415,7 +436,7 @@ export function encode(tlv) {
415
436
  return Uint8Array.from(out);
416
437
  }
417
438
  /**
418
- * Structural + byte-content equality of two TLV trees.
439
+ * @brief Structural + byte-content equality of two TLV trees.
419
440
  *
420
441
  * @param {Tlv} a
421
442
  * @param {Tlv} b
@@ -441,6 +462,7 @@ export function equal(a, b) {
441
462
  return true;
442
463
  }
443
464
  /**
465
+ * @brief Value equality of two (nullable) trailers.
444
466
  * @param {Trailer|null} a
445
467
  * @param {Trailer|null} b
446
468
  * @returns {boolean}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,16 @@
1
+ /**
2
+ * @brief Barrel entry (`@avatarsd-llc/libtracer`) — re-exports every layer the
3
+ * TS core implements.
4
+ *
5
+ * For tree-shaking, the wire codec is also reachable directly at the
6
+ * layer-scoped subpath `@avatarsd-llc/libtracer/wire` (see ./wire.ts and
7
+ * docs/adr/0033-npm-subpackage-monorepo.md).
8
+ */
1
9
  export declare const SPEC_VERSION: 1;
2
- export { TYPE, ERROR, MAX_DEPTH, CodecError, decode, encode, equal, crc32c, crc16ccitt, } from './wire.js';
10
+ /**
11
+ * @brief The L2/L3 wire codec — a pure-TS/JS port of the C++ reference
12
+ * (core/src/frame.cpp), gated by the shared conformance vectors. Re-exported
13
+ * from ./wire.ts (the subpath entry).
14
+ */
15
+ export { TYPE, ERROR, CodecError, decode, encode, equal, crc32c, crc16ccitt, } from './wire.js';
3
16
  export type { Opt, Timestamp, Crc, Trailer, Tlv } from './wire.js';
package/dist/index.js CHANGED
@@ -1,10 +1,17 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // SPDX-FileCopyrightText: Copyright 2026 avatarsd LLC
3
- // Barrel entry (`@avatarsd-llc/libtracer`) — re-exports every layer the TS core
4
- // implements. For tree-shaking, the wire codec is also reachable directly at the
5
- // layer-scoped subpath `@avatarsd-llc/libtracer/wire` (see ./wire.ts and
6
- // docs/adr/0033-npm-subpackage-monorepo.md).
3
+ /**
4
+ * @brief Barrel entry (`@avatarsd-llc/libtracer`) — re-exports every layer the
5
+ * TS core implements.
6
+ *
7
+ * For tree-shaking, the wire codec is also reachable directly at the
8
+ * layer-scoped subpath `@avatarsd-llc/libtracer/wire` (see ./wire.ts and
9
+ * docs/adr/0033-npm-subpackage-monorepo.md).
10
+ */
7
11
  export const SPEC_VERSION = 1;
8
- // The L2/L3 wire codec — a pure-TS/JS port of the C++ reference (core/src/frame.cpp),
9
- // gated by the shared conformance vectors. Re-exported from ./wire.ts (the subpath entry).
10
- export { TYPE, ERROR, MAX_DEPTH, CodecError, decode, encode, equal, crc32c, crc16ccitt, } from './wire.js';
12
+ /**
13
+ * @brief The L2/L3 wire codec — a pure-TS/JS port of the C++ reference
14
+ * (core/src/frame.cpp), gated by the shared conformance vectors. Re-exported
15
+ * from ./wire.ts (the subpath entry).
16
+ */
17
+ export { TYPE, ERROR, CodecError, decode, encode, equal, crc32c, crc16ccitt, } from './wire.js';
package/dist/wire.d.ts CHANGED
@@ -1,2 +1,11 @@
1
- export { TYPE, ERROR, MAX_DEPTH, CodecError, decode, encode, equal, crc32c, crc16ccitt, } from './codec.mjs';
1
+ /**
2
+ * @brief The L2/L3 wire codec layer (`tr::wire` in the C++ reference) — exposed
3
+ * as the tree-shakeable subpath entry `@avatarsd-llc/libtracer/wire`.
4
+ *
5
+ * It is a pure-TS port of core/src/frame.cpp, gated byte-for-byte by the shared
6
+ * conformance vectors. This is the only layer the TS core implements today; the
7
+ * L0/L1/L4 subpaths (./mem, ./view, ./graph) are reserved for when those layers
8
+ * land in TS — see docs/adr/0033-npm-subpackage-monorepo.md.
9
+ */
10
+ export { TYPE, ERROR, CodecError, decode, encode, equal, crc32c, crc16ccitt, } from './codec.mjs';
2
11
  export type { Opt, Timestamp, Crc, Trailer, Tlv } from './codec.mjs';
package/dist/wire.js CHANGED
@@ -1,9 +1,12 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // SPDX-FileCopyrightText: Copyright 2026 avatarsd LLC
3
- // The L2/L3 wire codec layer (`tr::wire` in the C++ reference) — exposed as the
4
- // tree-shakeable subpath entry `@avatarsd-llc/libtracer/wire`. It is a pure-TS
5
- // port of core/src/frame.cpp, gated byte-for-byte by the shared conformance
6
- // vectors. This is the only layer the TS core implements today; the L0/L1/L4
7
- // subpaths (./mem, ./view, ./graph) are reserved for when those layers land in
8
- // TS — see docs/adr/0033-npm-subpackage-monorepo.md.
9
- export { TYPE, ERROR, MAX_DEPTH, CodecError, decode, encode, equal, crc32c, crc16ccitt, } from './codec.mjs';
3
+ /**
4
+ * @brief The L2/L3 wire codec layer (`tr::wire` in the C++ reference) — exposed
5
+ * as the tree-shakeable subpath entry `@avatarsd-llc/libtracer/wire`.
6
+ *
7
+ * It is a pure-TS port of core/src/frame.cpp, gated byte-for-byte by the shared
8
+ * conformance vectors. This is the only layer the TS core implements today; the
9
+ * L0/L1/L4 subpaths (./mem, ./view, ./graph) are reserved for when those layers
10
+ * land in TS — see docs/adr/0033-npm-subpackage-monorepo.md.
11
+ */
12
+ export { TYPE, 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.3.0",
3
+ "version": "0.5.0",
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",