bitfab 0.38.7 → 0.38.9

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/index.d.cts CHANGED
@@ -1881,13 +1881,14 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
1881
1881
  */
1882
1882
  onTraceEnd(trace: Trace): Promise<void>;
1883
1883
  /**
1884
- * Called when a span is started.
1884
+ * Called when a span is started. Span payloads are authoritative completed
1885
+ * snapshots, so start notifications do not cross the transport boundary.
1885
1886
  */
1886
- onSpanStart(span: Span<any>): Promise<void>;
1887
+ onSpanStart(_span: Span<any>): Promise<void>;
1887
1888
  /**
1888
1889
  * Called when a span is ended.
1889
1890
  *
1890
- * Send all spans to Bitfab for complete trace capture.
1891
+ * Send the finalized span snapshot to Bitfab for complete trace capture.
1891
1892
  */
1892
1893
  onSpanEnd(span: Span<any>): Promise<void>;
1893
1894
  /**
@@ -2884,7 +2885,7 @@ declare class BitfabFunction {
2884
2885
  /**
2885
2886
  * SDK version from package.json (injected at build time)
2886
2887
  */
2887
- declare const __version__ = "0.38.7";
2888
+ declare const __version__ = "0.38.9";
2888
2889
 
2889
2890
  /**
2890
2891
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -1881,13 +1881,14 @@ declare class BitfabOpenAITracingProcessor implements TracingProcessor {
1881
1881
  */
1882
1882
  onTraceEnd(trace: Trace): Promise<void>;
1883
1883
  /**
1884
- * Called when a span is started.
1884
+ * Called when a span is started. Span payloads are authoritative completed
1885
+ * snapshots, so start notifications do not cross the transport boundary.
1885
1886
  */
1886
- onSpanStart(span: Span<any>): Promise<void>;
1887
+ onSpanStart(_span: Span<any>): Promise<void>;
1887
1888
  /**
1888
1889
  * Called when a span is ended.
1889
1890
  *
1890
- * Send all spans to Bitfab for complete trace capture.
1891
+ * Send the finalized span snapshot to Bitfab for complete trace capture.
1891
1892
  */
1892
1893
  onSpanEnd(span: Span<any>): Promise<void>;
1893
1894
  /**
@@ -2884,7 +2885,7 @@ declare class BitfabFunction {
2884
2885
  /**
2885
2886
  * SDK version from package.json (injected at build time)
2886
2887
  */
2887
- declare const __version__ = "0.38.7";
2888
+ declare const __version__ = "0.38.9";
2888
2889
 
2889
2890
  /**
2890
2891
  * Constants for the Bitfab SDK.
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  getCurrentReplayBranch,
23
23
  getCurrentSpan,
24
24
  getCurrentTrace
25
- } from "./chunk-DXM6GTLL.js";
25
+ } from "./chunk-EPU5AUT4.js";
26
26
  import "./chunk-ZUD7OFYB.js";
27
27
  import {
28
28
  BITFAB_PROGRESS_PREFIX,
@@ -36,7 +36,7 @@ import {
36
36
  flushTraces,
37
37
  reportReplayProgress,
38
38
  serializeReplayResult
39
- } from "./chunk-2OJZPS6C.js";
39
+ } from "./chunk-J73FXDFA.js";
40
40
  import "./chunk-H6LZRFMN.js";
41
41
  export {
42
42
  BITFAB_PROGRESS_PREFIX,
package/dist/node.cjs CHANGED
@@ -97,7 +97,7 @@ var __version__, __packageName__;
97
97
  var init_version_generated = __esm({
98
98
  "src/version.generated.ts"() {
99
99
  "use strict";
100
- __version__ = "0.38.7";
100
+ __version__ = "0.38.9";
101
101
  __packageName__ = "bitfab";
102
102
  }
103
103
  });
@@ -3240,8 +3240,20 @@ function finalizeTracePayload(payload) {
3240
3240
  // src/claudeAgentSdk.ts
3241
3241
  init_randomUuid();
3242
3242
  init_serialize();
3243
+
3244
+ // src/timestamp.ts
3245
+ var lastTimestampMicros = 0;
3246
+ function nowIsoTimestamp() {
3247
+ const wallClockMicros = Date.now() * 1e3;
3248
+ lastTimestampMicros = Math.max(wallClockMicros, lastTimestampMicros + 1);
3249
+ const milliseconds = Math.floor(lastTimestampMicros / 1e3);
3250
+ const remainingMicros = lastTimestampMicros % 1e3;
3251
+ return new Date(milliseconds).toISOString().replace("Z", `${remainingMicros.toString().padStart(3, "0")}Z`);
3252
+ }
3253
+
3254
+ // src/claudeAgentSdk.ts
3243
3255
  function nowIso() {
3244
- return (/* @__PURE__ */ new Date()).toISOString();
3256
+ return nowIsoTimestamp();
3245
3257
  }
