@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.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
@@ -13,7 +13,7 @@ import {
13
13
  getCurrentReplayBranch,
14
14
  getCurrentSpan,
15
15
  getCurrentTrace
16
- } from "./chunk-CKOOG3TW.js";
16
+ } from "./chunk-UE4GGPM6.js";
17
17
  import "./chunk-ZUD7OFYB.js";
18
18
  import {
19
19
  BITFAB_PROGRESS_PREFIX,
@@ -27,7 +27,7 @@ import {
27
27
  flushTraces,
28
28
  reportReplayProgress,
29
29
  serializeReplayResult
30
- } from "./chunk-VCGFTX2G.js";
30
+ } from "./chunk-BNOVHUQB.js";
31
31
  import "./chunk-H6LZRFMN.js";
32
32
  export {
33
33
  BITFAB_PROGRESS_PREFIX,
package/dist/node.cjs CHANGED
@@ -88,7 +88,7 @@ var __version__, __packageName__;
88
88
  var init_version_generated = __esm({
89
89
  "src/version.generated.ts"() {
90
90
  "use strict";
91
- __version__ = "0.38.8";
91
+ __version__ = "0.38.10";
92
92
  __packageName__ = "@bitfab/sdk";
93
93
  }
94
94
  });
@@ -3231,8 +3231,20 @@ function finalizeTracePayload(payload) {
3231
3231
  // src/claudeAgentSdk.ts
3232
3232
  init_randomUuid();
3233
3233
  init_serialize();
3234
+
3235
+ // src/timestamp.ts
3236
+ var lastTimestampMicros = 0;
3237
+ function nowIsoTimestamp() {
3238
+ const wallClockMicros = Date.now() * 1e3;
3239
+ lastTimestampMicros = Math.max(wallClockMicros, lastTimestampMicros + 1);
3240
+ const milliseconds = Math.floor(lastTimestampMicros / 1e3);
3241
+ const remainingMicros = lastTimestampMicros % 1e3;
3242
+ return new Date(milliseconds).toISOString().replace("Z", `${remainingMicros.toString().padStart(3, "0")}Z`);
3243
+ }
3244
+
3245
+ // src/claudeAgentSdk.ts
3234
3246
  function nowIso() {
3235
- return (/* @__PURE__ */ new Date()).toISOString();
3247
+ return nowIsoTimestamp();
3236
3248
  }
3237
3249
  var safeSerialize = toJsonSafe;
3238
3250
  function extractContentBlocks(content) {
@@ -4252,7 +4264,7 @@ var LANGGRAPH_METADATA_KEYS = [
4252
4264
  "langgraph_checkpoint_ns"
4253
4265
  ];
4254
4266
  function nowIso2() {
4255
- return (/* @__PURE__ */ new Date()).toISOString();
4267
+ return nowIsoTimestamp();
4256
4268
  }
4257
4269
  function normalizeChainStartArgs(parentRunIdOrRunType, runTypeOrRunName, runNameOrParentRunId) {
4258
4270
  if (parentRunIdOrRunType && CHAIN_RUN_TYPES.has(parentRunIdOrRunType)) {
@@ -5863,7 +5875,7 @@ function getCurrentTrace() {
5863
5875
  if (!traceState) {
5864
5876
  traceState = {
5865
5877
  traceId,
5866
- startedAt: (/* @__PURE__ */ new Date()).toISOString(),
5878
+ startedAt: nowIsoTimestamp(),
5867
5879
  contexts: []
5868
5880
  };
5869
5881
  activeTraceStates.set(traceId, traceState);
@@ -6164,6 +6176,7 @@ var Bitfab = class {
6164
6176
  return invokeWithoutNode();
6165
6177
  }
6166
6178
  spansUsed += 1;
6179
+ const mockOnReplay = nodeConfiguration?.mockOnReplay ?? options.mockOnReplayDefault;
6167
6180
  const childOptions = {
6168
6181
  name: nodeConfiguration?.name ?? definition.name,
6169
6182
  type: nodeConfiguration?.type ?? "function",
@@ -6174,8 +6187,8 @@ var Bitfab = class {
6174
6187
  ...nodeConfiguration?.testRunId !== void 0 && {
6175
6188
  testRunId: nodeConfiguration.testRunId
6176
6189
  },
6177
- ...nodeConfiguration?.mockOnReplay !== void 0 && {
6178
- mockOnReplay: nodeConfiguration.mockOnReplay
6190
+ ...mockOnReplay !== void 0 && {
6191
+ mockOnReplay
6179
6192
  },
6180
6193
  ...nodeConfiguration?.finalize !== void 0 && {
6181
6194
  finalize: nodeConfiguration.finalize
@@ -6797,7 +6810,7 @@ var Bitfab = class {
6797
6810
  const newContext = { traceId, spanId, contexts: [] };
6798
6811
  newStack = [...currentStack, newContext];
6799
6812
  const inputs = args;
6800
- const startedAt = (/* @__PURE__ */ new Date()).toISOString();
6813
+ const startedAt = nowIsoTimestamp();
6801
6814
  const replayCtxAtStart = getReplayContext();
6802
6815
  const testRunId = replayCtxAtStart?.testRunId ?? options.testRunId;
6803
6816
  if (isRootSpan && !activeTraceStates.has(traceId)) {
@@ -6832,7 +6845,7 @@ var Bitfab = class {
6832
6845
  const sendSpan = async (params) => {
6833
6846
  const replayCtx = getReplayContext();
6834
6847
  try {
6835
- const endedAt = (/* @__PURE__ */ new Date()).toISOString();
6848
+ const endedAt = nowIsoTimestamp();
6836
6849
  const traceDropped = activeTraceStates.get(traceId)?.dropped === true;
6837
6850
  if (!traceDropped) {
6838
6851
  self.sendWrapperSpan({