@agentv/core 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.
- package/dist/{chunk-V42NUK73.js → chunk-ACTIPQZ3.js} +1 -1
- package/dist/{chunk-V42NUK73.js.map → chunk-ACTIPQZ3.js.map} +1 -1
- package/dist/evaluation/validation/index.cjs.map +1 -1
- package/dist/evaluation/validation/index.js +1 -1
- package/dist/index.cjs +32 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +33 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5565,7 +5565,7 @@ var ClaudeProvider = class {
|
|
|
5565
5565
|
// a Claude Code session the CLAUDECODE env var is set, which causes the
|
|
5566
5566
|
// subprocess to refuse to start ("cannot be launched inside another Claude
|
|
5567
5567
|
// Code session"). Passing a sanitized env removes that guard.
|
|
5568
|
-
env: sanitizeEnvForClaudeSdk()
|
|
5568
|
+
env: sanitizeEnvForClaudeSdk(request.braintrustSpanIds)
|
|
5569
5569
|
};
|
|
5570
5570
|
if (this.config.model) {
|
|
5571
5571
|
queryOptions.model = this.config.model;
|
|
@@ -5869,10 +5869,14 @@ function summarizeMessage(msg) {
|
|
|
5869
5869
|
return void 0;
|
|
5870
5870
|
}
|
|
5871
5871
|
}
|
|
5872
|
-
function sanitizeEnvForClaudeSdk() {
|
|
5872
|
+
function sanitizeEnvForClaudeSdk(braintrustSpanIds) {
|
|
5873
5873
|
const env = { ...process.env };
|
|
5874
5874
|
env.CLAUDECODE = void 0;
|
|
5875
5875
|
env.CLAUDE_CODE_ENTRYPOINT = void 0;
|
|
5876
|
+
if (braintrustSpanIds) {
|
|
5877
|
+
env.CC_PARENT_SPAN_ID = braintrustSpanIds.parentSpanId;
|
|
5878
|
+
env.CC_ROOT_SPAN_ID = braintrustSpanIds.rootSpanId;
|
|
5879
|
+
}
|
|
5876
5880
|
return env;
|
|
5877
5881
|
}
|
|
5878
5882
|
function isClaudeLogStreamingDisabled() {
|
|
@@ -17955,6 +17959,7 @@ async function invokeProvider(provider, options) {
|
|
|
17955
17959
|
signal.addEventListener("abort", () => controller.abort(), { once: true });
|
|
17956
17960
|
}
|
|
17957
17961
|
try {
|
|
17962
|
+
const braintrustSpanIds = streamCallbacks?.getActiveSpanIds?.() ?? void 0;
|
|
17958
17963
|
return await provider.invoke({
|
|
17959
17964
|
question: promptInputs.question,
|
|
17960
17965
|
guidelines: promptInputs.guidelines,
|
|
@@ -17970,7 +17975,8 @@ async function invokeProvider(provider, options) {
|
|
|
17970
17975
|
cwd,
|
|
17971
17976
|
workspaceFile,
|
|
17972
17977
|
captureFileChanges: captureFileChanges2,
|
|
17973
|
-
streamCallbacks
|
|
17978
|
+
streamCallbacks,
|
|
17979
|
+
braintrustSpanIds: braintrustSpanIds ?? void 0
|
|
17974
17980
|
});
|
|
17975
17981
|
} finally {
|
|
17976
17982
|
if (timeout !== void 0) {
|
|
@@ -18525,9 +18531,16 @@ var OTEL_BACKEND_PRESETS = {
|
|
|
18525
18531
|
braintrust: {
|
|
18526
18532
|
name: "braintrust",
|
|
18527
18533
|
endpoint: "https://api.braintrust.dev/otel/v1/traces",
|
|
18528
|
-
headers: (env) =>
|
|
18529
|
-
|
|
18530
|
-
|
|
18534
|
+
headers: (env) => {
|
|
18535
|
+
const headers = {
|
|
18536
|
+
Authorization: `Bearer ${env.BRAINTRUST_API_KEY ?? ""}`
|
|
18537
|
+
};
|
|
18538
|
+
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);
|
|
18539
|
+
if (parent) {
|
|
18540
|
+
headers["x-bt-parent"] = parent;
|
|
18541
|
+
}
|
|
18542
|
+
return headers;
|
|
18543
|
+
}
|
|
18531
18544
|
},
|
|
18532
18545
|
confident: {
|
|
18533
18546
|
name: "confident",
|
|
@@ -18875,11 +18888,23 @@ var OtelStreamingObserver = class {
|
|
|
18875
18888
|
this.rootSpan = null;
|
|
18876
18889
|
this.rootCtx = null;
|
|
18877
18890
|
}
|
|
18891
|
+
/** Return the active eval span's trace ID and span ID for Braintrust trace bridging */
|
|
18892
|
+
getActiveSpanIds() {
|
|
18893
|
+
if (!this.rootSpan) return null;
|
|
18894
|
+
try {
|
|
18895
|
+
const spanCtx = this.rootSpan.spanContext?.() ?? this.rootSpan._spanContext;
|
|
18896
|
+
if (!spanCtx?.traceId || !spanCtx?.spanId) return null;
|
|
18897
|
+
return { parentSpanId: spanCtx.spanId, rootSpanId: spanCtx.traceId };
|
|
18898
|
+
} catch {
|
|
18899
|
+
return null;
|
|
18900
|
+
}
|
|
18901
|
+
}
|
|
18878
18902
|
/** Get ProviderStreamCallbacks for passing to providers */
|
|
18879
18903
|
getStreamCallbacks() {
|
|
18880
18904
|
return {
|
|
18881
18905
|
onToolCallEnd: (name, input, output, durationMs, toolCallId) => this.onToolCall(name, input, output, durationMs, toolCallId),
|
|
18882
|
-
onLlmCallEnd: (model, tokenUsage) => this.onLlmCall(model, tokenUsage)
|
|
18906
|
+
onLlmCallEnd: (model, tokenUsage) => this.onLlmCall(model, tokenUsage),
|
|
18907
|
+
getActiveSpanIds: () => this.getActiveSpanIds()
|
|
18883
18908
|
};
|
|
18884
18909
|
}
|
|
18885
18910
|
};
|