3246
3258
  var safeSerialize = toJsonSafe;
3247
3259
  function extractContentBlocks(content) {
@@ -4261,7 +4273,7 @@ var LANGGRAPH_METADATA_KEYS = [
4261
4273
  "langgraph_checkpoint_ns"
4262
4274
  ];
4263
4275
  function nowIso2() {
4264
- return (/* @__PURE__ */ new Date()).toISOString();
4276
+ return nowIsoTimestamp();
4265
4277
  }
4266
4278
  function normalizeChainStartArgs(parentRunIdOrRunType, runTypeOrRunName, runNameOrParentRunId) {
4267
4279
  if (parentRunIdOrRunType && CHAIN_RUN_TYPES.has(parentRunIdOrRunType)) {
@@ -5303,16 +5315,16 @@ var BitfabOpenAITracingProcessor = class {
5303
5315
  delete this.activeTraces[trace.traceId];
5304
5316
  }
5305
5317
  /**
5306
- * Called when a span is started.
5318
+ * Called when a span is started. Span payloads are authoritative completed
5319
+ * snapshots, so start notifications do not cross the transport boundary.
5307
5320
  */
5308
5321
  // biome-ignore lint/suspicious/noExplicitAny: OpenAI Agents SDK uses any for span data
5309
- async onSpanStart(span) {
5310
- this.sendSpan(span);
5322
+ async onSpanStart(_span) {
5311
5323
  }
5312
5324
  /**
5313
5325
  * Called when a span is ended.
5314
5326
  *
5315
- * Send all spans to Bitfab for complete trace capture.
5327
+ * Send the finalized span snapshot to Bitfab for complete trace capture.
5316
5328
  */
5317
5329
  // biome-ignore lint/suspicious/noExplicitAny: OpenAI Agents SDK uses any for span data
5318
5330
  async onSpanEnd(span) {
@@ -5872,7 +5884,7 @@ function getCurrentTrace() {
5872
5884
  if (!traceState) {
5873
5885
  traceState = {
5874
5886
  traceId,
5875
- startedAt: (/* @__PURE__ */ new Date()).toISOString(),
5887
+ startedAt: nowIsoTimestamp(),
5876
5888
  contexts: []
5877
5889
  };
5878
5890
  activeTraceStates.set(traceId, traceState);
@@ -6806,7 +6818,7 @@ var Bitfab = class {
6806
6818
  const newContext = { traceId, spanId, contexts: [] };
6807
6819
  newStack = [...currentStack, newContext];
6808
6820
  const inputs = args;
6809
- const startedAt = (/* @__PURE__ */ new Date()).toISOString();
6821
+ const startedAt = nowIsoTimestamp();
6810
6822
  const replayCtxAtStart = getReplayContext();
6811
6823
  const testRunId = replayCtxAtStart?.testRunId ?? options.testRunId;
6812
6824
  if (isRootSpan && !activeTraceStates.has(traceId)) {
@@ -6841,7 +6853,7 @@ var Bitfab = class {
6841
6853
  const sendSpan = async (params) => {
6842
6854
  const replayCtx = getReplayContext();
6843
6855
  try {
6844
- const endedAt = (/* @__PURE__ */ new Date()).toISOString();
6856
+ const endedAt = nowIsoTimestamp();
6845
6857
  const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
6846
6858
  if (!traceDropped) {
6847
6859
  self.sendWrapperSpan({