@bitfab/sdk 0.40.0 → 0.42.0

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.
@@ -14,14 +14,14 @@ import {
14
14
  serializeValue,
15
15
  toJsonSafe,
16
16
  toJsonSafeReport
17
- } from "./chunk-EXT5FK54.js";
17
+ } from "./chunk-BG3A5HNC.js";
18
18
  import {
19
19
  BitfabError,
20
20
  DEFAULT_SERVICE_URL,
21
21
  HttpClient,
22
22
  getReplayContext,
23
23
  warnOnce
24
- } from "./chunk-A22EYRSY.js";
24
+ } from "./chunk-UGFTBSGS.js";
25
25
  import {
26
26
  __privateAdd,
27
27
  __privateGet,
@@ -321,8 +321,7 @@ var BitfabClaudeAgentHandler = class {
321
321
  const externalTrace = {
322
322
  id: traceId,
323
323
  started_at: this.traceStartedAt ?? nowIso(),
324
- ended_at: endedAt ?? nowIso(),
325
- workflow_name: this.traceFunctionKey
324
+ ended_at: endedAt ?? nowIso()
326
325
  };
327
326
  if (metadata) {
328
327
  externalTrace.metadata = metadata;
@@ -1475,8 +1474,7 @@ var BitfabLangGraphCallbackHandler = class {
1475
1474
  externalTrace: {
1476
1475
  id: rootSpan.traceId,
1477
1476
  started_at: rootSpan.startedAt,
1478
- ended_at: rootSpan.endedAt ?? nowIso2(),
1479
- workflow_name: this.traceFunctionKey
1477
+ ended_at: rootSpan.endedAt ?? nowIso2()
1480
1478
  },
1481
1479
  completed
1482
1480
  };
@@ -1494,8 +1492,7 @@ var BitfabLangGraphCallbackHandler = class {
1494
1492
  traceFunctionKey: this.traceFunctionKey,
1495
1493
  externalTrace: {
1496
1494
  id: rootSpan.traceId,
1497
- started_at: rootSpan.startedAt,
1498
- workflow_name: this.traceFunctionKey
1495
+ started_at: rootSpan.startedAt
1499
1496
  },
1500
1497
  completed: false
1501
1498
  };
@@ -2637,6 +2634,8 @@ var noOpSpan = {
2637
2634
  var noOpTrace = {
2638
2635
  setSessionId() {
2639
2636
  },
2637
+ setName() {
2638
+ },
2640
2639
  setMetadata() {
2641
2640
  },
2642
2641
  addContext() {
@@ -2711,6 +2710,15 @@ function getCurrentTrace() {
2711
2710
  } catch {
2712
2711
  }
2713
2712
  },
2713
+ setName(name) {
2714
+ if (typeof name !== "string" || name.length === 0) {
2715
+ return;
2716
+ }
2717
+ try {
2718
+ getOrCreateTraceState().name = name;
2719
+ } catch {
2720
+ }
2721
+ },
2714
2722
  setMetadata(metadata) {
2715
2723
  try {
2716
2724
  if (typeof metadata !== "object" || metadata === null) {
@@ -3645,6 +3653,9 @@ var Bitfab = class {
3645
3653
  ...replayCtxAtStart?.inputSourceTraceId && {
3646
3654
  inputSourceTraceId: replayCtxAtStart.inputSourceTraceId
3647
3655
  },
3656
+ ...replayCtxAtStart?.replayAttempt !== void 0 && {
3657
+ replayAttempt: replayCtxAtStart.replayAttempt
3658
+ },
3648
3659
  dbSnapshotRef
3649
3660
  });
3650
3661
  registeredTraceId = traceId;
@@ -3690,10 +3701,12 @@ var Bitfab = class {
3690
3701
  startedAt: traceState?.startedAt ?? startedAt,
3691
3702
  endedAt,
3692
3703
  sessionId: traceState?.sessionId,
3704
+ name: traceState?.name,
3693
3705
  metadata: traceState?.metadata,
3694
3706
  contexts: traceState?.contexts ?? [],
3695
3707
  testRunId: traceState?.testRunId,
3696
3708
  inputSourceTraceId: traceState?.inputSourceTraceId,
3709
+ replayAttempt: traceState?.replayAttempt,
3697
3710
  dbSnapshotRef: traceState?.dbSnapshotRef,
3698
3711
  dropped: traceState?.dropped,
3699
3712
  ingestionType: traceState?.ingestionType,
@@ -4008,6 +4021,15 @@ var Bitfab = class {
4008
4021
  return Promise.resolve();
4009
4022
  }
4010
4023
  return this.httpClient.patchTrace(traceId, { setSessionId: sessionId });
4024
+ },
4025
+ setName: (name) => {
4026
+ if (!this.isTracingEnabled()) {
4027
+ return Promise.resolve();
4028
+ }
4029
+ if (typeof name !== "string" || name.length === 0) {
4030
+ return Promise.resolve();
4031
+ }
4032
+ return this.httpClient.patchTrace(traceId, { setName: name });
4011
4033
  }
4012
4034
  };
4013
4035
  }
@@ -4068,9 +4090,11 @@ var Bitfab = class {
4068
4090
  const rawTrace = {
4069
4091
  id: params.traceId,
4070
4092
  started_at: params.startedAt,
4071
- ended_at: params.endedAt,
4072
- workflow_name: params.traceFunctionKey
4093
+ ended_at: params.endedAt
4073
4094
  };
4095
+ if (params.name) {
4096
+ rawTrace.name = params.name;
4097
+ }
4074
4098
  if (params.metadata && Object.keys(params.metadata).length > 0) {
4075
4099
  rawTrace.metadata = params.metadata;
4076
4100
  }
@@ -4080,6 +4104,9 @@ var Bitfab = class {
4080
4104
  if (params.inputSourceTraceId) {
4081
4105
  rawTrace.input_source_trace_id = params.inputSourceTraceId;
4082
4106
  }
4107
+ if (params.replayAttempt !== void 0) {
4108
+ rawTrace.replay_attempt = params.replayAttempt;
4109
+ }
4083
4110
  if (params.dbSnapshotRef) {
4084
4111
  rawTrace.db_snapshot_ref = params.dbSnapshotRef;
4085
4112
  }
@@ -4263,6 +4290,7 @@ var Bitfab = class {
4263
4290
  contexts: [],
4264
4291
  ingestionType: "seeded",
4265
4292
  ...options.sessionId !== void 0 && { sessionId: options.sessionId },
4293
+ ...options.name !== void 0 && { name: options.name },
4266
4294
  ...options.metadata !== void 0 && { metadata: options.metadata }
4267
4295
  });
4268
4296
  try {
@@ -4285,6 +4313,7 @@ var Bitfab = class {
4285
4313
  startedAt,
4286
4314
  endedAt: startedAt,
4287
4315
  sessionId: options.sessionId,
4316
+ name: options.name,
4288
4317
  metadata: options.metadata,
4289
4318
  contexts: [],
4290
4319
  ingestionType: "seeded"
@@ -4308,7 +4337,7 @@ var Bitfab = class {
4308
4337
  `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.`
4309
4338
  );
4310
4339
  }
4311
- const { replay: doReplay } = await import("./replay-352POXG3.js");
4340
+ const { replay: doReplay } = await import("./replay-PLACY77M.js");
4312
4341
  return doReplay(
4313
4342
  this.httpClient,
4314
4343
  this.serviceUrl,
@@ -4561,7 +4590,7 @@ async function seedFromRegistry(registry, pipeline, cases) {
4561
4590
  sessionId: seedCase.sessionId
4562
4591
  })
4563
4592
  );
4564
- const { flushTraces: flushTraces2 } = await import("./http-2OFIGQOK.js");
4593
+ const { flushTraces: flushTraces2 } = await import("./http-F5L466DI.js");
4565
4594
  await flushTraces2(3e4);
4566
4595
  return { pipeline, traceFunctionKey, traceIds };
4567
4596
  }
@@ -4594,4 +4623,4 @@ export {
4594
4623
  defineReplayRegistry,
4595
4624
  seedFromRegistry
4596
4625
  };
4597
- //# sourceMappingURL=chunk-5NT4YDCQ.js.map
4626
+ //# sourceMappingURL=chunk-BC5OYWAM.js.map