bitfab 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
@@ -51,7 +51,7 @@ var __version__, __packageName__;
51
51
  var init_version_generated = __esm({
52
52
  "src/version.generated.ts"() {
53
53
  "use strict";
54
- __version__ = "0.38.8";
54
+ __version__ = "0.38.10";
55
55
  __packageName__ = "bitfab";
56
56
  }
57
57
  });
@@ -3226,8 +3226,20 @@ function finalizeTracePayload(payload) {
3226
3226
  // src/claudeAgentSdk.ts
3227
3227
  init_randomUuid();
3228
3228
  init_serialize();
3229
+
3230
+ // src/timestamp.ts
3231
+ var lastTimestampMicros = 0;
3232
+ function nowIsoTimestamp() {
3233
+ const wallClockMicros = Date.now() * 1e3;
3234
+ lastTimestampMicros = Math.max(wallClockMicros, lastTimestampMicros + 1);
3235
+ const milliseconds = Math.floor(lastTimestampMicros / 1e3);
3236
+ const remainingMicros = lastTimestampMicros % 1e3;
3237
+ return new Date(milliseconds).toISOString().replace("Z", `${remainingMicros.toString().padStart(3, "0")}Z`);
3238
+ }
3239
+
3240
+ // src/claudeAgentSdk.ts
3229
3241
  function nowIso() {
3230
- return (/* @__PURE__ */ new Date()).toISOString();
3242
+ return nowIsoTimestamp();
3231
3243
  }
3232
3244
  var safeSerialize = toJsonSafe;
3233
3245
  function extractContentBlocks(content) {
@@ -4247,7 +4259,7 @@ var LANGGRAPH_METADATA_KEYS = [
4247
4259
  "langgraph_checkpoint_ns"
4248
4260
  ];
4249
4261
  function nowIso2() {
4250
- return (/* @__PURE__ */ new Date()).toISOString();
4262
+ return nowIsoTimestamp();
4251
4263
  }
4252
4264
  function normalizeChainStartArgs(parentRunIdOrRunType, runTypeOrRunName, runNameOrParentRunId) {
4253
4265
  if (parentRunIdOrRunType && CHAIN_RUN_TYPES.has(parentRunIdOrRunType)) {
@@ -5858,7 +5870,7 @@ function getCurrentTrace() {
5858
5870
  if (!traceState) {
5859
5871
  traceState = {
5860
5872
  traceId,
5861
- startedAt: (/* @__PURE__ */ new Date()).toISOString(),
5873
+ startedAt: nowIsoTimestamp(),
5862
5874
  contexts: []
5863
5875
  };
5864
5876
  activeTraceStates.set(traceId, traceState);
@@ -6159,6 +6171,7 @@ var Bitfab = class {
6159
6171
  return invokeWithoutNode();
6160
6172
  }
6161
6173
  spansUsed += 1;
6174
+ const mockOnReplay = nodeConfiguration?.mockOnReplay ?? options.mockOnReplayDefault;
6162
6175
  const childOptions = {
6163
6176
  name: nodeConfiguration?.name ?? definition.name,
6164
6177
  type: nodeConfiguration?.type ?? "function",
@@ -6169,8 +6182,8 @@ var Bitfab = class {
6169
6182
  ...nodeConfiguration?.testRunId !== void 0 && {
6170
6183
  testRunId: nodeConfiguration.testRunId
6171
6184
  },
6172
- ...nodeConfiguration?.mockOnReplay !== void 0 && {
6173
- mockOnReplay: nodeConfiguration.mockOnReplay
6185
+ ...mockOnReplay !== void 0 && {
6186
+ mockOnReplay
6174
6187
  },
6175
6188
  ...nodeConfiguration?.finalize !== void 0 && {
6176
6189
  finalize: nodeConfiguration.finalize
@@ -6792,7 +6805,7 @@ var Bitfab = class {
6792
6805
  const newContext = { traceId, spanId, contexts: [] };
6793
6806
  newStack = [...currentStack, newContext];
6794
6807
  const inputs = args;
6795
- const startedAt = (/* @__PURE__ */ new Date()).toISOString();
6808
+ const startedAt = nowIsoTimestamp();
6796
6809
  const replayCtxAtStart = getReplayContext();
6797
6810
  const testRunId = replayCtxAtStart?.testRunId ?? options.testRunId;
6798
6811
  if (isRootSpan && !activeTraceStates.has(traceId)) {
@@ -6827,7 +6840,7 @@ var Bitfab = class {
6827
6840
  const sendSpan = async (params) => {
6828
6841
  const replayCtx = getReplayContext();
6829
6842
  try {
6830
- const endedAt = (/* @__PURE__ */ new Date()).toISOString();
6843
+ const endedAt = nowIsoTimestamp();
6831
6844
  const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
6832
6845
  if (!traceDropped) {
6833
6846
  self.sendWrapperSpan({