bitfab 0.64.30 → 0.65.1

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 (97) hide show
  1. package/dist/autoTrace.cjs +28 -0
  2. package/dist/autoTrace.cjs.map +1 -1
  3. package/dist/autoTrace.d.cts +2 -1
  4. package/dist/autoTrace.d.ts +2 -1
  5. package/dist/autoTrace.js +3 -1
  6. package/dist/{chunk-FY5WZ6M4.js → chunk-3FTI76L6.js} +2 -2
  7. package/dist/{chunk-OREQTFEI.js → chunk-4SBOBQGH.js} +4 -4
  8. package/dist/chunk-4SBOBQGH.js.map +1 -0
  9. package/dist/{chunk-GUPAIDK4.js → chunk-GS7FUQ6U.js} +2 -2
  10. package/dist/chunk-GS7FUQ6U.js.map +1 -0
  11. package/dist/{chunk-KDNS4BVZ.js → chunk-HW4ZKFYV.js} +65 -21
  12. package/dist/chunk-HW4ZKFYV.js.map +1 -0
  13. package/dist/{chunk-GSHCHCB5.js → chunk-LXBV37XY.js} +2 -39
  14. package/dist/chunk-LXBV37XY.js.map +1 -0
  15. package/dist/{chunk-IBWW3SP4.js → chunk-P7JUVRYZ.js} +2 -2
  16. package/dist/{chunk-YWXQM6J3.js → chunk-QRNHRY7F.js} +28 -1
  17. package/dist/chunk-QRNHRY7F.js.map +1 -0
  18. package/dist/{chunk-FXYVGFBP.js → chunk-U2GQPMOK.js} +2 -2
  19. package/dist/{chunk-JTFPBPMC.js → chunk-VG54N52W.js} +2 -2
  20. package/dist/chunk-VG54N52W.js.map +1 -0
  21. package/dist/{chunk-MN3E2RUU.js → chunk-VS36LW4L.js} +3 -3
  22. package/dist/{http-NUZD6TOB.js → http-FN74JEHE.js} +2 -2
  23. package/dist/{http-EWWU4KU2.js → http-G32WE67W.js} +2 -2
  24. package/dist/index.cjs +74 -15
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +76 -43
  27. package/dist/index.d.ts +76 -43
  28. package/dist/index.js +6 -4
  29. package/dist/node.cjs +74 -15
  30. package/dist/node.cjs.map +1 -1
  31. package/dist/node.d.cts +1 -1
  32. package/dist/node.d.ts +1 -1
  33. package/dist/node.js +6 -4
  34. package/dist/node.js.map +1 -1
  35. package/dist/{replay-MIZRT2LG.js → replay-FHHOJPX7.js} +3 -3
  36. package/dist/{replay-7Y5ERBDN.js → replay-SVHAY4S6.js} +3 -3
  37. package/dist/replayCli.js +3 -3
  38. package/dist/seedCli.js +3 -3
  39. package/dist/transform/babel.cjs +1 -38
  40. package/dist/transform/babel.cjs.map +1 -1
  41. package/dist/transform/babel.js +1 -1
  42. package/dist/transform/bun.cjs +1 -38
  43. package/dist/transform/bun.cjs.map +1 -1
  44. package/dist/transform/bun.js +3 -3
  45. package/dist/transform/esbuild.cjs +1 -38
  46. package/dist/transform/esbuild.cjs.map +1 -1
  47. package/dist/transform/esbuild.js +3 -3
  48. package/dist/transform/loaderRuntime.cjs +1 -38
  49. package/dist/transform/loaderRuntime.cjs.map +1 -1
  50. package/dist/transform/loaderRuntime.js +2 -2
  51. package/dist/transform/nest.cjs +1 -38
  52. package/dist/transform/nest.cjs.map +1 -1
  53. package/dist/transform/nest.js +3 -3
  54. package/dist/transform/next.cjs +1 -38
  55. package/dist/transform/next.cjs.map +1 -1
  56. package/dist/transform/next.js +3 -3
  57. package/dist/transform/nodeLoader.js +1 -38
  58. package/dist/transform/nodeLoader.js.map +1 -1
  59. package/dist/transform/rolldown.cjs +1 -38
  60. package/dist/transform/rolldown.cjs.map +1 -1
  61. package/dist/transform/rolldown.js +3 -3
  62. package/dist/transform/rollup.cjs +1 -38
  63. package/dist/transform/rollup.cjs.map +1 -1
  64. package/dist/transform/rollup.js +3 -3
  65. package/dist/transform/rsbuild.cjs +1 -38
  66. package/dist/transform/rsbuild.cjs.map +1 -1
  67. package/dist/transform/rsbuild.js +3 -3
  68. package/dist/transform/rspack.cjs +1 -38
  69. package/dist/transform/rspack.cjs.map +1 -1
  70. package/dist/transform/rspack.js +3 -3
  71. package/dist/transform/swc.cjs +1 -38
  72. package/dist/transform/swc.cjs.map +1 -1
  73. package/dist/transform/swc.js +2 -2
  74. package/dist/transform/unplugin.cjs +1 -38
  75. package/dist/transform/unplugin.cjs.map +1 -1
  76. package/dist/transform/unplugin.js +3 -3
  77. package/dist/transform/vite.cjs +1 -38
  78. package/dist/transform/vite.cjs.map +1 -1
  79. package/dist/transform/vite.js +3 -3
  80. package/dist/transform/webpack.cjs +1 -38
  81. package/dist/transform/webpack.cjs.map +1 -1
  82. package/dist/transform/webpack.js +3 -3
  83. package/package.json +1 -1
  84. package/dist/chunk-GSHCHCB5.js.map +0 -1
  85. package/dist/chunk-GUPAIDK4.js.map +0 -1
  86. package/dist/chunk-JTFPBPMC.js.map +0 -1
  87. package/dist/chunk-KDNS4BVZ.js.map +0 -1
  88. package/dist/chunk-OREQTFEI.js.map +0 -1
  89. package/dist/chunk-YWXQM6J3.js.map +0 -1
  90. /package/dist/{chunk-FY5WZ6M4.js.map → chunk-3FTI76L6.js.map} +0 -0
  91. /package/dist/{chunk-IBWW3SP4.js.map → chunk-P7JUVRYZ.js.map} +0 -0
  92. /package/dist/{chunk-FXYVGFBP.js.map → chunk-U2GQPMOK.js.map} +0 -0
  93. /package/dist/{chunk-MN3E2RUU.js.map → chunk-VS36LW4L.js.map} +0 -0
  94. /package/dist/{http-EWWU4KU2.js.map → http-FN74JEHE.js.map} +0 -0
  95. /package/dist/{http-NUZD6TOB.js.map → http-G32WE67W.js.map} +0 -0
  96. /package/dist/{replay-7Y5ERBDN.js.map → replay-FHHOJPX7.js.map} +0 -0
  97. /package/dist/{replay-MIZRT2LG.js.map → replay-SVHAY4S6.js.map} +0 -0
