@bitfab/sdk 0.74.4 → 0.74.5

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.
@@ -1,5 +1,5 @@
1
1
  const require_bamlPeer = require("./bamlPeer-5Ohpq8q9.cjs");
2
- const require_http = require("./http-VtGRzeNI.cjs");
2
+ const require_http = require("./http-DNmzk2gf.cjs");
3
3
  const require_autoTrace = require("./autoTrace-DPWV1Xzr.cjs");
4
4
  const require_optionalPeer = require("./optionalPeer-CUH756lt.cjs");
5
5
  let superjson = require("superjson");
@@ -4958,6 +4958,7 @@ var SpansClient = class {
4958
4958
  //#region src/traces.ts
4959
4959
  const ASSERTIONS_PATH = "/api/sdk/traces/assertions";
4960
4960
  const SEARCH_PATH = "/api/sdk/traces/search";
4961
+ const CODE_DRAFT_SAVE_TIMEOUT_MS = 3e5;
4961
4962
  const DEFAULT_GENERATION_TIMEOUT_MS = 6e5;
4962
4963
  const GENERATION_POLL_INTERVAL_MS = 2e3;
4963
4964
  var AssertionGenerationError = class extends Error {
@@ -5007,6 +5008,9 @@ function toWireAssertion({ category_assertion_id, ...assertion }) {
5007
5008
  category_id: categoryId
5008
5009
  };
5009
5010
  }
5011
+ function asksBitfabToWriteCode(assertion) {
5012
+ return (assertion.kind === "code" || assertion.kind === "hybrid") && assertion.code === void 0;
5013
+ }
5010
5014
  function traceAssertionsPath(traceId, suffix = "") {
5011
5015
  return `/api/sdk/traces/${encodeURIComponent(traceId)}/assertions${suffix}`;
5012
5016
  }
@@ -5039,14 +5043,15 @@ var TracesClient = class {
5039
5043
  }
5040
5044
  async saveAssertionsAll(params) {
5041
5045
  if (params.updates.length === 0) return [];
5042
- return withCategoryIds((await this.httpClient.request(ASSERTIONS_PATH, {
5046
+ const body = {
5043
5047
  updates: params.updates.map((update) => ({
5044
5048
  ...update,
5045
5049
  assertions: update.assertions.map(toWireAssertion)
5046
5050
  })),
5047
5051
  source: params.source ?? "agent",
5048
5052
  guidedRewrite: params.skipGuidedRewrite !== true
5049
- })).assertions);
5053
+ };
5054
+ return withCategoryIds((params.updates.some((update) => update.assertions.some(asksBitfabToWriteCode)) ? await this.httpClient.request(ASSERTIONS_PATH, body, { timeout: CODE_DRAFT_SAVE_TIMEOUT_MS }) : await this.httpClient.request(ASSERTIONS_PATH, body)).assertions);
5050
5055
  }
5051
5056
  async generateAssertions(traceId, options = {}) {
5052
5057
  const started = await this.httpClient.request(traceAssertionsPath(traceId, "/generate"), {
@@ -7079,7 +7084,7 @@ var Bitfab = class {
7079
7084
  await runWithSeedContext({ traceId }, async () => target(...args));
7080
7085
  } finally {
7081
7086
  try {
7082
- const { flushTraces } = await Promise.resolve().then(() => require("./http-VtGRzeNI.cjs")).then((n) => n.http_exports);
7087
+ const { flushTraces } = await Promise.resolve().then(() => require("./http-DNmzk2gf.cjs")).then((n) => n.http_exports);
7083
7088
  await flushTraces(3e4);
7084
7089
  } finally {
7085
7090
  unrecorded = activeTraceStates.delete(traceId);
@@ -7285,7 +7290,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
7285
7290
  metadata: seedCase.metadata,
7286
7291
  sessionId: seedCase.sessionId
7287
7292
  }));
7288
- const { flushTraces } = await Promise.resolve().then(() => require("./http-VtGRzeNI.cjs")).then((n) => n.http_exports);
7293
+ const { flushTraces } = await Promise.resolve().then(() => require("./http-DNmzk2gf.cjs")).then((n) => n.http_exports);
7289
7294
  await flushTraces(3e4);
7290
7295
  return {
7291
7296
  pipeline,
@@ -7535,4 +7540,4 @@ Object.defineProperty(exports, "serializeReplayResult", {
7535
7540
  }
7536
7541
  });
7537
7542
 
7538
- //# sourceMappingURL=src-Cr4ZJLeB.cjs.map
7543
+ //# sourceMappingURL=src-B7Xv4aR2.cjs.map