@bitfab/sdk 0.38.8 → 0.38.10

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-BNOVHUQB.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);
@@ -2860,6 +2870,7 @@ var Bitfab = class {
2860
2870
  return invokeWithoutNode();
2861
2871
  }
2862
2872
  spansUsed += 1;
2873
+ const mockOnReplay = nodeConfiguration?.mockOnReplay ?? options.mockOnReplayDefault;
2863
2874
  const childOptions = {
2864
2875
  name: nodeConfiguration?.name ?? definition.name,
2865
2876
  type: nodeConfiguration?.type ?? "function",
@@ -2870,8 +2881,8 @@ var Bitfab = class {
2870
2881
  ...nodeConfiguration?.testRunId !== void 0 && {
2871
2882
  testRunId: nodeConfiguration.testRunId
2872
2883
  },
2873
- ...nodeConfiguration?.mockOnReplay !== void 0 && {
2874
- mockOnReplay: nodeConfiguration.mockOnReplay
2884
+ ...mockOnReplay !== void 0 && {
2885
+ mockOnReplay
2875
2886
  },
2876
2887
  ...nodeConfiguration?.finalize !== void 0 && {
2877
2888
  finalize: nodeConfiguration.finalize
@@ -3493,7 +3504,7 @@ var Bitfab = class {
3493
3504
  const newContext = { traceId, spanId, contexts: [] };
3494
3505
  newStack = [...currentStack, newContext];
3495
3506
  const inputs = args;
3496
- const startedAt = (/* @__PURE__ */ new Date()).toISOString();
3507
+ const startedAt = nowIsoTimestamp();
3497
3508
  const replayCtxAtStart = getReplayContext();
3498
3509
  const testRunId = replayCtxAtStart?.testRunId ?? options.testRunId;
3499
3510
  if (isRootSpan && !activeTraceStates.has(traceId)) {
@@ -3528,7 +3539,7 @@ var Bitfab = class {
3528
3539
  const sendSpan = async (params) => {
3529
3540
  const replayCtx = getReplayContext();
3530
3541
  try {
3531
- const endedAt = (/* @__PURE__ */ new Date()).toISOString();
3542
+ const endedAt = nowIsoTimestamp();
3532
3543
  const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
3533
3544
  if (!traceDropped) {
3534
3545
  self.sendWrapperSpan({
@@ -4102,7 +4113,7 @@ var Bitfab = class {
4102
4113
  `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
4114
  );
4104
4115
  }
4105
- const { replay: doReplay } = await import("./replay-L2OSAP6N.js");
4116
+ const { replay: doReplay } = await import("./replay-SMUBBMNK.js");
4106
4117
  return doReplay(
4107
4118
  this.httpClient,
4108
4119
  this.serviceUrl,
@@ -4355,4 +4366,4 @@ export {
4355
4366
  finalizers,
4356
4367
  defineReplayRegistry
4357
4368
  };
4358
- //# sourceMappingURL=chunk-CKOOG3TW.js.map
4369
+ //# sourceMappingURL=chunk-UE4GGPM6.js.map