@@ -3,10 +3,11 @@ import {
3
3
  clearAutoTraceNodeConfiguration,
4
4
  currentAutoTraceEntries,
5
5
  invokeThroughAutoTraceEntries,
6
+ runAsAutoTraceRootFunction,
6
7
  runWithAutoTraceEntry,
7
8
  runWithAutoTraceNodeConfiguration,
8
9
  runWithAutoTraceRootContext
9
- } from "./chunk-YWXQM6J3.js";
10
+ } from "./chunk-QRNHRY7F.js";
10
11
  import {
11
12
  NO_MOCK_OVERRIDE,
12
13
  createIntegrationFixtureContext,
@@ -17,7 +18,7 @@ import {
17
18
  serializeValue,
18
19
  toJsonSafe,
19
20
  toJsonSafeReport
20
- } from "./chunk-FY5WZ6M4.js";
21
+ } from "./chunk-3FTI76L6.js";
21
22
  import {
22
23
  BitfabError,
23
24
  CONTENT_OFF_KEY,
@@ -37,7 +38,7 @@ import {
37
38
  readEnv,
38
39
  recordCallerTraceMetadata,
39
40
  retireTraceMetadata
40
- } from "./chunk-GUPAIDK4.js";
41
+ } from "./chunk-GS7FUQ6U.js";
41
42
  import {
42
43
  __privateAdd,
43
44
  __privateGet,
@@ -49,9 +50,9 @@ import {
49
50
  warnOnce
50
51
  } from "./chunk-MT36GJMW.js";
51
52
 
52
- // src/assertionCategories.ts
53
- var CATEGORIES_PATH = "/api/sdk/assertionCategories";
54
- var AssertionCategoriesClient = class {
53
+ // src/categories.ts
54
+ var CATEGORIES_PATH = "/api/sdk/categories";
55
+ var CategoriesClient = class {
55
56
  constructor(httpClient) {
56
57
  this.httpClient = httpClient;
57
58
  }
@@ -78,6 +79,7 @@ var AssertionCategoriesClient = class {
78
79
  return response.category;
79
80
  }
80
81
  };
82
+ var AssertionCategoriesClient = CategoriesClient;
81
83
 
82
84
  // src/processorPayload.ts
83
85
  var SERIALIZATION_DEGRADED_STEP = "serialization_degraded";
@@ -3444,6 +3446,27 @@ function draftsInGenerationOrder(assertions, assertionIds) {
3444
3446
  return assertion === void 0 ? [] : [assertion];
3445
3447
  });
3446
3448
  }
