@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
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { C as BitfabError, E as __version__, S as gitRunner, T as readEnv$1, _ as MAX_SPAN_CARRIER_BYTES, b as replayContextReady, c as recordCallerTraceMetadata, f as ROOT_TRACE_FUNCTION_KEY_FIELD, g as MAX_COMPRESSIBLE_SPAN_CARRIER_BYTES, h as makeSpanOrigin, i as flushTraces, l as retireTraceMetadata, m as isFrameworkInstrumentation, n as SPAN_TYPES, o as unrefTimer, p as SimulationPlan, r as experimentIdWireFields, s as callerTraceMetadata, t as HttpClient, v as byteLength, w as MixedTracingError, x as runWithReplayContext, y as getReplayContext } from "./http-BM1TSXDd.js";
2
+ import { C as BitfabError, E as __version__, S as gitRunner, T as readEnv$1, _ as MAX_SPAN_CARRIER_BYTES, b as replayContextReady, c as recordCallerTraceMetadata, f as ROOT_TRACE_FUNCTION_KEY_FIELD, g as MAX_COMPRESSIBLE_SPAN_CARRIER_BYTES, h as makeSpanOrigin, i as flushTraces, l as retireTraceMetadata, m as isFrameworkInstrumentation, n as SPAN_TYPES, o as unrefTimer, p as SimulationPlan, r as experimentIdWireFields, s as callerTraceMetadata, t as HttpClient, v as byteLength, w as MixedTracingError, x as runWithReplayContext, y as getReplayContext } from "./http-C_t7m9b_.js";
3
3
  import { A as unmapOpenAiAgentsTrace, B as asyncStorageReady, C as recordAutoTracedClientCall, D as mapOpenAiAgentsTrace, E as endOpenAiAgentsSpan, F as warnOnce, H as isAsyncStorageInitDone, I as writeOnce, L as isCaptureSuppressed, M as installLangChainRunScopes, N as markLangChainRunRecorded, O as openAiAgentsParentSpanId, R as runWithCaptureSuppressed, S as frameworkRecordsClientCall, T as watchClientCall, V as createAsyncLocalStorage, _ as runWithAutoTraceRootContext, b as OPENROUTER, f as invokeThroughAutoTraceEntries, g as runWithAutoTraceNodeConfiguration, h as runWithAutoTraceFramesAt, j as forgetLangChainRun, k as openAiAgentsSpanChain, l as clearAutoTraceNodeConfiguration, m as runWithAutoTraceEntry, o as __bitfabAutoTraceActive, p as runAsAutoTraceRootFunction, u as currentAutoTraceEntries, v as ANTHROPIC, w as recordWatchedClientCall, x as clientCallProvider, y as OPENAI_RESPONSES } from "./autoTrace-kHOBg49M.js";
4
4
  import { t as importOptionalPeer } from "./optionalPeer-CczrzrXx.js";
5
5
  import { t as loadBamlModule } from "./bamlPeer-Dyeb3e5o.js";
@@ -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 import("./http-BM1TSXDd.js").then((n) => n.a);
7087
+ const { flushTraces } = await import("./http-C_t7m9b_.js").then((n) => n.a);
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 import("./http-BM1TSXDd.js").then((n) => n.a);
7293
+ const { flushTraces } = await import("./http-C_t7m9b_.js").then((n) => n.a);
7289
7294
  await flushTraces(3e4);
7290
7295
  return {
7291
7296
  pipeline,
@@ -7302,4 +7307,4 @@ function resolveTraceFunctionKey(registration) {
7302
7307
  //#endregion
7303
7308
  export { VerdictsClient as A, OrganizationMembersClient as C, BitfabLangGraphCallbackHandler as D, BitfabLangGraphIntegration as E, GraderRerunTimeoutError as F, BitfabClaudeAgentHandler as I, DEFAULT_SERVICE_URL as L, SUPPORTED_PROVIDERS as M, DatasetsClient as N, GradersClient as O, GraderRerunError as P, AssertionCategoriesClient as R, BitfabPiIntegration as S, NO_MOCK_OVERRIDE as T, BITFAB_PROGRESS_PREFIX as _, Bitfab as a, reportReplayProgress as b, getCurrentSpan as c, BitfabOpenAITracingProcessor as d, AssertionGenerationError as f, BitfabRivetIntegration as g, SpansClient as h, finalizers as i, ExperimentsClient as j, LabelsClient as k, getCurrentTrace as l, TracesClient as m, reseedFromRegistry as n, BitfabFunction as o, AssertionGenerationTimeoutError as p, seedFromRegistry as r, getCurrentReplayBranch as s, defineReplayRegistry as t, BitfabVercelAiHandler as u, DbBranchReplayError as v, BitfabOpenAIAgentHandler as w, serializeReplayResult as x, ReplayError as y, CategoriesClient as z };
7304
7309
 
7305
- //# sourceMappingURL=src-Dp8OX46R.js.map
7310
+ //# sourceMappingURL=src-Ch86hs9i.js.map