@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.cjs CHANGED
@@ -42,7 +42,7 @@ var __version__, __packageName__;
42
42
  var init_version_generated = __esm({
43
43
  "src/version.generated.ts"() {
44
44
  "use strict";
45
- __version__ = "0.38.8";
45
+ __version__ = "0.38.9";
46
46
  __packageName__ = "@bitfab/sdk";
47
47
  }
48
48
  });
@@ -3217,8 +3217,20 @@ function finalizeTracePayload(payload) {
3217
3217
  // src/claudeAgentSdk.ts
3218
3218
  init_randomUuid();
3219
3219
  init_serialize();
3220
+
3221
+ // src/timestamp.ts
3222
+ var lastTimestampMicros = 0;
3223
+ function nowIsoTimestamp() {
3224
+ const wallClockMicros = Date.now() * 1e3;
3225
+ lastTimestampMicros = Math.max(wallClockMicros, lastTimestampMicros + 1);
3226
+ const milliseconds = Math.floor(lastTimestampMicros / 1e3);
3227
+ const remainingMicros = lastTimestampMicros % 1e3;
3228
+ return new Date(milliseconds).toISOString().replace("Z", `${remainingMicros.toString().padStart(3, "0")}Z`);
3229
+ }
3230
+
3231
+ // src/claudeAgentSdk.ts
3220
3232
  function nowIso() {
3221
- return (/* @__PURE__ */ new Date()).toISOString();
3233
+ return nowIsoTimestamp();
3222
3234
  }
3223
3235
  var safeSerialize = toJsonSafe;
3224
3236
  function extractContentBlocks(content) {
@@ -4238,7 +4250,7 @@ var LANGGRAPH_METADATA_KEYS = [
4238
4250
  "langgraph_checkpoint_ns"
4239
4251
  ];
4240
4252
  function nowIso2() {
4241
- return (/* @__PURE__ */ new Date()).toISOString();
4253
+ return nowIsoTimestamp();
4242
4254
  }
4243
4255
  function normalizeChainStartArgs(parentRunIdOrRunType, runTypeOrRunName, runNameOrParentRunId) {
4244
4256
  if (parentRunIdOrRunType && CHAIN_RUN_TYPES.has(parentRunIdOrRunType)) {
@@ -5849,7 +5861,7 @@ function getCurrentTrace() {
5849
5861
  if (!traceState) {
5850
5862
  traceState = {
5851
5863
  traceId,
5852
- startedAt: (/* @__PURE__ */ new Date()).toISOString(),
5864
+ startedAt: nowIsoTimestamp(),
5853
5865
  contexts: []
5854
5866
  };
5855
5867
  activeTraceStates.set(traceId, traceState);
@@ -6783,7 +6795,7 @@ var Bitfab = class {
6783
6795
  const newContext = { traceId, spanId, contexts: [] };
6784
6796
  newStack = [...currentStack, newContext];
6785
6797
  const inputs = args;
6786
- const startedAt = (/* @__PURE__ */ new Date()).toISOString();
6798
+ const startedAt = nowIsoTimestamp();
6787
6799
  const replayCtxAtStart = getReplayContext();
6788
6800
  const testRunId = replayCtxAtStart?.testRunId ?? options.testRunId;
6789
6801
  if (isRootSpan && !activeTraceStates.has(traceId)) {
@@ -6818,7 +6830,7 @@ var Bitfab = class {
6818
6830
  const sendSpan = async (params) => {
6819
6831
  const replayCtx = getReplayContext();
6820
6832
  try {
6821
- const endedAt = (/* @__PURE__ */ new Date()).toISOString();
6833
+ const endedAt = nowIsoTimestamp();
6822
6834
  const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
6823
6835
  if (!traceDropped) {
6824
6836
  self.sendWrapperSpan({