braintrust 3.23.1 → 3.25.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/dev/dist/index.d.mts +11 -0
- package/dev/dist/index.d.ts +11 -0
- package/dev/dist/index.js +2881 -1518
- package/dev/dist/index.mjs +2298 -935
- package/dist/apply-auto-instrumentation.js +218 -195
- package/dist/apply-auto-instrumentation.mjs +30 -7
- package/dist/auto-instrumentations/bundler/esbuild.cjs +618 -444
- package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
- package/dist/auto-instrumentations/bundler/next.cjs +618 -444
- package/dist/auto-instrumentations/bundler/next.mjs +3 -3
- package/dist/auto-instrumentations/bundler/rollup.cjs +618 -444
- package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
- package/dist/auto-instrumentations/bundler/vite.cjs +618 -444
- package/dist/auto-instrumentations/bundler/vite.d.mts +1 -1
- package/dist/auto-instrumentations/bundler/vite.d.ts +1 -1
- package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
- package/dist/auto-instrumentations/bundler/webpack-loader.cjs +618 -444
- package/dist/auto-instrumentations/bundler/webpack.cjs +618 -444
- package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
- package/dist/auto-instrumentations/{chunk-KIMLYPRW.mjs → chunk-7P6563SW.mjs} +1 -1
- package/dist/auto-instrumentations/{chunk-YXLNSAMJ.mjs → chunk-CZ24KNHT.mjs} +591 -424
- package/dist/auto-instrumentations/{chunk-EXY7QCJD.mjs → chunk-JPVCUKTY.mjs} +30 -21
- package/dist/auto-instrumentations/hook.mjs +778 -457
- package/dist/auto-instrumentations/index.cjs +590 -424
- package/dist/auto-instrumentations/index.mjs +1 -1
- package/dist/browser.d.mts +138 -9
- package/dist/browser.d.ts +138 -9
- package/dist/browser.js +2700 -1011
- package/dist/browser.mjs +2700 -1011
- package/dist/{chunk-RBXD2KYN.mjs → chunk-2SANLSWX.mjs} +1577 -513
- package/dist/{chunk-36IPYKMG.mjs → chunk-ABR2QWDP.mjs} +704 -438
- package/dist/{chunk-B6ZQIAK3.js → chunk-GSIDVFE6.js} +2361 -1297
- package/dist/{chunk-CDIKAHDZ.js → chunk-P25IOOU4.js} +706 -440
- package/dist/cli.js +2307 -940
- package/dist/edge-light.js +2700 -1011
- package/dist/edge-light.mjs +2700 -1011
- package/dist/index.d.mts +138 -9
- package/dist/index.d.ts +138 -9
- package/dist/index.js +955 -551
- package/dist/index.mjs +493 -89
- package/dist/instrumentation/index.d.mts +135 -9
- package/dist/instrumentation/index.d.ts +135 -9
- package/dist/instrumentation/index.js +2554 -1009
- package/dist/instrumentation/index.mjs +2554 -1009
- package/dist/vitest-evals-reporter.js +17 -16
- package/dist/vitest-evals-reporter.mjs +3 -2
- package/dist/workerd.js +2700 -1011
- package/dist/workerd.mjs +2700 -1011
- package/package.json +4 -4
- package/util/dist/index.js +4 -0
- package/util/dist/index.mjs +4 -0
|
@@ -7571,6 +7571,11 @@ declare class SpanCache {
|
|
|
7571
7571
|
dispose(): void;
|
|
7572
7572
|
}
|
|
7573
7573
|
|
|
7574
|
+
type SpanOriginEnvironment = {
|
|
7575
|
+
type?: string;
|
|
7576
|
+
name?: string;
|
|
7577
|
+
};
|
|
7578
|
+
|
|
7574
7579
|
/// <reference lib="dom" />
|
|
7575
7580
|
|
|
7576
7581
|
declare const RESET_CONTEXT_MANAGER_STATE: unique symbol;
|
|
@@ -7936,7 +7941,13 @@ declare class BraintrustState {
|
|
|
7936
7941
|
private _idGenerator;
|
|
7937
7942
|
private _contextManager;
|
|
7938
7943
|
private _otelFlushCallback;
|
|
7944
|
+
spanOriginEnvironment: SpanOriginEnvironment | undefined;
|
|
7945
|
+
private traceContextSigningSecret;
|
|
7939
7946
|
constructor(loginParams: LoginOptions);
|
|
7947
|
+
/** @internal */
|
|
7948
|
+
_internalSetTraceContextSigningSecret(secret: string | undefined): void;
|
|
7949
|
+
/** @internal */
|
|
7950
|
+
_internalGetTraceContextSigningSecret(): string | undefined;
|
|
7940
7951
|
resetLoginInfo(): void;
|
|
7941
7952
|
resetIdGenState(): void;
|
|
7942
7953
|
[RESET_CONTEXT_MANAGER_STATE](): void;
|
|
@@ -8963,8 +8974,8 @@ type EveJsonObject = {
|
|
|
8963
8974
|
readonly [key: string]: EveJsonValue;
|
|
8964
8975
|
};
|
|
8965
8976
|
interface EveHookContext {
|
|
8966
|
-
readonly session
|
|
8967
|
-
readonly id
|
|
8977
|
+
readonly session: {
|
|
8978
|
+
readonly id: string;
|
|
8968
8979
|
readonly parent?: {
|
|
8969
8980
|
readonly callId?: string;
|
|
8970
8981
|
readonly sessionId?: string;
|
|
@@ -9065,6 +9076,15 @@ type EveHandleMessageStreamEvent = {
|
|
|
9065
9076
|
};
|
|
9066
9077
|
readonly meta?: EveStreamEventMeta;
|
|
9067
9078
|
readonly type: "message.completed";
|
|
9079
|
+
} | {
|
|
9080
|
+
readonly data: {
|
|
9081
|
+
readonly reasoning: string;
|
|
9082
|
+
readonly sequence: number;
|
|
9083
|
+
readonly stepIndex: number;
|
|
9084
|
+
readonly turnId: string;
|
|
9085
|
+
};
|
|
9086
|
+
readonly meta?: EveStreamEventMeta;
|
|
9087
|
+
readonly type: "reasoning.completed";
|
|
9068
9088
|
} | {
|
|
9069
9089
|
readonly data: {
|
|
9070
9090
|
readonly result: EveJsonValue;
|
|
@@ -9198,22 +9218,128 @@ interface EveHookDefinition {
|
|
|
9198
9218
|
interface EveInstrumentationSetupContext {
|
|
9199
9219
|
readonly agentName: string;
|
|
9200
9220
|
}
|
|
9221
|
+
type EveTextPart = {
|
|
9222
|
+
readonly text: string;
|
|
9223
|
+
readonly type: "text";
|
|
9224
|
+
};
|
|
9225
|
+
type EveImagePart = {
|
|
9226
|
+
readonly image: unknown;
|
|
9227
|
+
readonly mediaType?: string;
|
|
9228
|
+
readonly type: "image";
|
|
9229
|
+
};
|
|
9230
|
+
type EveFilePart = {
|
|
9231
|
+
readonly data: unknown;
|
|
9232
|
+
readonly filename?: string;
|
|
9233
|
+
readonly mediaType: string;
|
|
9234
|
+
readonly type: "file";
|
|
9235
|
+
};
|
|
9236
|
+
type EveReasoningPart = {
|
|
9237
|
+
readonly text: string;
|
|
9238
|
+
readonly type: "reasoning";
|
|
9239
|
+
};
|
|
9240
|
+
type EveReasoningFilePart = {
|
|
9241
|
+
readonly data: unknown;
|
|
9242
|
+
readonly mediaType: string;
|
|
9243
|
+
readonly type: "reasoning-file";
|
|
9244
|
+
};
|
|
9245
|
+
type EveCustomPart = {
|
|
9246
|
+
readonly kind: `${string}.${string}`;
|
|
9247
|
+
readonly type: "custom";
|
|
9248
|
+
};
|
|
9249
|
+
type EveToolCallPart = {
|
|
9250
|
+
readonly input: unknown;
|
|
9251
|
+
readonly providerExecuted?: boolean;
|
|
9252
|
+
readonly toolCallId: string;
|
|
9253
|
+
readonly toolName: string;
|
|
9254
|
+
readonly type: "tool-call";
|
|
9255
|
+
};
|
|
9256
|
+
type EveToolResultContentPart = EveTextPart | EveFilePart | {
|
|
9257
|
+
readonly data: string;
|
|
9258
|
+
readonly filename?: string;
|
|
9259
|
+
readonly mediaType: string;
|
|
9260
|
+
readonly type: "file-data";
|
|
9261
|
+
} | {
|
|
9262
|
+
readonly mediaType?: string;
|
|
9263
|
+
readonly type: "file-url";
|
|
9264
|
+
readonly url: string;
|
|
9265
|
+
} | {
|
|
9266
|
+
readonly fileId: string | Readonly<Record<string, string>>;
|
|
9267
|
+
readonly type: "file-id" | "image-file-id";
|
|
9268
|
+
} | {
|
|
9269
|
+
readonly providerReference: Readonly<Record<string, string>>;
|
|
9270
|
+
readonly type: "file-reference" | "image-file-reference";
|
|
9271
|
+
} | {
|
|
9272
|
+
readonly data: string;
|
|
9273
|
+
readonly mediaType: string;
|
|
9274
|
+
readonly type: "image-data";
|
|
9275
|
+
} | {
|
|
9276
|
+
readonly type: "image-url";
|
|
9277
|
+
readonly url: string;
|
|
9278
|
+
} | {
|
|
9279
|
+
readonly type: "custom";
|
|
9280
|
+
};
|
|
9281
|
+
type EveToolResultOutput = {
|
|
9282
|
+
readonly type: "text" | "error-text";
|
|
9283
|
+
readonly value: string;
|
|
9284
|
+
} | {
|
|
9285
|
+
readonly type: "json" | "error-json";
|
|
9286
|
+
readonly value: EveJsonValue;
|
|
9287
|
+
} | {
|
|
9288
|
+
readonly reason?: string;
|
|
9289
|
+
readonly type: "execution-denied";
|
|
9290
|
+
} | {
|
|
9291
|
+
readonly type: "content";
|
|
9292
|
+
readonly value: readonly EveToolResultContentPart[];
|
|
9293
|
+
};
|
|
9294
|
+
type EveToolResultPart = {
|
|
9295
|
+
readonly output: EveToolResultOutput;
|
|
9296
|
+
readonly toolCallId: string;
|
|
9297
|
+
readonly toolName: string;
|
|
9298
|
+
readonly type: "tool-result";
|
|
9299
|
+
};
|
|
9300
|
+
type EveToolApprovalRequest = {
|
|
9301
|
+
readonly approvalId: string;
|
|
9302
|
+
readonly isAutomatic?: boolean;
|
|
9303
|
+
readonly signature?: string;
|
|
9304
|
+
readonly toolCallId: string;
|
|
9305
|
+
readonly type: "tool-approval-request";
|
|
9306
|
+
};
|
|
9307
|
+
type EveToolApprovalResponse = {
|
|
9308
|
+
readonly approvalId: string;
|
|
9309
|
+
readonly approved: boolean;
|
|
9310
|
+
readonly providerExecuted?: boolean;
|
|
9311
|
+
readonly reason?: string;
|
|
9312
|
+
readonly type: "tool-approval-response";
|
|
9313
|
+
};
|
|
9314
|
+
type EveSystemModelMessage = {
|
|
9315
|
+
readonly content: string;
|
|
9316
|
+
readonly role: "system";
|
|
9317
|
+
};
|
|
9318
|
+
type EveModelMessage = EveSystemModelMessage | {
|
|
9319
|
+
readonly content: string | readonly (EveTextPart | EveImagePart | EveFilePart)[];
|
|
9320
|
+
readonly role: "user";
|
|
9321
|
+
} | {
|
|
9322
|
+
readonly content: string | readonly (EveTextPart | EveCustomPart | EveFilePart | EveReasoningPart | EveReasoningFilePart | EveToolCallPart | EveToolResultPart | EveToolApprovalRequest)[];
|
|
9323
|
+
readonly role: "assistant";
|
|
9324
|
+
} | {
|
|
9325
|
+
readonly content: readonly (EveToolResultPart | EveToolApprovalResponse)[];
|
|
9326
|
+
readonly role: "tool";
|
|
9327
|
+
};
|
|
9201
9328
|
interface EveInstrumentationModelInput {
|
|
9202
|
-
readonly instructions?: string | readonly
|
|
9203
|
-
readonly messages: readonly
|
|
9329
|
+
readonly instructions?: string | readonly EveSystemModelMessage[];
|
|
9330
|
+
readonly messages: readonly EveModelMessage[];
|
|
9204
9331
|
}
|
|
9205
9332
|
interface EveInstrumentationStepStartedEventInput {
|
|
9206
|
-
readonly channel?: unknown;
|
|
9207
9333
|
readonly modelInput: EveInstrumentationModelInput;
|
|
9208
9334
|
readonly session: {
|
|
9209
|
-
readonly id
|
|
9335
|
+
readonly id: string;
|
|
9210
9336
|
};
|
|
9211
9337
|
readonly step: {
|
|
9212
|
-
readonly index
|
|
9338
|
+
readonly index: number;
|
|
9213
9339
|
};
|
|
9214
9340
|
readonly turn: {
|
|
9215
|
-
readonly id
|
|
9216
|
-
readonly sequence
|
|
9341
|
+
readonly id: string;
|
|
9342
|
+
readonly sequence: number;
|
|
9217
9343
|
};
|
|
9218
9344
|
}
|
|
9219
9345
|
interface EveInstrumentationDefinition {
|
|
@@ -7571,6 +7571,11 @@ declare class SpanCache {
|
|
|
7571
7571
|
dispose(): void;
|
|
7572
7572
|
}
|
|
7573
7573
|
|
|
7574
|
+
type SpanOriginEnvironment = {
|
|
7575
|
+
type?: string;
|
|
7576
|
+
name?: string;
|
|
7577
|
+
};
|
|
7578
|
+
|
|
7574
7579
|
/// <reference lib="dom" />
|
|
7575
7580
|
|
|
7576
7581
|
declare const RESET_CONTEXT_MANAGER_STATE: unique symbol;
|
|
@@ -7936,7 +7941,13 @@ declare class BraintrustState {
|
|
|
7936
7941
|
private _idGenerator;
|
|
7937
7942
|
private _contextManager;
|
|
7938
7943
|
private _otelFlushCallback;
|
|
7944
|
+
spanOriginEnvironment: SpanOriginEnvironment | undefined;
|
|
7945
|
+
private traceContextSigningSecret;
|
|
7939
7946
|
constructor(loginParams: LoginOptions);
|
|
7947
|
+
/** @internal */
|
|
7948
|
+
_internalSetTraceContextSigningSecret(secret: string | undefined): void;
|
|
7949
|
+
/** @internal */
|
|
7950
|
+
_internalGetTraceContextSigningSecret(): string | undefined;
|
|
7940
7951
|
resetLoginInfo(): void;
|
|
7941
7952
|
resetIdGenState(): void;
|
|
7942
7953
|
[RESET_CONTEXT_MANAGER_STATE](): void;
|
|
@@ -8963,8 +8974,8 @@ type EveJsonObject = {
|
|
|
8963
8974
|
readonly [key: string]: EveJsonValue;
|
|
8964
8975
|
};
|
|
8965
8976
|
interface EveHookContext {
|
|
8966
|
-
readonly session
|
|
8967
|
-
readonly id
|
|
8977
|
+
readonly session: {
|
|
8978
|
+
readonly id: string;
|
|
8968
8979
|
readonly parent?: {
|
|
8969
8980
|
readonly callId?: string;
|
|
8970
8981
|
readonly sessionId?: string;
|
|
@@ -9065,6 +9076,15 @@ type EveHandleMessageStreamEvent = {
|
|
|
9065
9076
|
};
|
|
9066
9077
|
readonly meta?: EveStreamEventMeta;
|
|
9067
9078
|
readonly type: "message.completed";
|
|
9079
|
+
} | {
|
|
9080
|
+
readonly data: {
|
|
9081
|
+
readonly reasoning: string;
|
|
9082
|
+
readonly sequence: number;
|
|
9083
|
+
readonly stepIndex: number;
|
|
9084
|
+
readonly turnId: string;
|
|
9085
|
+
};
|
|
9086
|
+
readonly meta?: EveStreamEventMeta;
|
|
9087
|
+
readonly type: "reasoning.completed";
|
|
9068
9088
|
} | {
|
|
9069
9089
|
readonly data: {
|
|
9070
9090
|
readonly result: EveJsonValue;
|
|
@@ -9198,22 +9218,128 @@ interface EveHookDefinition {
|
|
|
9198
9218
|
interface EveInstrumentationSetupContext {
|
|
9199
9219
|
readonly agentName: string;
|
|
9200
9220
|
}
|
|
9221
|
+
type EveTextPart = {
|
|
9222
|
+
readonly text: string;
|
|
9223
|
+
readonly type: "text";
|
|
9224
|
+
};
|
|
9225
|
+
type EveImagePart = {
|
|
9226
|
+
readonly image: unknown;
|
|
9227
|
+
readonly mediaType?: string;
|
|
9228
|
+
readonly type: "image";
|
|
9229
|
+
};
|
|
9230
|
+
type EveFilePart = {
|
|
9231
|
+
readonly data: unknown;
|
|
9232
|
+
readonly filename?: string;
|
|
9233
|
+
readonly mediaType: string;
|
|
9234
|
+
readonly type: "file";
|
|
9235
|
+
};
|
|
9236
|
+
type EveReasoningPart = {
|
|
9237
|
+
readonly text: string;
|
|
9238
|
+
readonly type: "reasoning";
|
|
9239
|
+
};
|
|
9240
|
+
type EveReasoningFilePart = {
|
|
9241
|
+
readonly data: unknown;
|
|
9242
|
+
readonly mediaType: string;
|
|
9243
|
+
readonly type: "reasoning-file";
|
|
9244
|
+
};
|
|
9245
|
+
type EveCustomPart = {
|
|
9246
|
+
readonly kind: `${string}.${string}`;
|
|
9247
|
+
readonly type: "custom";
|
|
9248
|
+
};
|
|
9249
|
+
type EveToolCallPart = {
|
|
9250
|
+
readonly input: unknown;
|
|
9251
|
+
readonly providerExecuted?: boolean;
|
|
9252
|
+
readonly toolCallId: string;
|
|
9253
|
+
readonly toolName: string;
|
|
9254
|
+
readonly type: "tool-call";
|
|
9255
|
+
};
|
|
9256
|
+
type EveToolResultContentPart = EveTextPart | EveFilePart | {
|
|
9257
|
+
readonly data: string;
|
|
9258
|
+
readonly filename?: string;
|
|
9259
|
+
readonly mediaType: string;
|
|
9260
|
+
readonly type: "file-data";
|
|
9261
|
+
} | {
|
|
9262
|
+
readonly mediaType?: string;
|
|
9263
|
+
readonly type: "file-url";
|
|
9264
|
+
readonly url: string;
|
|
9265
|
+
} | {
|
|
9266
|
+
readonly fileId: string | Readonly<Record<string, string>>;
|
|
9267
|
+
readonly type: "file-id" | "image-file-id";
|
|
9268
|
+
} | {
|
|
9269
|
+
readonly providerReference: Readonly<Record<string, string>>;
|
|
9270
|
+
readonly type: "file-reference" | "image-file-reference";
|
|
9271
|
+
} | {
|
|
9272
|
+
readonly data: string;
|
|
9273
|
+
readonly mediaType: string;
|
|
9274
|
+
readonly type: "image-data";
|
|
9275
|
+
} | {
|
|
9276
|
+
readonly type: "image-url";
|
|
9277
|
+
readonly url: string;
|
|
9278
|
+
} | {
|
|
9279
|
+
readonly type: "custom";
|
|
9280
|
+
};
|
|
9281
|
+
type EveToolResultOutput = {
|
|
9282
|
+
readonly type: "text" | "error-text";
|
|
9283
|
+
readonly value: string;
|
|
9284
|
+
} | {
|
|
9285
|
+
readonly type: "json" | "error-json";
|
|
9286
|
+
readonly value: EveJsonValue;
|
|
9287
|
+
} | {
|
|
9288
|
+
readonly reason?: string;
|
|
9289
|
+
readonly type: "execution-denied";
|
|
9290
|
+
} | {
|
|
9291
|
+
readonly type: "content";
|
|
9292
|
+
readonly value: readonly EveToolResultContentPart[];
|
|
9293
|
+
};
|
|
9294
|
+
type EveToolResultPart = {
|
|
9295
|
+
readonly output: EveToolResultOutput;
|
|
9296
|
+
readonly toolCallId: string;
|
|
9297
|
+
readonly toolName: string;
|
|
9298
|
+
readonly type: "tool-result";
|
|
9299
|
+
};
|
|
9300
|
+
type EveToolApprovalRequest = {
|
|
9301
|
+
readonly approvalId: string;
|
|
9302
|
+
readonly isAutomatic?: boolean;
|
|
9303
|
+
readonly signature?: string;
|
|
9304
|
+
readonly toolCallId: string;
|
|
9305
|
+
readonly type: "tool-approval-request";
|
|
9306
|
+
};
|
|
9307
|
+
type EveToolApprovalResponse = {
|
|
9308
|
+
readonly approvalId: string;
|
|
9309
|
+
readonly approved: boolean;
|
|
9310
|
+
readonly providerExecuted?: boolean;
|
|
9311
|
+
readonly reason?: string;
|
|
9312
|
+
readonly type: "tool-approval-response";
|
|
9313
|
+
};
|
|
9314
|
+
type EveSystemModelMessage = {
|
|
9315
|
+
readonly content: string;
|
|
9316
|
+
readonly role: "system";
|
|
9317
|
+
};
|
|
9318
|
+
type EveModelMessage = EveSystemModelMessage | {
|
|
9319
|
+
readonly content: string | readonly (EveTextPart | EveImagePart | EveFilePart)[];
|
|
9320
|
+
readonly role: "user";
|
|
9321
|
+
} | {
|
|
9322
|
+
readonly content: string | readonly (EveTextPart | EveCustomPart | EveFilePart | EveReasoningPart | EveReasoningFilePart | EveToolCallPart | EveToolResultPart | EveToolApprovalRequest)[];
|
|
9323
|
+
readonly role: "assistant";
|
|
9324
|
+
} | {
|
|
9325
|
+
readonly content: readonly (EveToolResultPart | EveToolApprovalResponse)[];
|
|
9326
|
+
readonly role: "tool";
|
|
9327
|
+
};
|
|
9201
9328
|
interface EveInstrumentationModelInput {
|
|
9202
|
-
readonly instructions?: string | readonly
|
|
9203
|
-
readonly messages: readonly
|
|
9329
|
+
readonly instructions?: string | readonly EveSystemModelMessage[];
|
|
9330
|
+
readonly messages: readonly EveModelMessage[];
|
|
9204
9331
|
}
|
|
9205
9332
|
interface EveInstrumentationStepStartedEventInput {
|
|
9206
|
-
readonly channel?: unknown;
|
|
9207
9333
|
readonly modelInput: EveInstrumentationModelInput;
|
|
9208
9334
|
readonly session: {
|
|
9209
|
-
readonly id
|
|
9335
|
+
readonly id: string;
|
|
9210
9336
|
};
|
|
9211
9337
|
readonly step: {
|
|
9212
|
-
readonly index
|
|
9338
|
+
readonly index: number;
|
|
9213
9339
|
};
|
|
9214
9340
|
readonly turn: {
|
|
9215
|
-
readonly id
|
|
9216
|
-
readonly sequence
|
|
9341
|
+
readonly id: string;
|
|
9342
|
+
readonly sequence: number;
|
|
9217
9343
|
};
|
|
9218
9344
|
}
|
|
9219
9345
|
interface EveInstrumentationDefinition {
|