braintrust 3.18.0 → 3.20.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.
Files changed (54) hide show
  1. package/README.md +0 -10
  2. package/dev/dist/index.js +3629 -1989
  3. package/dev/dist/index.mjs +4579 -2939
  4. package/dist/apply-auto-instrumentation.js +342 -175
  5. package/dist/apply-auto-instrumentation.mjs +170 -3
  6. package/dist/auto-instrumentations/bundler/esbuild.cjs +209 -3
  7. package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
  8. package/dist/auto-instrumentations/bundler/next.cjs +209 -3
  9. package/dist/auto-instrumentations/bundler/next.mjs +3 -3
  10. package/dist/auto-instrumentations/bundler/rollup.cjs +209 -3
  11. package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
  12. package/dist/auto-instrumentations/bundler/vite.cjs +209 -3
  13. package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
  14. package/dist/auto-instrumentations/bundler/webpack-loader.cjs +209 -3
  15. package/dist/auto-instrumentations/bundler/webpack.cjs +209 -3
  16. package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
  17. package/dist/auto-instrumentations/{chunk-MYCHHXOE.mjs → chunk-K74TZGGM.mjs} +1 -1
  18. package/dist/auto-instrumentations/{chunk-GNUEZ2PE.mjs → chunk-S4374IP6.mjs} +84 -4
  19. package/dist/auto-instrumentations/{chunk-ZYKZEMRT.mjs → chunk-W4E36GIW.mjs} +128 -0
  20. package/dist/auto-instrumentations/hook.mjs +209 -3
  21. package/dist/auto-instrumentations/index.cjs +129 -0
  22. package/dist/auto-instrumentations/index.d.mts +3 -1
  23. package/dist/auto-instrumentations/index.d.ts +3 -1
  24. package/dist/auto-instrumentations/index.mjs +3 -1
  25. package/dist/browser.d.mts +88 -6
  26. package/dist/browser.d.ts +88 -6
  27. package/dist/browser.js +2059 -161
  28. package/dist/browser.mjs +4851 -2953
  29. package/dist/chunk-F73OMF66.mjs +29266 -0
  30. package/dist/{chunk-73IYIIOL.js → chunk-LPC4W2WX.js} +54 -4
  31. package/dist/chunk-POCCIJAL.js +29266 -0
  32. package/dist/{chunk-BYFADLEZ.mjs → chunk-Y7W7WP6H.mjs} +53 -3
  33. package/dist/cli.js +3495 -1849
  34. package/dist/edge-light.d.mts +1 -1
  35. package/dist/edge-light.d.ts +1 -1
  36. package/dist/edge-light.js +2059 -161
  37. package/dist/edge-light.mjs +4851 -2953
  38. package/dist/index.d.mts +88 -6
  39. package/dist/index.d.ts +88 -6
  40. package/dist/index.js +838 -27963
  41. package/dist/index.mjs +581 -27706
  42. package/dist/instrumentation/index.d.mts +75 -5
  43. package/dist/instrumentation/index.d.ts +75 -5
  44. package/dist/instrumentation/index.js +4578 -2937
  45. package/dist/instrumentation/index.mjs +4577 -2937
  46. package/dist/vitest-evals-reporter.d.mts +22 -0
  47. package/dist/vitest-evals-reporter.d.ts +22 -0
  48. package/dist/vitest-evals-reporter.js +401 -0
  49. package/dist/vitest-evals-reporter.mjs +401 -0
  50. package/dist/workerd.d.mts +1 -1
  51. package/dist/workerd.d.ts +1 -1
  52. package/dist/workerd.js +2059 -161
  53. package/dist/workerd.mjs +4851 -2953
  54. package/package.json +7 -1
@@ -6144,10 +6144,14 @@ interface InstrumentationIntegrationsConfig {
6144
6144
  mistral?: boolean;
6145
6145
  cohere?: boolean;
6146
6146
  groq?: boolean;
6147
+ bedrock?: boolean;
6148
+ awsBedrock?: boolean;
6149
+ awsBedrockRuntime?: boolean;
6147
6150
  genkit?: boolean;
6148
6151
  gitHubCopilot?: boolean;
6149
6152
  openaiCodexSDK?: boolean;
6150
6153
  piCodingAgent?: boolean;
6154
+ strandsAgentSDK?: boolean;
6151
6155
  langchain?: boolean;
6152
6156
  langgraph?: boolean;
6153
6157
  }
