agentv 2.18.3 → 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.
@@ -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);
@@ -34711,6 +34711,11 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
34711
34711
  }
34712
34712
  if (typeValue === "code-judge") {
34713
34713
  let command;
34714
+ if (rawEvaluator.script !== void 0 && rawEvaluator.command === void 0) {
34715
+ console.warn(
34716
+ `${ANSI_YELLOW4}Warning: 'script' is deprecated in evaluator '${name16}' in '${evalId}'. Use 'command' instead.${ANSI_RESET4}`
34717
+ );
34718
+ }
34714
34719
  const rawCommand = rawEvaluator.command ?? rawEvaluator.script;
34715
34720
  if (typeof rawCommand === "string") {
34716
34721
  const trimmed = rawCommand.trim();
@@ -35469,6 +35474,11 @@ async function parseEvaluatorList(candidateEvaluators, searchRoots, evalId) {
35469
35474
  let resolvedPromptScript;
35470
35475
  let promptScriptConfig;
35471
35476
  if (isJsonObject2(rawPrompt)) {
35477
+ if (rawPrompt.script !== void 0 && rawPrompt.command === void 0) {
35478
+ console.warn(
35479
+ `${ANSI_YELLOW4}Warning: 'prompt.script' is deprecated in evaluator '${name16}' in '${evalId}'. Use 'prompt.command' instead.${ANSI_RESET4}`
35480
+ );
35481
+ }
35472
35482
  const commandArray = asStringArray(
35473
35483
  rawPrompt.command ?? rawPrompt.script,
35474
35484
  `prompt.command for evaluator '${name16}' in '${evalId}'`
@@ -36972,6 +36982,9 @@ var loadEvalCaseById = loadTestById;
36972
36982
  function parseWorkspaceScriptConfig(raw, evalFileDir) {
36973
36983
  if (!isJsonObject(raw)) return void 0;
36974
36984
  const obj = raw;
36985
+ if (obj.script !== void 0 && obj.command === void 0) {
36986
+ logWarning6("'script' is deprecated. Use 'command' instead.");
36987
+ }
36975
36988
  const commandSource = obj.command ?? obj.script;
36976
36989
  if (!Array.isArray(commandSource) || commandSource.length === 0) return void 0;
36977
36990
  const commandArr = commandSource.filter((s) => typeof s === "string");
@@ -37693,7 +37706,7 @@ var ClaudeProvider = class {
37693
37706
  // a Claude Code session the CLAUDECODE env var is set, which causes the
37694
37707
  // subprocess to refuse to start ("cannot be launched inside another Claude
37695
37708
  // Code session"). Passing a sanitized env removes that guard.
37696
- env: sanitizeEnvForClaudeSdk()
37709
+ env: sanitizeEnvForClaudeSdk(request.braintrustSpanIds)
37697
37710
  };
37698
37711
  if (this.config.model) {
37699
37712
  queryOptions.model = this.config.model;
@@ -37997,10 +38010,14 @@ function summarizeMessage(msg) {
37997
38010
  return void 0;
37998
38011
  }
37999
38012
  }
38000
- function sanitizeEnvForClaudeSdk() {
38013
+ function sanitizeEnvForClaudeSdk(braintrustSpanIds) {
38001
38014
  const env = { ...process.env };
38002
38015
  env.CLAUDECODE = void 0;
38003
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
+ }
38004
38021
  return env;
38005
38022
  }
38006
38023
  function isClaudeLogStreamingDisabled() {
@@ -47026,6 +47043,11 @@ async function executeWorkspaceScript(config2, context, failureMode = "fatal") {
47026
47043
  });
47027
47044
  const timeoutMs = config2.timeout_ms ?? (failureMode === "fatal" ? 6e4 : 3e4);
47028
47045
  const cwd = config2.cwd ?? context.evalDir;
47046
+ if (config2.script !== void 0 && config2.command === void 0) {
47047
+ console.warn(
47048
+ "\x1B[33mWarning: 'script' is deprecated in workspace config. Use 'command' instead.\x1B[0m"
47049
+ );
47050
+ }
47029
47051
  const rawCommand = config2.command ?? config2.script ?? [];
47030
47052
  const commandArray = interpolateArgs(rawCommand, context);
47031
47053
  const result = await execFileWithStdin(commandArray, stdin, {
@@ -48694,6 +48716,7 @@ async function invokeProvider(provider, options) {
48694
48716
  signal.addEventListener("abort", () => controller.abort(), { once: true });
48695
48717
  }
48696
48718
  try {
48719
+ const braintrustSpanIds = streamCallbacks?.getActiveSpanIds?.() ?? void 0;
48697
48720
  return await provider.invoke({
48698
48721
  question: promptInputs.question,
48699
48722
  guidelines: promptInputs.guidelines,
@@ -48709,7 +48732,8 @@ async function invokeProvider(provider, options) {
48709
48732
  cwd,
48710
48733
  workspaceFile,
48711
48734
  captureFileChanges: captureFileChanges2,
48712
- streamCallbacks
48735
+ streamCallbacks,
48736
+ braintrustSpanIds: braintrustSpanIds ?? void 0
48713
48737
  });
48714
48738
  } finally {
48715
48739
  if (timeout !== void 0) {
@@ -49245,9 +49269,16 @@ var OTEL_BACKEND_PRESETS = {
49245
49269
  braintrust: {
49246
49270
  name: "braintrust",
49247
49271
  endpoint: "https://api.braintrust.dev/otel/v1/traces",
49248
- headers: (env) => ({
49249
- Authorization: `Bearer ${env.BRAINTRUST_API_KEY ?? ""}`
49250
- })
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
+ }
49251
49282
  },
49252
49283
  confident: {
49253
49284
  name: "confident",
@@ -49595,11 +49626,23 @@ var OtelStreamingObserver = class {
49595
49626
  this.rootSpan = null;
49596
49627
  this.rootCtx = null;
49597
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
+ }
49598
49640
  /** Get ProviderStreamCallbacks for passing to providers */
49599
49641
  getStreamCallbacks() {
49600
49642
  return {
49601
49643
  onToolCallEnd: (name16, input, output, durationMs, toolCallId) => this.onToolCall(name16, input, output, durationMs, toolCallId),
49602
- onLlmCallEnd: (model, tokenUsage) => this.onLlmCall(model, tokenUsage)
49644
+ onLlmCallEnd: (model, tokenUsage) => this.onLlmCall(model, tokenUsage),
49645
+ getActiveSpanIds: () => this.getActiveSpanIds()
49603
49646
  };
49604
49647
  }
49605
49648
  };
@@ -49765,4 +49808,4 @@ export {
49765
49808
  OtelStreamingObserver,
49766
49809
  createAgentKernel
49767
49810
  };
49768
- //# sourceMappingURL=chunk-BM77B57R.js.map
49811
+ //# sourceMappingURL=chunk-XTYMR4I5.js.map