@bitfab/sdk 0.58.2 → 0.58.4

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.
Files changed (32) hide show
  1. package/dist/{chunk-JMMFN4RO.js → chunk-3LJVTDD5.js} +6 -3
  2. package/dist/{chunk-JMMFN4RO.js.map → chunk-3LJVTDD5.js.map} +1 -1
  3. package/dist/{chunk-FRAFDYLK.js → chunk-74ECLOFY.js} +3 -3
  4. package/dist/chunk-74ECLOFY.js.map +1 -0
  5. package/dist/{chunk-QK6CVPVR.js → chunk-BVUGW7BJ.js} +4 -3
  6. package/dist/chunk-BVUGW7BJ.js.map +1 -0
  7. package/dist/{chunk-LS4AHYFJ.js → chunk-UKJ3RWVS.js} +38 -13
  8. package/dist/chunk-UKJ3RWVS.js.map +1 -0
  9. package/dist/{chunk-PR3I5UTO.js → chunk-ZLAFCSCP.js} +6 -3
  10. package/dist/{chunk-PR3I5UTO.js.map → chunk-ZLAFCSCP.js.map} +1 -1
  11. package/dist/{http-W3ZKRIWW.js → http-NG5NP6PH.js} +2 -2
  12. package/dist/{http-IEFEMFSD.js → http-XTSUPZEC.js} +2 -2
  13. package/dist/index.cjs +39 -10
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +14 -5
  16. package/dist/index.d.ts +14 -5
  17. package/dist/index.js +3 -3
  18. package/dist/node.cjs +39 -10
  19. package/dist/node.cjs.map +1 -1
  20. package/dist/node.d.cts +1 -1
  21. package/dist/node.d.ts +1 -1
  22. package/dist/node.js +3 -3
  23. package/dist/{replay-NFSPHMXY.js → replay-JHFO457Z.js} +3 -3
  24. package/dist/replayCli.js +2 -2
  25. package/dist/seedCli.js +2 -2
  26. package/package.json +1 -1
  27. package/dist/chunk-FRAFDYLK.js.map +0 -1
  28. package/dist/chunk-LS4AHYFJ.js.map +0 -1
  29. package/dist/chunk-QK6CVPVR.js.map +0 -1
  30. /package/dist/{http-IEFEMFSD.js.map → http-NG5NP6PH.js.map} +0 -0
  31. /package/dist/{http-W3ZKRIWW.js.map → http-XTSUPZEC.js.map} +0 -0
  32. /package/dist/{replay-NFSPHMXY.js.map → replay-JHFO457Z.js.map} +0 -0
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-JMMFN4RO.js";
9
+ } from "./chunk-3LJVTDD5.js";
10
10
  export {
11
11
  BitfabError,
12
12
  HttpClient,
@@ -16,4 +16,4 @@ export {
16
16
  parseRetryAfterMs,
17
17
  serializePayloadBody
18
18
  };
19
- //# sourceMappingURL=http-W3ZKRIWW.js.map
19
+ //# sourceMappingURL=http-NG5NP6PH.js.map
@@ -6,7 +6,7 @@ import {
6
6
  flushTraces,
7
7
  parseRetryAfterMs,
8
8
  serializePayloadBody
9
- } from "./chunk-PR3I5UTO.js";
9
+ } from "./chunk-ZLAFCSCP.js";
10
10
  import "./chunk-VCRFFCLY.js";
11
11
  export {
12
12
  BitfabError,
@@ -17,4 +17,4 @@ export {
17
17
  parseRetryAfterMs,
18
18
  serializePayloadBody
19
19
  };
20
- //# sourceMappingURL=http-IEFEMFSD.js.map
20
+ //# sourceMappingURL=http-XTSUPZEC.js.map
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.58.2";
45
+ __version__ = "0.58.4";
46
46
  __packageName__ = "@bitfab/sdk";
47
47
  }
48
48
  });