@@ -6196,11 +6200,13 @@ declare class BraintrustPlugin extends BasePlugin {
6196
6200
  private googleADKPlugin;
6197
6201
  private coherePlugin;
6198
6202
  private groqPlugin;
6203
+ private bedrockRuntimePlugin;
6199
6204
  private genkitPlugin;
6200
6205
  private gitHubCopilotPlugin;
6201
6206
  private fluePlugin;
6202
6207
  private langChainPlugin;
6203
6208
  private piCodingAgentPlugin;
6209
+ private strandsAgentSDKPlugin;
6204
6210
  constructor(config?: BraintrustPluginConfig);
6205
6211
  protected onEnable(): void;
6206
6212
  protected onDisable(): void;
@@ -8168,15 +8174,79 @@ declare class OpenAIAgentsTraceProcessor {
8168
8174
  private omitKeys;
8169
8175
  }
8170
8176
 
8177
+ /**
8178
+ * Vendored types for @flue/runtime observe/instrument-based instrumentation.
8179
+ *
8180
+ * Keep this surface intentionally narrow. These types are not exported to SDK
8181
+ * users and should only cover fields we read, correlate, or log.
8182
+ */
8183
+ type FlueOperationKind = "prompt" | "skill" | "task" | "compact";
8184
+ interface FlueContext {
8185
+ readonly id?: string;
8186
+ readonly runId?: string;
8187
+ }
8188
+ type FlueExecutionOperation = {
8189
+ type: "workflow";
8190
+ runId: string;
8191
+ workflowName: string;
8192
+ phase: "start" | "resume";
8193
+ startedAt: string;
8194
+ } | {
8195
+ type: "agent";
8196
+ operationId: string;
8197
+ operationKind: FlueOperationKind;
8198
+ } | {
8199
+ type: "model";
8200
+ turnId: string;
8201
+ } | {
8202
+ type: "tool";
8203
+ toolCallId: string;
8204
+ toolName: string;
8205
+ } | {
8206
+ type: "task";
8207
+ taskId: string;
8208
+ };
8209
+ interface FlueTraceCarrier {
8210
+ traceparent: string;
8211
+ tracestate?: string;
8212
+ }
8213
+ interface FlueExecutionContext {
8214
+ eventContext?: FlueContext;
8215
+ runId?: string;
8216
+ instanceId?: string;
8217
+ submissionId?: string;
8218
+ dispatchId?: string;
8219
+ agentName?: string;
8220
+ conversationId?: string;
8221
+ harness?: string;
8222
+ session?: string;
8223
+ operationId?: string;
8224
+ turnId?: string;
8225
+ taskId?: string;
8226
+ traceCarrier?: FlueTraceCarrier;
8227
+ }
8228
+ type FlueExecutionInterceptor = <T>(operation: FlueExecutionOperation, ctx: FlueExecutionContext, next: () => Promise<T>) => Promise<T>;
8229
+ interface FlueInstrumentation {
8230
+ key?: symbol;
8231
+ observe(event: unknown, ctx?: unknown): void | Promise<void>;
8232
+ interceptor: FlueExecutionInterceptor;
8233
+ dispose(): void | Promise<void>;
8234
+ }
8235
+
8171
8236
  type FlueObserver = (event: unknown, ctx?: unknown) => void;
8237
+ type BraintrustFlueObserver = FlueObserver & FlueInstrumentation;
8172
8238
  /**
8173
- * Braintrust's Flue observe subscriber.
8239
+ * Manual instrumentation for flue.
8174
8240
  *
8175
- * Pass this directly to @flue/runtime/app.observe:
8241
+ * This should be passed to flue's `instrument()` API if not using auto-instrumentation: `instrument(braintrustFlueInstrumentation())`
8242
+ */
8243
+ declare function braintrustFlueInstrumentation(): FlueInstrumentation;
8244
+ /**
8245
+ * Observer for flue pre version 1.0.0.
8176
8246
  *
8177
- * const unsubscribe = observe(braintrustFlueObserver);
8247
+ * This observer should be passed to flue's `observe()` API if not using auto-instrumentation.
8178
8248
  */
8179
- declare const braintrustFlueObserver: FlueObserver;
8249
+ declare const braintrustFlueObserver: BraintrustFlueObserver;
8180
8250
 
8181
8251
  /**
8182
8252
  * Plugin registry and configuration for auto-instrumentation.
@@ -8214,4 +8284,4 @@ declare const braintrustFlueObserver: FlueObserver;
8214
8284
  */
8215
8285
  declare function configureInstrumentation(config: InstrumentationConfig): void;
8216
8286
 
8217
- export { type AsyncEndEvent, type AsyncStartEvent, type BaseContext, BasePlugin, BraintrustPlugin, type BraintrustPluginConfig, type ChannelHandlers, type EndEvent, type ErrorEvent, type InstrumentationConfig, OpenAIAgentsTraceProcessor, type OpenAIAgentsTraceProcessorOptions, type StartEvent, braintrustFlueObserver, configureInstrumentation, createChannelName, isValidChannelName, parseChannelName };
8287
+ export { type AsyncEndEvent, type AsyncStartEvent, type BaseContext, BasePlugin, BraintrustPlugin, type BraintrustPluginConfig, type ChannelHandlers, type EndEvent, type ErrorEvent, type InstrumentationConfig, OpenAIAgentsTraceProcessor, type OpenAIAgentsTraceProcessorOptions, type StartEvent, braintrustFlueInstrumentation, braintrustFlueObserver, configureInstrumentation, createChannelName, isValidChannelName, parseChannelName };
@@ -6144,10 +6144,14 @@ interface InstrumentationIntegrationsConfig {
6144
6144
  mistral?: boolean;
6145
6145
  cohere?: boolean;
6146
6146
  groq?: boolean;
6147
+ bedrock?: boolean;
6148
+ awsBedrock?: boolean;
6149
+ awsBedrockRuntime?: boolean;
6147
6150
  genkit?: boolean;
6148
6151
  gitHubCopilot?: boolean;
6149
6152
  openaiCodexSDK?: boolean;
6150
6153
  piCodingAgent?: boolean;
6154
+ strandsAgentSDK?: boolean;
6151
6155
  langchain?: boolean;
6152
6156
  langgraph?: boolean;
6153
6157
  }
@@ -6196,11 +6200,13 @@ declare class BraintrustPlugin extends BasePlugin {
6196
6200
  private googleADKPlugin;
6197
6201
  private coherePlugin;
6198
6202
  private groqPlugin;
6203
+ private bedrockRuntimePlugin;
6199
6204
  private genkitPlugin;
6200
6205
  private gitHubCopilotPlugin;
6201
6206
  private fluePlugin;
6202
6207
  private langChainPlugin;
6203
6208
  private piCodingAgentPlugin;
6209
+ private strandsAgentSDKPlugin;
6204
6210
  constructor(config?: BraintrustPluginConfig);
6205
6211
  protected onEnable(): void;
6206
6212
  protected onDisable(): void;
@@ -8168,15 +8174,79 @@ declare class OpenAIAgentsTraceProcessor {
8168
8174
  private omitKeys;
8169
8175
  }
8170
8176
 
8177
+ /**
8178
+ * Vendored types for @flue/runtime observe/instrument-based instrumentation.
8179
+ *
8180
+ * Keep this surface intentionally narrow. These types are not exported to SDK
8181
+ * users and should only cover fields we read, correlate, or log.
8182
+ */
8183
+ type FlueOperationKind = "prompt" | "skill" | "task" | "compact";
8184
+ interface FlueContext {
8185
+ readonly id?: string;
8186
+ readonly runId?: string;
8187
+ }
8188
+ type FlueExecutionOperation = {
8189
+ type: "workflow";
8190
+ runId: string;
8191
+ workflowName: string;
8192
+ phase: "start" | "resume";
8193
+ startedAt: string;
8194
+ } | {
8195
+ type: "agent";
8196
+ operationId: string;
8197
+ operationKind: FlueOperationKind;
8198
+ } | {
8199
+ type: "model";
8200
+ turnId: string;
8201
+ } | {
8202
+ type: "tool";
8203
+ toolCallId: string;
8204
+ toolName: string;
8205
+ } | {
8206
+ type: "task";
8207
+ taskId: string;
8208
+ };
8209
+ interface FlueTraceCarrier {
8210
+ traceparent: string;
8211
+ tracestate?: string;
8212
+ }
8213
+ interface FlueExecutionContext {
8214
+ eventContext?: FlueContext;
8215
+ runId?: string;
8216
+ instanceId?: string;
8217
+ submissionId?: string;
8218
+ dispatchId?: string;
8219
+ agentName?: string;
8220
+ conversationId?: string;
8221
+ harness?: string;
8222
+ session?: string;
8223
+ operationId?: string;
8224
+ turnId?: string;
8225
+ taskId?: string;
8226
+ traceCarrier?: FlueTraceCarrier;
8227
+ }
8228
+ type FlueExecutionInterceptor = <T>(operation: FlueExecutionOperation, ctx: FlueExecutionContext, next: () => Promise<T>) => Promise<T>;
8229
+ interface FlueInstrumentation {
8230
+ key?: symbol;
8231
+ observe(event: unknown, ctx?: unknown): void | Promise<void>;
8232
+ interceptor: FlueExecutionInterceptor;
8233
+ dispose(): void | Promise<void>;
8234
+ }
8235
+
8171
8236
  type FlueObserver = (event: unknown, ctx?: unknown) => void;
8237
+ type BraintrustFlueObserver = FlueObserver & FlueInstrumentation;
8172
8238
  /**
8173
- * Braintrust's Flue observe subscriber.
8239
+ * Manual instrumentation for flue.
8174
8240
  *
8175
- * Pass this directly to @flue/runtime/app.observe:
8241
+ * This should be passed to flue's `instrument()` API if not using auto-instrumentation: `instrument(braintrustFlueInstrumentation())`
8242
+ */
8243
+ declare function braintrustFlueInstrumentation(): FlueInstrumentation;
8244
+ /**
8245
+ * Observer for flue pre version 1.0.0.
8176
8246
  *
8177
- * const unsubscribe = observe(braintrustFlueObserver);
8247
+ * This observer should be passed to flue's `observe()` API if not using auto-instrumentation.
8178
8248
  */
8179
- declare const braintrustFlueObserver: FlueObserver;
8249
+ declare const braintrustFlueObserver: BraintrustFlueObserver;
8180
8250
 
8181
8251
  /**
8182
8252
  * Plugin registry and configuration for auto-instrumentation.
@@ -8214,4 +8284,4 @@ declare const braintrustFlueObserver: FlueObserver;
8214
8284
  */
8215
8285
  declare function configureInstrumentation(config: InstrumentationConfig): void;
8216
8286
 
8217
- export { type AsyncEndEvent, type AsyncStartEvent, type BaseContext, BasePlugin, BraintrustPlugin, type BraintrustPluginConfig, type ChannelHandlers, type EndEvent, type ErrorEvent, type InstrumentationConfig, OpenAIAgentsTraceProcessor, type OpenAIAgentsTraceProcessorOptions, type StartEvent, braintrustFlueObserver, configureInstrumentation, createChannelName, isValidChannelName, parseChannelName };
8287
+ export { type AsyncEndEvent, type AsyncStartEvent, type BaseContext, BasePlugin, BraintrustPlugin, type BraintrustPluginConfig, type ChannelHandlers, type EndEvent, type ErrorEvent, type InstrumentationConfig, OpenAIAgentsTraceProcessor, type OpenAIAgentsTraceProcessorOptions, type StartEvent, braintrustFlueInstrumentation, braintrustFlueObserver, configureInstrumentation, createChannelName, isValidChannelName, parseChannelName };