@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.
@@ -19,7 +19,7 @@ import {
19
19
  toJsonSafe,
20
20
  toJsonSafeReport,
21
21
  warnOnce
22
- } from "./chunk-VCGFTX2G.js";
22
+ } from "./chunk-2I5TFNGK.js";
23
23
  import {
24
24
  __privateAdd,
25
25
  __privateGet,
@@ -83,9 +83,19 @@ function finalizeTracePayload(payload) {
83
83
  return result;
84
84
  }
85
85
 
86
+ // src/timestamp.ts
87
+ var lastTimestampMicros = 0;
88
+ function nowIsoTimestamp() {
89
+ const wallClockMicros = Date.now() * 1e3;
90
+ lastTimestampMicros = Math.max(wallClockMicros, lastTimestampMicros + 1);
91
+ const milliseconds = Math.floor(lastTimestampMicros / 1e3);
92
+ const remainingMicros = lastTimestampMicros % 1e3;
93
+ return new Date(milliseconds).toISOString().replace("Z", `${remainingMicros.toString().padStart(3, "0")}Z`);
94
+ }
95
+
86
96
  // src/claudeAgentSdk.ts
87
97
  function nowIso() {
88
- return (/* @__PURE__ */ new Date()).toISOString();
98
+ return nowIsoTimestamp();
89
99
  }
90
100
  var safeSerialize = toJsonSafe;
91
101
  function extractContentBlocks(content) {
@@ -964,7 +974,7 @@ var LANGGRAPH_METADATA_KEYS = [
964
974
  "langgraph_checkpoint_ns"
965
975
  ];
966
976
  function nowIso2() {
967
- return (/* @__PURE__ */ new Date()).toISOString();
977
+ return nowIsoTimestamp();
968
978
  }
969
979
  function normalizeChainStartArgs(parentRunIdOrRunType, runTypeOrRunName, runNameOrParentRunId) {
970
980
  if (parentRunIdOrRunType && CHAIN_RUN_TYPES.has(parentRunIdOrRunType)) {
@@ -2559,7 +2569,7 @@ function getCurrentTrace() {
2559
2569
  if (!traceState) {
2560
2570
  traceState = {
2561
2571
  traceId,
2562
- startedAt: (/* @__PURE__ */ new Date()).toISOString(),
2572
+ startedAt: nowIsoTimestamp(),
2563
2573
  contexts: []
2564
2574
  };
2565
2575
  activeTraceStates.set(traceId, traceState);
@@ -3493,7 +3503,7 @@ var Bitfab = class {
3493
3503
  const newContext = { traceId, spanId, contexts: [] };
3494
3504
  newStack = [...currentStack, newContext];
3495
3505
  const inputs = args;
3496
- const startedAt = (/* @__PURE__ */ new Date()).toISOString();
3506
+ const startedAt = nowIsoTimestamp();
3497
3507
  const replayCtxAtStart = getReplayContext();
3498
3508
  const testRunId = replayCtxAtStart?.testRunId ?? options.testRunId;
3499
3509
  if (isRootSpan && !activeTraceStates.has(traceId)) {
@@ -3528,7 +3538,7 @@ var Bitfab = class {
3528
3538
  const sendSpan = async (params) => {
3529
3539
  const replayCtx = getReplayContext();
3530
3540
  try {
3531
- const endedAt = (/* @__PURE__ */ new Date()).toISOString();
3541
+ const endedAt = nowIsoTimestamp();
3532
3542
  const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
3533
3543
  if (!traceDropped) {
3534
3544
  self.sendWrapperSpan({
@@ -4102,7 +4112,7 @@ var Bitfab = class {
4102
4112
  `Function is wrapped with trace function key '${wrappedKey}' but replay was called with '${traceFunctionKey}'. Pass matching keys, or pass the unwrapped function to replay it under the explicit key.`
4103
4113
  );
4104
4114
  }
4105
- const { replay: doReplay } = await import("./replay-L2OSAP6N.js");
4115
+ const { replay: doReplay } = await import("./replay-EC7CQOO3.js");
4106
4116
  return doReplay(
4107
4117
  this.httpClient,
4108
4118
  this.serviceUrl,
@@ -4355,4 +4365,4 @@ export {
4355
4365
  finalizers,
4356
4366
  defineReplayRegistry
4357
4367
  };
4358
- //# sourceMappingURL=chunk-CKOOG3TW.js.map
4368
+ //# sourceMappingURL=chunk-B4XXAK74.js.map