@bitfab/sdk 0.38.8 → 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
@@ -2885,7 +2885,7 @@ declare class BitfabFunction {
2885
2885
  /**
2886
2886
  * SDK version from package.json (injected at build time)
2887
2887
  */
2888
- declare const __version__ = "0.38.8";
2888
+ declare const __version__ = "0.38.9";
2889
2889
 
2890
2890
  /**
2891
2891
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -2885,7 +2885,7 @@ declare class BitfabFunction {
2885
2885
  /**
2886
2886
  * SDK version from package.json (injected at build time)
2887
2887
  */
2888
- declare const __version__ = "0.38.8";
2888
+ declare const __version__ = "0.38.9";
2889
2889
 
2890
2890
  /**
2891
2891
  * Constants for the Bitfab SDK.
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  getCurrentReplayBranch,
14
14
  getCurrentSpan,
15
15
  getCurrentTrace
16
- } from "./chunk-CKOOG3TW.js";
16
+ } from "./chunk-B4XXAK74.js";
17
17
  import "./chunk-ZUD7OFYB.js";
18
18
  import {
19
19
  BITFAB_PROGRESS_PREFIX,
@@ -27,7 +27,7 @@ import {
27
27
  flushTraces,
28
28
  reportReplayProgress,
29
29
  serializeReplayResult
30
- } from "./chunk-VCGFTX2G.js";
30
+ } from "./chunk-2I5TFNGK.js";
31
31
  import "./chunk-H6LZRFMN.js";
32
32
  export {
33
33
  BITFAB_PROGRESS_PREFIX,
package/dist/node.cjs CHANGED
@@ -88,7 +88,7 @@ var __version__, __packageName__;
88
88
  var init_version_generated = __esm({
89
89
  "src/version.generated.ts"() {
90
90
  "use strict";
91
- __version__ = "0.38.8";
91
+ __version__ = "0.38.9";
92
92
  __packageName__ = "@bitfab/sdk";
93
93
  }
94
94
  });
@@ -3231,8 +3231,20 @@ function finalizeTracePayload(payload) {
3231
3231
  // src/claudeAgentSdk.ts
3232
3232
  init_randomUuid();
3233
3233
  init_serialize();
3234
+
3235
+ // src/timestamp.ts
3236
+ var lastTimestampMicros = 0;
3237
+ function nowIsoTimestamp() {
3238
+ const wallClockMicros = Date.now() * 1e3;
3239
+ lastTimestampMicros = Math.max(wallClockMicros, lastTimestampMicros + 1);
3240
+ const milliseconds = Math.floor(lastTimestampMicros / 1e3);
3241
+ const remainingMicros = lastTimestampMicros % 1e3;
3242
+ return new Date(milliseconds).toISOString().replace("Z", `${remainingMicros.toString().padStart(3, "0")}Z`);
3243
+ }
3244
+
3245
+ // src/claudeAgentSdk.ts
3234
3246
  function nowIso() {
3235
- return (/* @__PURE__ */ new Date()).toISOString();
3247
+ return nowIsoTimestamp();
3236
3248
  }
3237
3249
  var safeSerialize = toJsonSafe;
3238
3250
  function extractContentBlocks(content) {
@@ -4252,7 +4264,7 @@ var LANGGRAPH_METADATA_KEYS = [
4252
4264
  "langgraph_checkpoint_ns"
4253
4265
  ];
4254
4266
  function nowIso2() {
4255
- return (/* @__PURE__ */ new Date()).toISOString();
4267
+ return nowIsoTimestamp();
4256
4268
  }
4257
4269
  function normalizeChainStartArgs(parentRunIdOrRunType, runTypeOrRunName, runNameOrParentRunId) {
4258
4270
  if (parentRunIdOrRunType && CHAIN_RUN_TYPES.has(parentRunIdOrRunType)) {
@@ -5863,7 +5875,7 @@ function getCurrentTrace() {
5863
5875
  if (!traceState) {
5864
5876
  traceState = {
5865
5877
  traceId,
5866
- startedAt: (/* @__PURE__ */ new Date()).toISOString(),
5878
+ startedAt: nowIsoTimestamp(),
5867
5879
  contexts: []
5868
5880
  };
5869
5881
  activeTraceStates.set(traceId, traceState);
@@ -6797,7 +6809,7 @@ var Bitfab = class {
6797
6809
  const newContext = { traceId, spanId, contexts: [] };
6798
6810
  newStack = [...currentStack, newContext];
6799
6811
  const inputs = args;
6800
- const startedAt = (/* @__PURE__ */ new Date()).toISOString();
6812
+ const startedAt = nowIsoTimestamp();
6801
6813
  const replayCtxAtStart = getReplayContext();
6802
6814
  const testRunId = replayCtxAtStart?.testRunId ?? options.testRunId;
6803
6815
  if (isRootSpan && !activeTraceStates.has(traceId)) {
@@ -6832,7 +6844,7 @@ var Bitfab = class {
6832
6844
  const sendSpan = async (params) => {
6833
6845
  const replayCtx = getReplayContext();
6834
6846
  try {
6835
- const endedAt = (/* @__PURE__ */ new Date()).toISOString();
6847
+ const endedAt = nowIsoTimestamp();
6836
6848
  const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
6837
6849
  if (!traceDropped) {
6838
6850
  self.sendWrapperSpan({