agentv 2.18.4 → 2.19.0

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.
@@ -11,7 +11,7 @@ import {
11
11
  validateEvalFile,
12
12
  validateFileReferences,
13
13
  validateTargetsFile
14
- } from "./chunk-KSUL3F3R.js";
14
+ } from "./chunk-4MSAOMCC.js";
15
15
  import {
16
16
  assembleLlmJudgePrompt,
17
17
  buildPromptInputs,
@@ -27,7 +27,7 @@ import {
27
27
  toCamelCaseDeep,
28
28
  toSnakeCaseDeep as toSnakeCaseDeep2,
29
29
  trimBaselineResult
30
- } from "./chunk-YTHTGLMT.js";
30
+ } from "./chunk-XTYMR4I5.js";
31
31
  import {
32
32
  __commonJS,
33
33
  __esm,
@@ -4072,7 +4072,7 @@ var evalRunCommand = command({
4072
4072
  },
4073
4073
  handler: async (args) => {
4074
4074
  if (args.evalPaths.length === 0 && process.stdin.isTTY) {
4075
- const { launchInteractiveWizard } = await import("./interactive-J4IBXJF7.js");
4075
+ const { launchInteractiveWizard } = await import("./interactive-3TDBCSDW.js");
4076
4076
  await launchInteractiveWizard();
4077
4077
  return;
4078
4078
  }
@@ -5951,4 +5951,4 @@ export {
5951
5951
  preprocessArgv,
5952
5952
  runCli
5953
5953
  };
5954
- //# sourceMappingURL=chunk-RMUVJ44Z.js.map
5954
+ //# sourceMappingURL=chunk-GC6T3RD4.js.map
@@ -148,7 +148,7 @@ var require_dist = __commonJS({
148
148
  }
149
149
  });
150
150
 
151
- // ../../packages/core/dist/chunk-V42NUK73.js
151
+ // ../../packages/core/dist/chunk-ACTIPQZ3.js
152
152
  import { constants } from "node:fs";
153
153
  import { access, readFile } from "node:fs/promises";
154
154
  import path from "node:path";
@@ -4195,7 +4195,7 @@ var coerce = {
4195
4195
  };
4196
4196
  var NEVER = INVALID;
4197
4197
 
4198
- // ../../packages/core/dist/chunk-V42NUK73.js
4198
+ // ../../packages/core/dist/chunk-ACTIPQZ3.js
4199
4199
  var TEST_MESSAGE_ROLE_VALUES = ["system", "user", "assistant", "tool"];
4200
4200
  var TEST_MESSAGE_ROLES = TEST_MESSAGE_ROLE_VALUES;
4201
4201
  var TEST_MESSAGE_ROLE_SET = new Set(TEST_MESSAGE_ROLE_VALUES);
@@ -37706,7 +37706,7 @@ var ClaudeProvider = class {
37706
37706
  // a Claude Code session the CLAUDECODE env var is set, which causes the
37707
37707
  // subprocess to refuse to start ("cannot be launched inside another Claude
37708
37708
  // Code session"). Passing a sanitized env removes that guard.
37709
- env: sanitizeEnvForClaudeSdk()
37709
+ env: sanitizeEnvForClaudeSdk(request.braintrustSpanIds)
37710
37710
  };
37711
37711
  if (this.config.model) {
37712
37712
  queryOptions.model = this.config.model;
@@ -38010,10 +38010,14 @@ function summarizeMessage(msg) {
38010
38010
  return void 0;
38011
38011
  }
38012
38012
  }
38013
- function sanitizeEnvForClaudeSdk() {
38013
+ function sanitizeEnvForClaudeSdk(braintrustSpanIds) {
38014
38014
  const env = { ...process.env };
38015
38015
  env.CLAUDECODE = void 0;
38016
38016
  env.CLAUDE_CODE_ENTRYPOINT = void 0;
38017
+ if (braintrustSpanIds) {
38018
+ env.CC_PARENT_SPAN_ID = braintrustSpanIds.parentSpanId;
38019
+ env.CC_ROOT_SPAN_ID = braintrustSpanIds.rootSpanId;
38020
+ }
38017
38021
  return env;
38018
38022
  }
38019
38023
  function isClaudeLogStreamingDisabled() {
@@ -48712,6 +48716,7 @@ async function invokeProvider(provider, options) {
48712
48716
  signal.addEventListener("abort", () => controller.abort(), { once: true });
48713
48717
  }
48714
48718
  try {
48719
+ const braintrustSpanIds = streamCallbacks?.getActiveSpanIds?.() ?? void 0;
48715
48720
  return await provider.invoke({
48716
48721
  question: promptInputs.question,
48717
48722
  guidelines: promptInputs.guidelines,
@@ -48727,7 +48732,8 @@ async function invokeProvider(provider, options) {
48727
48732
  cwd,
48728
48733
  workspaceFile,
48729
48734
  captureFileChanges: captureFileChanges2,
48730
- streamCallbacks
48735
+ streamCallbacks,
48736
+ braintrustSpanIds: braintrustSpanIds ?? void 0
48731
48737
  });
48732
48738
  } finally {
48733
48739
  if (timeout !== void 0) {
@@ -49263,9 +49269,16 @@ var OTEL_BACKEND_PRESETS = {
49263
49269
  braintrust: {
49264
49270
  name: "braintrust",
49265
49271
  endpoint: "https://api.braintrust.dev/otel/v1/traces",
49266
- headers: (env) => ({
49267
- Authorization: `Bearer ${env.BRAINTRUST_API_KEY ?? ""}`
49268
- })
49272
+ headers: (env) => {
49273
+ const headers = {
49274
+ Authorization: `Bearer ${env.BRAINTRUST_API_KEY ?? ""}`
49275
+ };
49276
+ const parent = env.BRAINTRUST_PARENT ?? (env.BRAINTRUST_PROJECT_ID ? `project_id:${env.BRAINTRUST_PROJECT_ID}` : void 0) ?? (env.BRAINTRUST_PROJECT ? `project_name:${env.BRAINTRUST_PROJECT}` : void 0);
49277
+ if (parent) {
49278
+ headers["x-bt-parent"] = parent;
49279
+ }
49280
+ return headers;
49281
+ }
49269
49282
  },
49270
49283
  confident: {
49271
49284
  name: "confident",
@@ -49613,11 +49626,23 @@ var OtelStreamingObserver = class {
49613
49626
  this.rootSpan = null;
49614
49627
  this.rootCtx = null;
49615
49628
  }
49629
+ /** Return the active eval span's trace ID and span ID for Braintrust trace bridging */
49630
+ getActiveSpanIds() {
49631
+ if (!this.rootSpan) return null;
49632
+ try {
49633
+ const spanCtx = this.rootSpan.spanContext?.() ?? this.rootSpan._spanContext;
49634
+ if (!spanCtx?.traceId || !spanCtx?.spanId) return null;
49635
+ return { parentSpanId: spanCtx.spanId, rootSpanId: spanCtx.traceId };
49636
+ } catch {
49637
+ return null;
49638
+ }
49639
+ }
49616
49640
  /** Get ProviderStreamCallbacks for passing to providers */
49617
49641
  getStreamCallbacks() {
49618
49642
  return {
49619
49643
  onToolCallEnd: (name16, input, output, durationMs, toolCallId) => this.onToolCall(name16, input, output, durationMs, toolCallId),
49620
- onLlmCallEnd: (model, tokenUsage) => this.onLlmCall(model, tokenUsage)
49644
+ onLlmCallEnd: (model, tokenUsage) => this.onLlmCall(model, tokenUsage),
49645
+ getActiveSpanIds: () => this.getActiveSpanIds()
49621
49646
  };
49622
49647
  }
49623
49648
  };
@@ -49783,4 +49808,4 @@ export {
49783
49808
  OtelStreamingObserver,
49784
49809
  createAgentKernel
49785
49810
  };
49786
- //# sourceMappingURL=chunk-YTHTGLMT.js.map
49811
+ //# sourceMappingURL=chunk-XTYMR4I5.js.map