agent-inspect 6.31.2 → 6.31.3

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.
@@ -13,7 +13,7 @@ import { createServer } from 'http';
13
13
  import { createRequire } from 'module';
14
14
 
15
15
  // package.json
16
- var version = "6.31.2";
16
+ var version = "6.31.3";
17
17
 
18
18
  // packages/cli/src/trace-dir-scale.ts
19
19
  var TRACE_COUNT_WARN = 1e3;
@@ -2396,6 +2396,11 @@ function exportOpenInference(tree, options) {
2396
2396
  function hexFrom2(seed, byteLen) {
2397
2397
  return crypto.createHash("sha256").update(seed, "utf8").digest("hex").slice(0, byteLen * 2);
2398
2398
  }
2399
+ function unixNano2(ms) {
2400
+ const whole = Math.trunc(ms);
2401
+ const fractionNs = Math.round((ms - whole) * 1e6);
2402
+ return BigInt(whole) * 1000000n + BigInt(fractionNs);
2403
+ }
2399
2404
  function stringAttr(key, value) {
2400
2405
  return { key, value: { stringValue: value } };
2401
2406
  }
@@ -2429,10 +2434,10 @@ function exportOtlpJson(tree, options) {
2429
2434
  const ev = n.event;
2430
2435
  const spanId = hexFrom2(`${tree.runId}:${ev.eventId}`, 8);
2431
2436
  const parentSpanId = ev.parentId ? hexFrom2(`${tree.runId}:${ev.parentId}`, 8) : void 0;
2432
- const startNs = String(Math.round(ev.timestamp * 1e6));
2437
+ const startNs = String(unixNano2(ev.timestamp));
2433
2438
  let endNs;
2434
2439
  if (ev.durationMs !== void 0 && Number.isFinite(ev.durationMs)) {
2435
- endNs = String(Math.round(ev.timestamp * 1e6 + ev.durationMs * 1e6));
2440
+ endNs = String(unixNano2(ev.timestamp) + unixNano2(ev.durationMs));
2436
2441
  }
2437
2442
  const attrs = [
2438
2443
  stringAttr("agent_inspect.kind", ev.kind),