@@ -2878,7 +2878,7 @@ var init_http = __esm({
2878
2878
  * Start a replay session by fetching historical traces.
2879
2879
  * Blocking call - creates a test run and returns lightweight item references.
2880
2880
  */
2881
- async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetIds, graderIds, dbBranchSettings, attempts, includeOriginalMetadata, onlyWithAssertions) {
2881
+ async startReplay(traceFunctionKey, limit, traceIds, name, codeChangeDescription, codeChangeFiles, includeDbBranchLease, experimentGroupId, datasetIds, graderIds, dbBranchSettings, attempts, includeOriginalMetadata, onlyWithAssertions, judgeAssertions) {
2882
2882
  const payload = { traceFunctionKey };
2883
2883
  if (limit !== void 0) {
2884
2884
  payload.limit = limit;
@@ -2924,6 +2924,9 @@ var init_http = __esm({
2924
2924
  if (onlyWithAssertions) {
2925
2925
  payload.onlyWithAssertions = true;
2926
2926
  }
2927
+ if (judgeAssertions) {
2928
+ payload.judgeAssertions = true;
2929
+ }
2927
2930
  const git = await resolvedGitState();
2928
2931
  if (git && !isEmptyGitState(git)) {
2929
2932
  payload.git = git;
@@ -4081,7 +4084,8 @@ async function replay(httpClient, serviceUrl, traceFunctionKey, fn, options, reg
4081
4084
  resolveDbBranchSettings(options?.dbBranch),
4082
4085
  attempts,
4083
4086
  options?.adaptInputs !== void 0,
4084
- options?.onlyWithAssertions
4087
+ options?.onlyWithAssertions,
4088
+ options?.judgeAssertions
4085
4089
  );
4086
4090
  if (serverItems.length === 0) {
4087
4091
  try {
@@ -9805,13 +9809,23 @@ var Bitfab = class {
9805
9809
  traceFunctionKey
9806
9810
  );
9807
9811
  const openAiAgentsSpanIds = openAiAgentsSpanChain();
9812
+ const functionNameAtOpen = fn.name !== "" ? fn.name : void 0;
9808
9813
  const newContext = {
9809
9814
  traceId,
9810
9815
  spanId,
9811
9816
  contexts: [],
9817
+ spanName: options.name ?? options.nameFor?.(this) ?? qualifiedSpanName(this, functionNameAtOpen) ?? traceFunctionKey,
9818
+ rootTraceFunctionKey: rootTraceFunctionKeyOfTrace(
9819
+ traceId,
9820
+ traceFunctionKey
9821
+ ),
9822
+ instrumentation: options.instrumentation ?? "span",
9823
+ declaredNode: options.declaredNode === true,
9824
+ isRoot: isRootSpan,
9812
9825
  ...surface !== void 0 && { surface },
9813
9826
  ...openAiAgentsSpanIds.length > 0 && { openAiAgentsSpanIds }
9814
9827
  };
9828
+ const nearestCapturedAncestorSpanId = self.nearestCapturedAncestorSpanIdOf(currentStack);
9815
9829
  newStack = [...currentStack, newContext];
9816
9830
  const inputs = args;
9817
9831
  const startedAt = nowIsoTimestamp();
@@ -9838,19 +9852,16 @@ var Bitfab = class {
9838
9852
  }
9839
9853
  self.httpClient.traceCompletion.start(traceId, spanId);
9840
9854
  startedSpan = { traceId, spanId };
9841
- const functionName = fn.name !== "" ? fn.name : void 0;
9842
- const rootTraceFunctionKey = rootTraceFunctionKeyOfTrace(
9843
- traceId,
9844
- traceFunctionKey
9845
- );
9855
+ const functionName = functionNameAtOpen;
9846
9856
  const baseSpanParams = {
9847
9857
  traceFunctionKey,
9848
- rootTraceFunctionKey,
9858
+ rootTraceFunctionKey: newContext.rootTraceFunctionKey,
9849
9859
  functionName,
9850
- spanName: options.name ?? options.nameFor?.(this) ?? qualifiedSpanName(this, functionName) ?? traceFunctionKey,
9860
+ spanName: newContext.spanName,
9851
9861
  traceId,
9852
9862
  spanId,
9853
9863
  parentSpanId,
9864
+ nearestCapturedAncestorSpanId,
9854
9865
  inputs,
9855
9866
  startedAt,
9856
9867
  spanType: options.type ?? "custom",
@@ -10369,6 +10380,21 @@ var Bitfab = class {
10369
10380
  ...params.testRunId && { testRunId: params.testRunId }
10370
10381
  });
10371
10382
  }
10383
+ sendsSpanOnCompletion(context) {
10384
+ return context.isRoot || context.declaredNode || isFrameworkInstrumentation(context.instrumentation) || !this.simulationPlan.contentOffNow(
10385
+ context.rootTraceFunctionKey,
10386
+ context.spanName
10387
+ );
10388
+ }
10389
+ nearestCapturedAncestorSpanIdOf(stack) {
10390
+ for (let index = stack.length - 1; index >= 0; index -= 1) {
10391
+ const candidate = stack[index];
10392
+ if (candidate !== void 0 && this.sendsSpanOnCompletion(candidate)) {
10393
+ return candidate.spanId;
10394
+ }
10395
+ }
10396
+ return null;
10397
+ }
10372
10398
  contentOffBySimulationPlan(params) {
10373
10399
  if (params.rootTraceFunctionKey === void 0 || isFrameworkInstrumentation(params.instrumentation)) {
10374
10400
  return false;
@@ -10445,6 +10471,9 @@ var Bitfab = class {
10445
10471
  if (params.parentSpanId) {
10446
10472
  externalSpan.parent_id = params.parentSpanId;
10447
10473
  }
10474
+ if (params.nearestCapturedAncestorSpanId !== void 0 && params.nearestCapturedAncestorSpanId !== null && params.nearestCapturedAncestorSpanId !== params.parentSpanId) {
10475
+ externalSpan.nearest_captured_ancestor_id = params.nearestCapturedAncestorSpanId;
10476
+ }
10448
10477
  if (params.inputSourceSpanId) {
10449
10478
  externalSpan.input_source_span_id = params.inputSourceSpanId;
10450
10479
  }