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.d.cts CHANGED
@@ -2209,6 +2209,12 @@ interface TraceOptions {
2209
2209
  name?: string;
2210
2210
  /** Root span type. Descendants are always `function` spans. */
2211
2211
  type?: SpanType;
2212
+ /**
2213
+ * Default replay-mocking policy for automatically captured descendants.
2214
+ * When true, those descendants are mocked by the default "marked" strategy
2215
+ * unless a node explicitly sets `mockOnReplay: false`. Defaults to false.
2216
+ */
2217
+ mockOnReplayDefault?: boolean;
2212
2218
  /** Maximum number of recorded descendant levels. Defaults to 30. */
2213
2219
  maxDepth?: number;
2214
2220
  /** Maximum descendant spans recorded per root invocation. Defaults to 500. */
@@ -2885,7 +2891,7 @@ declare class BitfabFunction {
2885
2891
  /**
2886
2892
  * SDK version from package.json (injected at build time)
2887
2893
  */
2888
- declare const __version__ = "0.38.8";
2894
+ declare const __version__ = "0.38.10";
2889
2895
 
2890
2896
  /**
2891
2897
  * Constants for the Bitfab SDK.
package/dist/index.d.ts CHANGED
@@ -2209,6 +2209,12 @@ interface TraceOptions {
2209
2209
  name?: string;
2210
2210
  /** Root span type. Descendants are always `function` spans. */
2211
2211
  type?: SpanType;
2212
+ /**
2213
+ * Default replay-mocking policy for automatically captured descendants.
2214
+ * When true, those descendants are mocked by the default "marked" strategy
2215
+ * unless a node explicitly sets `mockOnReplay: false`. Defaults to false.
2216
+ */
2217
+ mockOnReplayDefault?: boolean;
2212
2218
  /** Maximum number of recorded descendant levels. Defaults to 30. */
2213
2219
  maxDepth?: number;
2214
2220
  /** Maximum descendant spans recorded per root invocation. Defaults to 500. */
@@ -2885,7 +2891,7 @@ declare class BitfabFunction {
2885
2891
  /**
2886
2892
  * SDK version from package.json (injected at build time)
2887
2893
  */
2888
- declare const __version__ = "0.38.8";
2894
+ declare const __version__ = "0.38.10";
2889
2895
 
2890
2896
  /**
2891
2897
  * Constants for the Bitfab SDK.
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  getCurrentReplayBranch,
23
23
  getCurrentSpan,
24
24
  getCurrentTrace
25
- } from "./chunk-U44TJWVV.js";
25
+ } from "./chunk-YDAHL42D.js";
26
26
  import "./chunk-ZUD7OFYB.js";
27
27
  import {
28
28
  BITFAB_PROGRESS_PREFIX,
@@ -36,7 +36,7 @@ import {
36
36
  flushTraces,
37
37
  reportReplayProgress,
38
38
  serializeReplayResult
39
- } from "./chunk-TBA67Q3N.js";
39
+ } from "./chunk-RPEHXTSG.js";
40
40
  import "./chunk-H6LZRFMN.js";
41
41
  export {
42
42
  BITFAB_PROGRESS_PREFIX,
package/dist/node.cjs CHANGED
@@ -97,7 +97,7 @@ var __version__, __packageName__;
97
97
  var init_version_generated = __esm({
98
98
  "src/version.generated.ts"() {
99
99
  "use strict";
100
- __version__ = "0.38.8";
100
+ __version__ = "0.38.10";
101
101
  __packageName__ = "bitfab";
102
102
  }
103
103
  });
@@ -3240,8 +3240,20 @@ function finalizeTracePayload(payload) {
3240
3240
  // src/claudeAgentSdk.ts
3241
3241
  init_randomUuid();
3242
3242
  init_serialize();
3243
+
3244
+ // src/timestamp.ts
3245
+ var lastTimestampMicros = 0;
3246
+ function nowIsoTimestamp() {
3247
+ const wallClockMicros = Date.now() * 1e3;
3248
+ lastTimestampMicros = Math.max(wallClockMicros, lastTimestampMicros + 1);
3249
+ const milliseconds = Math.floor(lastTimestampMicros / 1e3);
3250
+ const remainingMicros = lastTimestampMicros % 1e3;
3251
+ return new Date(milliseconds).toISOString().replace("Z", `${remainingMicros.toString().padStart(3, "0")}Z`);
3252
+ }
3253
+
3254
+ // src/claudeAgentSdk.ts
3243
3255
  function nowIso() {
3244
- return (/* @__PURE__ */ new Date()).toISOString();
3256
+ return nowIsoTimestamp();
3245
3257
  }
3246
3258
  var safeSerialize = toJsonSafe;
3247
3259
  function extractContentBlocks(content) {
@@ -4261,7 +4273,7 @@ var LANGGRAPH_METADATA_KEYS = [
4261
4273
  "langgraph_checkpoint_ns"
4262
4274
  ];
4263
4275
  function nowIso2() {
4264
- return (/* @__PURE__ */ new Date()).toISOString();
4276
+ return nowIsoTimestamp();
4265
4277
  }
4266
4278
  function normalizeChainStartArgs(parentRunIdOrRunType, runTypeOrRunName, runNameOrParentRunId) {
4267
4279
  if (parentRunIdOrRunType && CHAIN_RUN_TYPES.has(parentRunIdOrRunType)) {
@@ -5872,7 +5884,7 @@ function getCurrentTrace() {
5872
5884
  if (!traceState) {
5873
5885
  traceState = {
5874
5886
  traceId,
5875
- startedAt: (/* @__PURE__ */ new Date()).toISOString(),
5887
+ startedAt: nowIsoTimestamp(),
5876
5888
  contexts: []
5877
5889
  };
5878
5890
  activeTraceStates.set(traceId, traceState);
@@ -6173,6 +6185,7 @@ var Bitfab = class {
6173
6185
  return invokeWithoutNode();
6174
6186
  }
6175
6187
  spansUsed += 1;
6188
+ const mockOnReplay = nodeConfiguration?.mockOnReplay ?? options.mockOnReplayDefault;
6176
6189
  const childOptions = {
6177
6190
  name: nodeConfiguration?.name ?? definition.name,
6178
6191
  type: nodeConfiguration?.type ?? "function",
@@ -6183,8 +6196,8 @@ var Bitfab = class {
6183
6196
  ...nodeConfiguration?.testRunId !== void 0 && {
6184
6197
  testRunId: nodeConfiguration.testRunId
6185
6198
  },
6186
- ...nodeConfiguration?.mockOnReplay !== void 0 && {
6187
- mockOnReplay: nodeConfiguration.mockOnReplay
6199
+ ...mockOnReplay !== void 0 && {
6200
+ mockOnReplay
6188
6201
  },
6189
6202
  ...nodeConfiguration?.finalize !== void 0 && {
6190
6203
  finalize: nodeConfiguration.finalize
@@ -6806,7 +6819,7 @@ var Bitfab = class {
6806
6819
  const newContext = { traceId, spanId, contexts: [] };
6807
6820
  newStack = [...currentStack, newContext];
6808
6821
  const inputs = args;
6809
- const startedAt = (/* @__PURE__ */ new Date()).toISOString();
6822
+ const startedAt = nowIsoTimestamp();
6810
6823
  const replayCtxAtStart = getReplayContext();
6811
6824
  const testRunId = replayCtxAtStart?.testRunId ?? options.testRunId;
6812
6825
  if (isRootSpan && !activeTraceStates.has(traceId)) {
@@ -6841,7 +6854,7 @@ var Bitfab = class {
6841
6854
  const sendSpan = async (params) => {
6842
6855
  const replayCtx = getReplayContext();
6843
6856
  try {
6844
- const endedAt = (/* @__PURE__ */ new Date()).toISOString();
6857
+ const endedAt = nowIsoTimestamp();
6845
6858
  const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
6846
6859
  if (!traceDropped) {
6847
6860
  self.sendWrapperSpan({