@bitfab/sdk 0.68.9 → 0.68.10

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 MixedTracingError, S as BitfabError, T as __version__, _ as MAX_SPAN_CARRIER_BYTES, b as runWithReplayContext, 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 getReplayContext, w as readEnv$1, x as gitRunner, y as replayContextReady } from "./http-CfayedL7.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-DMaoegDE.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";
@@ -2615,7 +2615,7 @@ function leadingSystemMessages(messages) {
2615
2615
  }
2616
2616
  function serializedBytes(value) {
2617
2617
  try {
2618
- return JSON.stringify(value)?.length;
2618
+ return byteLength(JSON.stringify(value) ?? "");
2619
2619
  } catch {
2620
2620
  return;
2621
2621
  }
@@ -2835,7 +2835,11 @@ var BitfabPiIntegration = class {
2835
2835
  }
2836
2836
  restoreIntoSession(session, messages) {
2837
2837
  const store = session.sessionManager;
2838
- if (store?.isPersisted?.() !== false || typeof store.appendMessage !== "function") {
2838
+ if (typeof store?.isPersisted !== "function" || typeof store.appendMessage !== "function") {
2839
+ warnOnce(`pi-replay-session-unknown-store:${this.traceFunctionKey}`, `A replayed "${this.traceFunctionKey}" run used an AgentSession whose session manager has no isPersisted() or appendMessage() method, so Bitfab could not tell whether it is saved to disk and did not restore the recorded conversation into it. Build the session in your replay function with SessionManager.inMemory() to replay each turn with its history.`);
2840
+ return;
2841
+ }
2842
+ if (store.isPersisted()) {
2839
2843
  warnOnce(`pi-replay-session-persisted:${this.traceFunctionKey}`, `A replayed "${this.traceFunctionKey}" run used an AgentSession saved to disk, so Bitfab did not restore the recorded conversation into it. Build the session in your replay function with SessionManager.inMemory() to replay each turn with its history.`);
2840
2844
  return;
2841
2845
  }
@@ -2905,15 +2909,17 @@ var BitfabPiIntegration = class {
2905
2909
  const replaysContinue = this.restoredTranscript(run)?.method === "continue" && callsWithoutArguments(callArgs);
2906
2910
  const calledMethod = replaysContinue ? "continue" : method;
2907
2911
  if (getReplayContext() === null) this.recordTranscript(method, run.state());
2908
- await Reflect.get(target, calledMethod, target).apply(receiver, replaysContinue ? [] : callArgs);
2912
+ const original = Reflect.get(target, calledMethod, target);
2913
+ const start = run.state().messages.length;
2914
+ await original.apply(receiver, replaysContinue ? [] : callArgs);
2909
2915
  throwKeptReplayFailure();
2916
+ return start;
2910
2917
  };
2911
- if (this.host.activeRootTraceFunctionKey() === this.traceFunctionKey) return call(...args);
2918
+ if (this.host.activeRootTraceFunctionKey() === this.traceFunctionKey) return call(...args).then(() => void 0);
2912
2919
  const callReturningFinalMessage = async (...callArgs) => {
2913
2920
  const sessionId = run.sessionId();
2914
2921
  if (typeof sessionId === "string" && sessionId.length > 0) this.host.setTraceSessionId(sessionId);
2915
- const start = run.state().messages.length;
2916
- await call(...callArgs);
2922
+ const start = await call(...callArgs);
2917
2923
  return lastAssistantMessageSince(run.state(), start);
2918
2924
  };
2919
2925
  return this.host.withSpan(this.traceFunctionKey, {
@@ -7003,7 +7009,7 @@ var Bitfab = class {
7003
7009
  await runWithSeedContext({ traceId }, async () => target(...args));
7004
7010
  } finally {
7005
7011
  try {
7006
- const { flushTraces } = await import("./http-CfayedL7.js").then((n) => n.a);
7012
+ const { flushTraces } = await import("./http-DMaoegDE.js").then((n) => n.a);
7007
7013
  await flushTraces(3e4);
7008
7014
  } finally {
7009
7015
  unrecorded = activeTraceStates.delete(traceId);
@@ -7209,7 +7215,7 @@ async function seedFromRegistry(registry, pipeline, cases, options = {}) {
7209
7215
  metadata: seedCase.metadata,
7210
7216
  sessionId: seedCase.sessionId
7211
7217
  }));
7212
- const { flushTraces } = await import("./http-CfayedL7.js").then((n) => n.a);
7218
+ const { flushTraces } = await import("./http-DMaoegDE.js").then((n) => n.a);
7213
7219
  await flushTraces(3e4);
7214
7220
  return {
7215
7221
  pipeline,
@@ -7226,4 +7232,4 @@ function resolveTraceFunctionKey(registration) {
7226
7232
  //#endregion
7227
7233
  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 };
7228
7234
 
7229
- //# sourceMappingURL=src-DMBEhG3p.js.map
7235
+ //# sourceMappingURL=src-LNY2pQZm.js.map