@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.
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.10";
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);
@@ -6150,6 +6162,7 @@ var Bitfab = class {
6150
6162
  return invokeWithoutNode();
6151
6163
  }
6152
6164
  spansUsed += 1;
6165
+ const mockOnReplay = nodeConfiguration?.mockOnReplay ?? options.mockOnReplayDefault;
6153
6166
  const childOptions = {
6154
6167
  name: nodeConfiguration?.name ?? definition.name,
6155
6168
  type: nodeConfiguration?.type ?? "function",
@@ -6160,8 +6173,8 @@ var Bitfab = class {
6160
6173
  ...nodeConfiguration?.testRunId !== void 0 && {
6161
6174
  testRunId: nodeConfiguration.testRunId
6162
6175
  },
6163
- ...nodeConfiguration?.mockOnReplay !== void 0 && {
6164
- mockOnReplay: nodeConfiguration.mockOnReplay
6176
+ ...mockOnReplay !== void 0 && {
6177
+ mockOnReplay
6165
6178
  },
6166
6179
  ...nodeConfiguration?.finalize !== void 0 && {
6167
6180
  finalize: nodeConfiguration.finalize
@@ -6783,7 +6796,7 @@ var Bitfab = class {
6783
6796
  const newContext = { traceId, spanId, contexts: [] };
6784
6797
  newStack = [...currentStack, newContext];
6785
6798
  const inputs = args;
6786
- const startedAt = (/* @__PURE__ */ new Date()).toISOString();
6799
+ const startedAt = nowIsoTimestamp();
6787
6800
  const replayCtxAtStart = getReplayContext();
6788
6801
  const testRunId = replayCtxAtStart?.testRunId ?? options.testRunId;
6789
6802
  if (isRootSpan && !activeTraceStates.has(traceId)) {
@@ -6818,7 +6831,7 @@ var Bitfab = class {
6818
6831
  const sendSpan = async (params) => {
6819
6832
  const replayCtx = getReplayContext();
6820
6833
  try {
6821
- const endedAt = (/* @__PURE__ */ new Date()).toISOString();
6834
+ const endedAt = nowIsoTimestamp();
6822
6835
  const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
6823
6836
  if (!traceDropped) {
6824
6837
  self.sendWrapperSpan({