@bitfab/sdk 0.72.0 → 0.72.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.
@@ -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-7rcRBbK-.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-BmX6_1w0.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";
@@ -5615,6 +5615,16 @@ function extractPromptFromCollector(collector) {
5615
5615
  return null;
5616
5616
  }
5617
5617
  }
5618
+ function reportedCostOf(call) {
5619
+ try {
5620
+ const response = call?.httpResponse?.body?.json();
5621
+ const usage = isPlainObject(response) ? response.usage : void 0;
5622
+ const cost = isPlainObject(usage) ? usage.cost : void 0;
5623
+ return typeof cost === "number" && Number.isFinite(cost) ? cost : null;
5624
+ } catch {
5625
+ return null;
5626
+ }
5627
+ }
5618
5628
  function extractContextFromCollector(collector) {
5619
5629
  try {
5620
5630
  const c = collector;
@@ -5636,6 +5646,10 @@ function extractContextFromCollector(collector) {
5636
5646
  const outputTokens = usage?.outputTokens ?? selectedCall?.usage?.outputTokens ?? null;
5637
5647
  if (inputTokens !== null) context.inputTokens = inputTokens;
5638
5648
  if (outputTokens !== null) context.outputTokens = outputTokens;
5649
+ const cachedInputTokens = usage?.cachedInputTokens ?? selectedCall?.usage?.cachedInputTokens ?? null;
5650
+ if (cachedInputTokens !== null) context.cachedInputTokens = cachedInputTokens;
5651
+ const costUsd = reportedCostOf(selectedCall);
5652
+ if (costUsd !== null) context.costUsd = costUsd;
5639
5653
  const durationMs = c?.last?.timing?.durationMs ?? null;
5640
5654
  if (durationMs !== null) context.durationMs = durationMs;
5641
5655
  return Object.keys(context).length > 0 ? context : null;
@@ -7059,7 +7073,7 @@ var Bitfab = class {
7059
7073
  await runWithSeedContext({ traceId }, async () => target(...args));
7060
7074
  } finally {
7061
7075
  try {
7062
- const { flushTraces } = await import("./http-7rcRBbK-.js").then((n) => n.a);
7076
+ const { flushTraces } = await import("./http-BmX6_1w0.js").then((n) => n.a);
7063
7077
  await flushTraces(3e4);
7064
7078
  } finally {
7065
7079
  unrecorded = activeTraceStates.delete(traceId);
@@ -7265,7 +7279,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
7265
7279
  metadata: seedCase.metadata,
7266
7280
  sessionId: seedCase.sessionId
7267
7281
  }));
7268
- const { flushTraces } = await import("./http-7rcRBbK-.js").then((n) => n.a);
7282
+ const { flushTraces } = await import("./http-BmX6_1w0.js").then((n) => n.a);
7269
7283
  await flushTraces(3e4);
7270
7284
  return {
7271
7285
  pipeline,
@@ -7282,4 +7296,4 @@ function resolveTraceFunctionKey(registration) {
7282
7296
  //#endregion
7283
7297
  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 };
7284
7298
 
7285
- //# sourceMappingURL=src-B9m0zAy1.js.map
7299
+ //# sourceMappingURL=src-BszICqKf.js.map