3449
+ function withCategoryId(assertion) {
3450
+ const categoryId = assertion.category_id ?? assertion.category_assertion_id ?? null;
3451
+ return {
3452
+ ...assertion,
3453
+ category_id: categoryId,
3454
+ category_assertion_id: categoryId
3455
+ };
3456
+ }
3457
+ function withCategoryIds(assertions) {
3458
+ return assertions.map(withCategoryId);
3459
+ }
3460
+ function toWireAssertion({
3461
+ category_assertion_id,
3462
+ ...assertion
3463
+ }) {
3464
+ const categoryId = assertion.category_id === void 0 ? category_assertion_id : assertion.category_id;
3465
+ if (categoryId === void 0) {
3466
+ return assertion;
3467
+ }
3468
+ return { ...assertion, category_id: categoryId };
3469
+ }
3447
3470
  function traceAssertionsPath(traceId, suffix = "") {
3448
3471
  return `/api/sdk/traces/${encodeURIComponent(traceId)}/assertions${suffix}`;
3449
3472
  }
@@ -3458,9 +3481,10 @@ var TracesClient = class {
3458
3481
  return this.httpClient.request(SEARCH_PATH, params);
3459
3482
  }
3460
3483
  async getAssertions(traceId) {
3461
- return this.httpClient.get(
3484
+ const result = await this.httpClient.get(
3462
3485
  traceAssertionsPath(traceId)
3463
3486
  );
3487
+ return { ...result, assertions: withCategoryIds(result.assertions) };
3464
3488
  }
3465
3489
  async saveAssertions(params) {
3466
3490
  return this.saveAssertionsAll({
@@ -3473,10 +3497,13 @@ var TracesClient = class {
3473
3497
  return [];
3474
3498
  }
3475
3499
  const response = await this.httpClient.request(ASSERTIONS_PATH, {
3476
- updates: params.updates,
3500
+ updates: params.updates.map((update) => ({
3501
+ ...update,
3502
+ assertions: update.assertions.map(toWireAssertion)
3503
+ })),
3477
3504
  source: params.source ?? "agent"
3478
3505
  });
3479
- return response.assertions;
3506
+ return withCategoryIds(response.assertions);
3480
3507
  }
3481
3508
  async generateAssertions(traceId, options = {}) {
3482
3509
  const started = await this.httpClient.request(
@@ -3488,7 +3515,7 @@ var TracesClient = class {
3488
3515
  }
3489
3516
  );
3490
3517
  if (isGenerationFinished(traceId, started.generation)) {
3491
- return started.assertions;
3518
+ return withCategoryIds(started.assertions);
3492
3519
  }
3493
3520
  const timeoutMs = options.timeoutMs ?? DEFAULT_GENERATION_TIMEOUT_MS;
3494
3521
  const deadline = Date.now() + timeoutMs;
@@ -4431,6 +4458,11 @@ function readBooleanEnv(name) {
4431
4458
  );
4432
4459
  return void 0;
4433
4460
  }
4461
+ var AUTO_TRACE_NODE_FUNCTION_NAMES = /* @__PURE__ */ new WeakMap();
4462
+ function registerAutoTraceNode(configured, functionName) {
4463
+ AUTO_TRACE_NODE_FUNCTION_NAMES.set(configured, functionName);
4464
+ return configured;
4465
+ }
4434
4466
  var DEFAULT_AUTO_TRACE_MAX_DEPTH = 30;
4435
4467
  var DEFAULT_AUTO_TRACE_MAX_CAPTURED_SUBTREE_SPANS = 500;
4436
4468
  function spanOwnerName(receiver) {
@@ -4506,7 +4538,8 @@ var Bitfab = class {
4506
4538
  this.simulationPlan.refresh();
4507
4539
  }
4508
4540
  this.datasets = new DatasetsClient(this.httpClient);
4509
- this.assertionCategories = new AssertionCategoriesClient(this.httpClient);
4541
+ this.categories = new CategoriesClient(this.httpClient);
4542
+ this.assertionCategories = this.categories;
4510
4543
  this.organizationMembers = new OrganizationMembersClient(this.httpClient);
4511
4544
  this.traces = new TracesClient(this.httpClient);
4512
4545
  this.spans = new SpansClient(this.httpClient);
@@ -4565,7 +4598,13 @@ var Bitfab = class {
4565
4598
  throw new BitfabError("bitfab.withTrace requires a function");
4566
4599
  }
4567
4600
  const name = fn.name !== "" ? fn.name : traceFunctionKey;
4568
- return this.createAutoTraceRoot(traceFunctionKey, name, options, fn);
4601
+ return this.createAutoTraceRoot(
4602
+ traceFunctionKey,
4603
+ name,
4604
+ options,
4605
+ fn,
4606
+ AUTO_TRACE_NODE_FUNCTION_NAMES.get(fn) ?? fn.name.replace(/^bound /, "")
4607
+ );
4569
4608
  }
4570
4609
  /**
4571
4610
  * Configure a transformed class method when it is discovered beneath a
@@ -4646,7 +4685,7 @@ var Bitfab = class {
4646
4685
  }
4647
4686
  createAutoTraceNode(configuration, fn, functionName) {
4648
4687
  const nodeConfiguration = { ...configuration, functionName };
4649
- return function(...args) {
4688
+ return registerAutoTraceNode(function(...args) {
4650
4689
  if (!__bitfabAutoTraceActive()) {
4651
4690
  if (enclosingSurface() === "opt-in") {
4652
4691
  throw mixedTracingError("node()", "opt-out", "opt-in");
@@ -4657,11 +4696,15 @@ var Bitfab = class {
4657
4696
  nodeConfiguration,
4658
4697
  () => fn.apply(this, args)
4659
4698
  );
4660
- };
4699
+ }, functionName);
4661
4700
  }
4662
- createAutoTraceRoot(traceFunctionKey, name, options, fn) {
4701
+ createAutoTraceRoot(traceFunctionKey, name, options, fn, rootFunctionName = "") {
4663
4702
  const self = this;
4664
4703
  self.simulationPlan.refresh();
4704
+ const runRootFunction = (receiver, args) => runAsAutoTraceRootFunction(
4705
+ rootFunctionName,
4706
+ () => fn.apply(receiver, args)
4707
+ );
4665
4708
  const maxDepth = autoTraceLimit(
4666
4709
  options.maxDepth,
4667
4710
  DEFAULT_AUTO_TRACE_MAX_DEPTH
@@ -4824,7 +4867,7 @@ var Bitfab = class {
4824
4867
  return runWithAutoTraceRootContext(
4825
4868
  autoTraceContext,
4826
4869
  getSpanStack(),
4827
- () => fn.apply(this, args)
4870
+ () => runRootFunction(this, args)
4828
4871
  );
4829
4872
  }
4830
4873
  );
@@ -4857,7 +4900,7 @@ var Bitfab = class {
4857
4900
  ),
4858
4901
  () => {
4859
4902
  if (link === void 0) {
4860
- return fn.apply(this, args);
4903
+ return runRootFunction(this, args);
4861
4904
  }
4862
4905
  const innermost = enclosing[enclosing.length - 1];
4863
4906
  const innermostNow = currentAutoTraceEntries().find(
@@ -6376,7 +6419,7 @@ var Bitfab = class {
6376
6419
  await runWithSeedContext({ traceId }, async () => target(...args));
6377
6420
  } finally {
6378
6421
  try {
6379
- const { flushTraces: flushTraces2 } = await import("./http-NUZD6TOB.js");
6422
+ const { flushTraces: flushTraces2 } = await import("./http-FN74JEHE.js");
6380
6423
  await flushTraces2(3e4);
6381
6424
  } finally {
6382
6425
  unrecorded = activeTraceStates.delete(traceId);
@@ -6435,7 +6478,7 @@ var Bitfab = class {
6435
6478
  `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.`
6436
6479
  );
6437
6480
  }
6438
- const { replay: doReplay } = await import("./replay-7Y5ERBDN.js");
6481
+ const { replay: doReplay } = await import("./replay-SVHAY4S6.js");
6439
6482
  return doReplay(
6440
6483
  this.httpClient,
6441
6484
  this.serviceUrl,
@@ -6781,7 +6824,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
6781
6824
  sessionId: seedCase.sessionId
6782
6825
  })
6783
6826
  );
6784
- const { flushTraces: flushTraces2 } = await import("./http-NUZD6TOB.js");
6827
+ const { flushTraces: flushTraces2 } = await import("./http-FN74JEHE.js");
6785
6828
  await flushTraces2(3e4);
6786
6829
  return { pipeline, traceFunctionKey, traceIds };
6787
6830
  }
@@ -6797,6 +6840,7 @@ function resolveTraceFunctionKey(registration) {
6797
6840
  }
6798
6841
 
6799
6842
  export {
6843
+ CategoriesClient,
6800
6844
  AssertionCategoriesClient,
6801
6845
  BitfabClaudeAgentHandler,
6802
6846
  GraderRerunError,
@@ -6827,4 +6871,4 @@ export {
6827
6871
  reseedFromRegistry,
6828
6872
  seedFromRegistry
6829
6873
  };
6830
- //# sourceMappingURL=chunk-KDNS4BVZ.js.map
6874
+ //# sourceMappingURL=chunk-HW4ZKFYV.js.map