braintrust 3.28.0 → 3.29.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 (50) hide show
  1. package/README.md +1 -1
  2. package/dev/dist/index.d.mts +356 -7
  3. package/dev/dist/index.d.ts +356 -7
  4. package/dev/dist/index.js +1815 -1548
  5. package/dev/dist/index.mjs +1054 -787
  6. package/dist/apply-auto-instrumentation.js +297 -264
  7. package/dist/apply-auto-instrumentation.mjs +84 -51
  8. package/dist/auto-instrumentations/bundler/esbuild.cjs +43 -5
  9. package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
  10. package/dist/auto-instrumentations/bundler/next.cjs +43 -5
  11. package/dist/auto-instrumentations/bundler/next.mjs +3 -3
  12. package/dist/auto-instrumentations/bundler/rollup.cjs +43 -5
  13. package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
  14. package/dist/auto-instrumentations/bundler/vite.cjs +43 -5
  15. package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
  16. package/dist/auto-instrumentations/bundler/webpack-loader.cjs +43 -5
  17. package/dist/auto-instrumentations/bundler/webpack.cjs +43 -5
  18. package/dist/auto-instrumentations/bundler/webpack.mjs +3 -3
  19. package/dist/auto-instrumentations/{chunk-NP7V4XB2.mjs → chunk-AOIYCVEL.mjs} +32 -2
  20. package/dist/auto-instrumentations/{chunk-26PKVUKB.mjs → chunk-DKTGDNA7.mjs} +12 -4
  21. package/dist/auto-instrumentations/{chunk-HD35AM3M.mjs → chunk-OMCZ3MV2.mjs} +1 -1
  22. package/dist/auto-instrumentations/hook.mjs +952 -133
  23. package/dist/auto-instrumentations/index.cjs +32 -2
  24. package/dist/auto-instrumentations/index.mjs +1 -1
  25. package/dist/browser.d.mts +760 -22
  26. package/dist/browser.d.ts +760 -22
  27. package/dist/browser.js +1661 -848
  28. package/dist/browser.mjs +1661 -848
  29. package/dist/{chunk-BBE7SNRV.js → chunk-6Z5S7VOU.js} +143 -23
  30. package/dist/{chunk-ZHUHZWFY.mjs → chunk-7FA6VP2S.mjs} +140 -20
  31. package/dist/{chunk-UPFNQCGB.mjs → chunk-M6XPNJC4.mjs} +1144 -931
  32. package/dist/{chunk-OBBWQW6K.js → chunk-XLLGRXGR.js} +2335 -2122
  33. package/dist/cli.js +5134 -1090
  34. package/dist/edge-light.js +1661 -848
  35. package/dist/edge-light.mjs +1661 -848
  36. package/dist/index.d.mts +760 -22
  37. package/dist/index.d.ts +760 -22
  38. package/dist/index.js +1054 -567
  39. package/dist/index.mjs +514 -27
  40. package/dist/instrumentation/index.d.mts +548 -9
  41. package/dist/instrumentation/index.d.ts +548 -9
  42. package/dist/instrumentation/index.js +1975 -765
  43. package/dist/instrumentation/index.mjs +1975 -765
  44. package/dist/vitest-evals-reporter.js +16 -16
  45. package/dist/vitest-evals-reporter.mjs +2 -2
  46. package/dist/workerd.js +1661 -848
  47. package/dist/workerd.mjs +1661 -848
  48. package/package.json +1 -1
  49. package/util/dist/index.d.mts +42 -0
  50. package/util/dist/index.d.ts +42 -0
package/dist/index.d.mts CHANGED
@@ -10044,6 +10044,15 @@ declare const PromptData: z.ZodObject<{
10044
10044
  type: "global";
10045
10045
  name: string;
10046
10046
  function_type?: "preprocessor" | undefined;
10047
+ }>, z.ZodObject<{
10048
+ type: z.ZodLiteral<"inline">;
10049
+ code: z.ZodString;
10050
+ }, "strip", z.ZodTypeAny, {
10051
+ code: string;
10052
+ type: "inline";
10053
+ }, {
10054
+ code: string;
10055
+ type: "inline";
10047
10056
  }>, z.ZodNull]>>;
10048
10057
  tool_functions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
10049
10058
  type: z.ZodLiteral<"function">;
@@ -10354,6 +10363,9 @@ declare const PromptData: z.ZodObject<{
10354
10363
  type: "global";
10355
10364
  name: string;
10356
10365
  function_type: "preprocessor";
10366
+ } | {
10367
+ code: string;
10368
+ type: "inline";
10357
10369
  } | null | undefined;
10358
10370
  origin?: {
10359
10371
  project_id?: string | undefined;
@@ -10628,6 +10640,9 @@ declare const PromptData: z.ZodObject<{
10628
10640
  type: "global";
10629
10641
  name: string;
10630
10642
  function_type?: "preprocessor" | undefined;
10643
+ } | {
10644
+ code: string;
10645
+ type: "inline";
10631
10646
  } | null | undefined;
10632
10647
  origin?: {
10633
10648
  project_id?: string | undefined;
@@ -12103,6 +12118,15 @@ declare const FunctionId: z.ZodUnion<[z.ZodObject<{
12103
12118
  type: "global";
12104
12119
  name: string;
12105
12120
  function_type?: "preprocessor" | undefined;
12121
+ }>, z.ZodObject<{
12122
+ type: z.ZodLiteral<"inline">;
12123
+ code: z.ZodString;
12124
+ }, "strip", z.ZodTypeAny, {
12125
+ code: string;
12126
+ type: "inline";
12127
+ }, {
12128
+ code: string;
12129
+ type: "inline";
12106
12130
  }>, z.ZodNull]>>;
12107
12131
  tool_functions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
12108
12132
  type: z.ZodLiteral<"function">;
@@ -12413,6 +12437,9 @@ declare const FunctionId: z.ZodUnion<[z.ZodObject<{
12413
12437
  type: "global";
12414
12438
  name: string;
12415
12439
  function_type: "preprocessor";
12440
+ } | {
12441
+ code: string;
12442
+ type: "inline";
12416
12443
  } | null | undefined;
12417
12444
  origin?: {
12418
12445
  project_id?: string | undefined;
@@ -12687,6 +12714,9 @@ declare const FunctionId: z.ZodUnion<[z.ZodObject<{
12687
12714
  type: "global";
12688
12715
  name: string;
12689
12716
  function_type?: "preprocessor" | undefined;
12717
+ } | {
12718
+ code: string;
12719
+ type: "inline";
12690
12720
  } | null | undefined;
12691
12721
  origin?: {
12692
12722
  project_id?: string | undefined;
@@ -12971,6 +13001,9 @@ declare const FunctionId: z.ZodUnion<[z.ZodObject<{
12971
13001
  type: "global";
12972
13002
  name: string;
12973
13003
  function_type: "preprocessor";
13004
+ } | {
13005
+ code: string;
13006
+ type: "inline";
12974
13007
  } | null | undefined;
12975
13008
  origin?: {
12976
13009
  project_id?: string | undefined;
@@ -13252,6 +13285,9 @@ declare const FunctionId: z.ZodUnion<[z.ZodObject<{
13252
13285
  type: "global";
13253
13286
  name: string;
13254
13287
  function_type?: "preprocessor" | undefined;
13288
+ } | {
13289
+ code: string;
13290
+ type: "inline";
13255
13291
  } | null | undefined;
13256
13292
  origin?: {
13257
13293
  project_id?: string | undefined;
@@ -14654,6 +14690,15 @@ declare const FunctionId: z.ZodUnion<[z.ZodObject<{
14654
14690
  type: "global";
14655
14691
  name: string;
14656
14692
  function_type?: "preprocessor" | undefined;
14693
+ }>, z.ZodObject<{
14694
+ type: z.ZodLiteral<"inline">;
14695
+ code: z.ZodString;
14696
+ }, "strip", z.ZodTypeAny, {
14697
+ code: string;
14698
+ type: "inline";
14699
+ }, {
14700
+ code: string;
14701
+ type: "inline";
14657
14702
  }>, z.ZodNull]>>;
14658
14703
  tool_functions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
14659
14704
  type: z.ZodLiteral<"function">;
@@ -14964,6 +15009,9 @@ declare const FunctionId: z.ZodUnion<[z.ZodObject<{
14964
15009
  type: "global";
14965
15010
  name: string;
14966
15011
  function_type: "preprocessor";
15012
+ } | {
15013
+ code: string;
15014
+ type: "inline";
14967
15015
  } | null | undefined;
14968
15016
  origin?: {
14969
15017
  project_id?: string | undefined;
@@ -15238,6 +15286,9 @@ declare const FunctionId: z.ZodUnion<[z.ZodObject<{
15238
15286
  type: "global";
15239
15287
  name: string;
15240
15288
  function_type?: "preprocessor" | undefined;
15289
+ } | {
15290
+ code: string;
15291
+ type: "inline";
15241
15292
  } | null | undefined;
15242
15293
  origin?: {
15243
15294
  project_id?: string | undefined;
@@ -15517,6 +15568,9 @@ declare const FunctionId: z.ZodUnion<[z.ZodObject<{
15517
15568
  type: "global";
15518
15569
  name: string;
15519
15570
  function_type: "preprocessor";
15571
+ } | {
15572
+ code: string;
15573
+ type: "inline";
15520
15574
  } | null | undefined;
15521
15575
  origin?: {
15522
15576
  project_id?: string | undefined;
@@ -15794,6 +15848,9 @@ declare const FunctionId: z.ZodUnion<[z.ZodObject<{
15794
15848
  type: "global";
15795
15849
  name: string;
15796
15850
  function_type?: "preprocessor" | undefined;
15851
+ } | {
15852
+ code: string;
15853
+ type: "inline";
15797
15854
  } | null | undefined;
15798
15855
  origin?: {
15799
15856
  project_id?: string | undefined;
@@ -17244,6 +17301,15 @@ declare const Prompt$1: z.ZodObject<{
17244
17301
  type: "global";
17245
17302
  name: string;
17246
17303
  function_type?: "preprocessor" | undefined;
17304
+ }>, z.ZodObject<{
17305
+ type: z.ZodLiteral<"inline">;
17306
+ code: z.ZodString;
17307
+ }, "strip", z.ZodTypeAny, {
17308
+ code: string;
17309
+ type: "inline";
17310
+ }, {
17311
+ code: string;
17312
+ type: "inline";
17247
17313
  }>, z.ZodNull]>>;
17248
17314
  tool_functions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
17249
17315
  type: z.ZodLiteral<"function">;
@@ -17554,6 +17620,9 @@ declare const Prompt$1: z.ZodObject<{
17554
17620
  type: "global";
17555
17621
  name: string;
17556
17622
  function_type: "preprocessor";
17623
+ } | {
17624
+ code: string;
17625
+ type: "inline";
17557
17626
  } | null | undefined;
17558
17627
  origin?: {
17559
17628
  project_id?: string | undefined;
@@ -17828,6 +17897,9 @@ declare const Prompt$1: z.ZodObject<{
17828
17897
  type: "global";
17829
17898
  name: string;
17830
17899
  function_type?: "preprocessor" | undefined;
17900
+ } | {
17901
+ code: string;
17902
+ type: "inline";
17831
17903
  } | null | undefined;
17832
17904
  origin?: {
17833
17905
  project_id?: string | undefined;
@@ -18119,6 +18191,9 @@ declare const Prompt$1: z.ZodObject<{
18119
18191
  type: "global";
18120
18192
  name: string;
18121
18193
  function_type: "preprocessor";
18194
+ } | {
18195
+ code: string;
18196
+ type: "inline";
18122
18197
  } | null | undefined;
18123
18198
  origin?: {
18124
18199
  project_id?: string | undefined;
@@ -18407,6 +18482,9 @@ declare const Prompt$1: z.ZodObject<{
18407
18482
  type: "global";
18408
18483
  name: string;
18409
18484
  function_type?: "preprocessor" | undefined;
18485
+ } | {
18486
+ code: string;
18487
+ type: "inline";
18410
18488
  } | null | undefined;
18411
18489
  origin?: {
18412
18490
  project_id?: string | undefined;
@@ -18671,7 +18749,6 @@ declare const registerTemplatePlugin: (plugin: TemplateRendererPlugin) => void;
18671
18749
  declare const getTemplateRenderer: (name: string) => TemplateRenderer | undefined;
18672
18750
 
18673
18751
  interface GlobalHookAsyncLocalStorage<T> {
18674
- enterWith(store: T): void;
18675
18752
  run<R>(store: T | undefined, callback: () => R): R;
18676
18753
  getStore(): T | undefined;
18677
18754
  }
@@ -18930,6 +19007,14 @@ interface PromptKey {
18930
19007
  */
18931
19008
  id?: string;
18932
19009
  }
19010
+ type PromptMemoryCacheEntry = {
19011
+ value: Prompt;
19012
+ resolvedOrgIdentity?: string;
19013
+ };
19014
+ type PromptDiskCacheEntry = {
19015
+ value: ReturnType<Prompt["_internalSerializeForCache"]>;
19016
+ resolvedOrgIdentity?: string;
19017
+ };
18933
19018
  /**
18934
19019
  * A configurable cache for Braintrust prompts with optional in-memory and filesystem storage.
18935
19020
  *
@@ -18938,10 +19023,19 @@ interface PromptKey {
18938
19023
  declare class PromptCache {
18939
19024
  private readonly memoryCache?;
18940
19025
  private readonly diskCache?;
19026
+ private readonly namespace?;
19027
+ private readonly expectedResolvedOrgIdentity?;
18941
19028
  constructor(options: {
18942
- memoryCache?: LRUCache<string, Prompt>;
18943
- diskCache?: DiskCache<Prompt>;
19029
+ memoryCache?: LRUCache<string, PromptMemoryCacheEntry>;
19030
+ diskCache?: DiskCache<PromptDiskCacheEntry>;
19031
+ namespace?: string;
19032
+ expectedResolvedOrgIdentity?: string;
18944
19033
  });
19034
+ /**
19035
+ * Returns a cache view that shares the same storage layers but isolates all
19036
+ * entries under the provided namespace.
19037
+ */
19038
+ withNamespace(namespace: string, expectedResolvedOrgIdentity?: string): PromptCache;
18945
19039
  /**
18946
19040
  * Retrieves a prompt from the cache.
18947
19041
  * First checks the in-memory LRU cache, then falls back to checking the disk cache if available.
@@ -18965,13 +19059,26 @@ interface ParametersKey {
18965
19059
  projectName?: string;
18966
19060
  id?: string;
18967
19061
  }
19062
+ type ParametersMemoryCacheEntry = {
19063
+ value: RemoteEvalParameters;
19064
+ resolvedOrgIdentity?: string;
19065
+ };
19066
+ type ParametersDiskCacheEntry = {
19067
+ value: ReturnType<RemoteEvalParameters["_internalSerializeForCache"]>;
19068
+ resolvedOrgIdentity?: string;
19069
+ };
18968
19070
  declare class ParametersCache {
18969
19071
  private readonly memoryCache?;
18970
19072
  private readonly diskCache?;
19073
+ private readonly namespace?;
19074
+ private readonly expectedResolvedOrgIdentity?;
18971
19075
  constructor(options: {
18972
- memoryCache?: LRUCache<string, RemoteEvalParameters>;
18973
- diskCache?: DiskCache<RemoteEvalParameters>;
19076
+ memoryCache?: LRUCache<string, ParametersMemoryCacheEntry>;
19077
+ diskCache?: DiskCache<ParametersDiskCacheEntry>;
19078
+ namespace?: string;
19079
+ expectedResolvedOrgIdentity?: string;
18974
19080
  });
19081
+ withNamespace(namespace: string, expectedResolvedOrgIdentity?: string): ParametersCache;
18975
19082
  get(key: ParametersKey): Promise<RemoteEvalParameters | undefined>;
18976
19083
  set(key: ParametersKey, value: RemoteEvalParameters): Promise<void>;
18977
19084
  }
@@ -21373,8 +21480,17 @@ declare const loginSchema: z.ZodObject<{
21373
21480
  debugLogLevelDisabled?: boolean | undefined;
21374
21481
  }>;
21375
21482
  type SerializedBraintrustState = z.infer<typeof loginSchema>;
21483
+ type ResolvedLoaderLoginOptions = Required<Pick<LoginOptions, "apiKey" | "appUrl" | "fetch">> & Pick<LoginOptions, "orgName"> & {
21484
+ forceLogin?: boolean;
21485
+ credentialCacheNamespace: string;
21486
+ existingState?: BraintrustState;
21487
+ };
21488
+ type LoaderCacheViews = {
21489
+ promptCache: PromptCache;
21490
+ parametersCache: ParametersCache;
21491
+ };
21492
+ type LoaderRequestState = Pick<BraintrustState, "appUrl" | "orgId" | "apiConn">;
21376
21493
  declare class BraintrustState {
21377
- private loginParams;
21378
21494
  id: string;
21379
21495
  currentExperiment: Experiment | undefined;
21380
21496
  currentLogger: Logger<false> | undefined;
@@ -21405,12 +21521,23 @@ declare class BraintrustState {
21405
21521
  private _otelFlushCallback;
21406
21522
  spanOriginEnvironment: SpanOriginEnvironment | undefined;
21407
21523
  private traceContextSigningSecret;
21524
+ private loaderLoginCache;
21525
+ private readonly loginParams;
21526
+ private activeLoginOrgNameSelector;
21408
21527
  constructor(loginParams: LoginOptions);
21409
21528
  /** @internal */
21410
21529
  _internalSetTraceContextSigningSecret(secret: string | undefined): void;
21411
21530
  /** @internal */
21412
21531
  _internalGetTraceContextSigningSecret(): string | undefined;
21413
21532
  resetLoginInfo(): void;
21533
+ /** @internal */
21534
+ _internalResolveLoaderLoginOptions({ apiKey, appUrl, orgName, fetch, forceLogin, }: Pick<LoginOptions, "apiKey" | "appUrl" | "orgName" | "fetch"> & {
21535
+ forceLogin?: boolean;
21536
+ }): Promise<ResolvedLoaderLoginOptions>;
21537
+ /** @internal */
21538
+ _internalGetLoaderCacheViews(loginOptions: ResolvedLoaderLoginOptions, requestState?: LoaderRequestState): LoaderCacheViews;
21539
+ /** @internal */
21540
+ _internalGetLoaderState({ apiKey, appUrl, orgName, fetch, forceLogin, existingState, }: ResolvedLoaderLoginOptions): Promise<LoaderRequestState>;
21414
21541
  resetIdGenState(): void;
21415
21542
  [RESET_CONTEXT_MANAGER_STATE](): void;
21416
21543
  get idGenerator(): IDGenerator;
@@ -21480,14 +21607,16 @@ declare class FailedHTTPResponse extends Error {
21480
21607
  status: number;
21481
21608
  text: string;
21482
21609
  data: string;
21483
- constructor(status: number, text: string, data: string);
21610
+ readonly cause?: unknown;
21611
+ constructor(status: number, text: string, data: string, cause?: unknown);
21484
21612
  }
21485
21613
  declare class HTTPConnection {
21614
+ private readonly classifyTransportErrors;
21486
21615
  base_url: string;
21487
21616
  token: string | null;
21488
21617
  headers: Record<string, string>;
21489
21618
  fetch: typeof globalThis.fetch;
21490
- constructor(base_url: string, fetch: typeof globalThis.fetch);
21619
+ constructor(base_url: string, fetch: typeof globalThis.fetch, classifyTransportErrors?: boolean);
21491
21620
  setFetch(fetch: typeof globalThis.fetch): void;
21492
21621
  ping(): Promise<boolean>;
21493
21622
  make_long_lived(): void;
@@ -22141,6 +22270,7 @@ declare global {
22141
22270
  }
22142
22271
  type InitDatasetOptions<IsLegacyDataset extends boolean> = FullLoginOptions & {
22143
22272
  dataset?: string;
22273
+ datasetId?: string;
22144
22274
  description?: string;
22145
22275
  version?: string;
22146
22276
  environment?: string;
@@ -22154,22 +22284,23 @@ type FullInitDatasetOptions<IsLegacyDataset extends boolean> = {
22154
22284
  project?: string;
22155
22285
  } & InitDatasetOptions<IsLegacyDataset>;
22156
22286
  /**
22157
- * Create a new dataset in a specified project. If the project does not exist, it will be created.
22287
+ * Initialize a dataset by name or ID. When initializing by name, the dataset and its project will be created if they do not exist.
22158
22288
  *
22159
22289
  * @param options Options for configuring initDataset().
22160
- * @param options.project The name of the project to create the dataset in. Must specify at least one of `project` or `projectId`.
22161
- * @param options.dataset The name of the dataset to create. If not specified, a name will be generated automatically.
22162
- * @param options.description An optional description of the dataset.
22290
+ * @param options.project The name of the project to create the dataset in. Must specify at least one of `project` or `projectId` unless `datasetId` is provided.
22291
+ * @param options.dataset The name of the dataset to create. If not specified, a name will be generated automatically. Ignored if `datasetId` is provided.
22292
+ * @param options.datasetId The ID of an existing dataset. Takes precedence over `dataset` and does not require `project` or `projectId`.
22293
+ * @param options.description An optional description when initializing a dataset by name. Cannot be used with `datasetId`.
22163
22294
  * @param options.version Pin the dataset to a specific version xact_id. If `snapshotName` or `environment` are also provided, `version` takes precedence.
22164
22295
  * @param options.snapshotName Pin the dataset to the version captured by this named snapshot. If `environment` is also provided, `snapshotName` takes precedence.
22165
22296
  * @param options.environment Pin the dataset to the version tagged with this environment slug.
22166
22297
  * @param options.appUrl The URL of the Braintrust App. Defaults to https://www.braintrust.dev.
22167
22298
  * @param options.apiKey The API key to use. If the parameter is not specified, will try to use the `BRAINTRUST_API_KEY` environment variable. In Node.js, if that is unset, will try the nearest `.env.braintrust` file in the current working directory or parent directories. If no API key is specified, will prompt the user to login.
22168
22299
  * @param options.orgName (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
22169
- * @param options.projectId The id of the project to create the dataset in. This takes precedence over `project` if specified.
22170
- * @param options.metadata A dictionary with additional data about the dataset. The values in `metadata` can be any JSON-serializable type, but its keys must be strings.
22300
+ * @param options.projectId The id of the project to create the dataset in. This takes precedence over `project` if specified and is not required when `datasetId` is provided.
22301
+ * @param options.metadata A dictionary with additional data when initializing a dataset by name. Cannot be used with `datasetId`. The values in `metadata` can be any JSON-serializable type, but its keys must be strings.
22171
22302
  * @param options.useOutput (Deprecated) If true, records will be fetched from this dataset in the legacy format, with the "expected" field renamed to "output". This option will be removed in a future version of Braintrust.
22172
- * @returns The newly created Dataset.
22303
+ * @returns The initialized Dataset.
22173
22304
  */
22174
22305
  declare function initDataset<IsLegacyDataset extends boolean = typeof DEFAULT_IS_LEGACY_DATASET>(options: Readonly<FullInitDatasetOptions<IsLegacyDataset>>): Dataset<IsLegacyDataset>;
22175
22306
  /**
@@ -22269,7 +22400,7 @@ type LoadParametersByProjectIdWithEnvOptions = LoadParametersBaseOptions & {
22269
22400
  * @param options.defaults (Optional) A dictionary of default values to use when rendering the prompt. Prompt values will override these defaults.
22270
22401
  * @param options.noTrace If true, do not include logging metadata for this prompt when build() is called.
22271
22402
  * @param options.appUrl The URL of the Braintrust App. Defaults to https://www.braintrust.dev.
22272
- * @param options.apiKey The API key to use. If the parameter is not specified, will try to use the `BRAINTRUST_API_KEY` environment variable. In Node.js,
22403
+ * @param options.apiKey The API key to use for this request, independently of any existing global login. If the parameter is not specified, will use an existing login or try the `BRAINTRUST_API_KEY` environment variable. In Node.js,
22273
22404
  * if that is unset, will try the nearest `.env.braintrust` file in the current working directory or parent directories. If no API key is specified, will prompt the user to login.
22274
22405
  * @param options.orgName (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
22275
22406
  * @returns The prompt object.
@@ -22296,7 +22427,7 @@ declare function loadPrompt({ projectName, projectId, slug, version, environment
22296
22427
  * @param options.environment Fetch the version of the parameters assigned to the specified environment (e.g. "production", "staging"). If both `version` and `environment` are provided, `version` takes precedence.
22297
22428
  * @param options.id The id of specific parameters to load. If specified, this takes precedence over all other parameters (project and slug).
22298
22429
  * @param options.appUrl The URL of the Braintrust App. Defaults to https://www.braintrust.dev.
22299
- * @param options.apiKey The API key to use. If the parameter is not specified, will try to use the `BRAINTRUST_API_KEY` environment variable. In Node.js, if that is unset, will try the nearest `.env.braintrust` file in the current working directory or parent directories.
22430
+ * @param options.apiKey The API key to use for this request, independently of any existing global login. If the parameter is not specified, will use an existing login or try the `BRAINTRUST_API_KEY` environment variable. In Node.js, if that is unset, will try the nearest `.env.braintrust` file in the current working directory or parent directories.
22300
22431
  * @param options.orgName (Optional) The name of a specific organization to connect to. This is useful if you belong to multiple.
22301
22432
  * @returns The parameters object.
22302
22433
  * @throws If the parameters are not found.
@@ -23075,6 +23206,251 @@ declare class Prompt<HasId extends boolean = true, HasVersion extends boolean =
23075
23206
  }): PromptBlockDataType;
23076
23207
  private getParsedPromptData;
23077
23208
  static isPrompt(data: unknown): data is Prompt<boolean, boolean>;
23209
+ /** @internal */
23210
+ _internalSerializeForCache(): {
23211
+ metadata: {
23212
+ _xact_id: string;
23213
+ created: string;
23214
+ id: string;
23215
+ prompt_session_id: string;
23216
+ project_id: string;
23217
+ function_data?: unknown;
23218
+ function_type?: "llm" | "scorer" | "task" | "tool" | "custom_view" | "preprocessor" | "facet" | "classifier" | "tag" | "parameters" | "sandbox" | null | undefined;
23219
+ tags?: string[] | null | undefined;
23220
+ _pagination_key?: string | null | undefined;
23221
+ completion?: unknown;
23222
+ prompt_data?: unknown;
23223
+ prompt_session_data?: unknown;
23224
+ object_data?: unknown;
23225
+ } | PromptRowWithId<HasId, HasVersion>;
23226
+ defaults: Partial<Omit<z.objectOutputType<{
23227
+ use_cache: z.ZodOptional<z.ZodBoolean>;
23228
+ reasoning_enabled: z.ZodOptional<z.ZodBoolean>;
23229
+ reasoning_budget: z.ZodOptional<z.ZodNumber>;
23230
+ temperature: z.ZodOptional<z.ZodNumber>;
23231
+ top_p: z.ZodOptional<z.ZodNumber>;
23232
+ max_tokens: z.ZodOptional<z.ZodNumber>;
23233
+ max_completion_tokens: z.ZodOptional<z.ZodNumber>;
23234
+ frequency_penalty: z.ZodOptional<z.ZodNumber>;
23235
+ presence_penalty: z.ZodOptional<z.ZodNumber>;
23236
+ response_format: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
23237
+ type: z.ZodLiteral<"json_object">;
23238
+ }, "strip", z.ZodTypeAny, {
23239
+ type: "json_object";
23240
+ }, {
23241
+ type: "json_object";
23242
+ }>, z.ZodObject<{
23243
+ type: z.ZodLiteral<"json_schema">;
23244
+ json_schema: z.ZodObject<{
23245
+ name: z.ZodString;
23246
+ description: z.ZodOptional<z.ZodString>;
23247
+ schema: z.ZodOptional<z.ZodUnion<[z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>, z.ZodString]>>;
23248
+ strict: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodNull]>>;
23249
+ }, "strip", z.ZodTypeAny, {
23250
+ name: string;
23251
+ description?: string | undefined;
23252
+ schema?: string | z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
23253
+ strict?: boolean | null | undefined;
23254
+ }, {
23255
+ name: string;
23256
+ description?: string | undefined;
23257
+ schema?: string | z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
23258
+ strict?: boolean | null | undefined;
23259
+ }>;
23260
+ }, "strip", z.ZodTypeAny, {
23261
+ type: "json_schema";
23262
+ json_schema: {
23263
+ name: string;
23264
+ description?: string | undefined;
23265
+ schema?: string | z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
23266
+ strict?: boolean | null | undefined;
23267
+ };
23268
+ }, {
23269
+ type: "json_schema";
23270
+ json_schema: {
23271
+ name: string;
23272
+ description?: string | undefined;
23273
+ schema?: string | z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
23274
+ strict?: boolean | null | undefined;
23275
+ };
23276
+ }>, z.ZodObject<{
23277
+ type: z.ZodLiteral<"text">;
23278
+ }, "strip", z.ZodTypeAny, {
23279
+ type: "text";
23280
+ }, {
23281
+ type: "text";
23282
+ }>, z.ZodNull]>>;
23283
+ tool_choice: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"auto">, z.ZodLiteral<"none">, z.ZodLiteral<"required">, z.ZodObject<{
23284
+ type: z.ZodLiteral<"function">;
23285
+ function: z.ZodObject<{
23286
+ name: z.ZodString;
23287
+ }, "strip", z.ZodTypeAny, {
23288
+ name: string;
23289
+ }, {
23290
+ name: string;
23291
+ }>;
23292
+ }, "strip", z.ZodTypeAny, {
23293
+ function: {
23294
+ name: string;
23295
+ };
23296
+ type: "function";
23297
+ }, {
23298
+ function: {
23299
+ name: string;
23300
+ };
23301
+ type: "function";
23302
+ }>]>>;
23303
+ function_call: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"auto">, z.ZodLiteral<"none">, z.ZodObject<{
23304
+ name: z.ZodString;
23305
+ }, "strip", z.ZodTypeAny, {
23306
+ name: string;
23307
+ }, {
23308
+ name: string;
23309
+ }>]>>;
23310
+ n: z.ZodOptional<z.ZodNumber>;
23311
+ stop: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
23312
+ reasoning_effort: z.ZodOptional<z.ZodEnum<["none", "minimal", "low", "medium", "high"]>>;
23313
+ verbosity: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
23314
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
23315
+ use_cache: z.ZodOptional<z.ZodBoolean>;
23316
+ reasoning_enabled: z.ZodOptional<z.ZodBoolean>;
23317
+ reasoning_budget: z.ZodOptional<z.ZodNumber>;
23318
+ max_tokens: z.ZodNumber;
23319
+ temperature: z.ZodNumber;
23320
+ top_p: z.ZodOptional<z.ZodNumber>;
23321
+ top_k: z.ZodOptional<z.ZodNumber>;
23322
+ stop_sequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
23323
+ max_tokens_to_sample: z.ZodOptional<z.ZodNumber>;
23324
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
23325
+ use_cache: z.ZodOptional<z.ZodBoolean>;
23326
+ reasoning_enabled: z.ZodOptional<z.ZodBoolean>;
23327
+ reasoning_budget: z.ZodOptional<z.ZodNumber>;
23328
+ temperature: z.ZodOptional<z.ZodNumber>;
23329
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
23330
+ topP: z.ZodOptional<z.ZodNumber>;
23331
+ topK: z.ZodOptional<z.ZodNumber>;
23332
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
23333
+ use_cache: z.ZodOptional<z.ZodBoolean>;
23334
+ reasoning_enabled: z.ZodOptional<z.ZodBoolean>;
23335
+ reasoning_budget: z.ZodOptional<z.ZodNumber>;
23336
+ temperature: z.ZodOptional<z.ZodNumber>;
23337
+ topK: z.ZodOptional<z.ZodNumber>;
23338
+ }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
23339
+ use_cache: z.ZodOptional<z.ZodBoolean>;
23340
+ reasoning_enabled: z.ZodOptional<z.ZodBoolean>;
23341
+ reasoning_budget: z.ZodOptional<z.ZodNumber>;
23342
+ }, z.ZodTypeAny, "passthrough"> | undefined, "response_format" | "reasoning_effort" | "use_cache"> & Omit<{
23343
+ max_tokens: number;
23344
+ temperature?: number | undefined;
23345
+ top_p?: number | undefined;
23346
+ max_completion_tokens?: number | undefined;
23347
+ frequency_penalty?: number | undefined;
23348
+ presence_penalty?: number | undefined;
23349
+ response_format?: {
23350
+ type: "json_object";
23351
+ } | {
23352
+ type: "json_schema";
23353
+ json_schema: {
23354
+ name: string;
23355
+ description?: string | undefined;
23356
+ schema?: string | z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
23357
+ strict?: boolean | null | undefined;
23358
+ };
23359
+ } | {
23360
+ type: "text";
23361
+ } | null | undefined;
23362
+ tool_choice?: "auto" | "none" | "required" | {
23363
+ function: {
23364
+ name: string;
23365
+ };
23366
+ type: "function";
23367
+ } | undefined;
23368
+ function_call?: "auto" | "none" | {
23369
+ name: string;
23370
+ } | undefined;
23371
+ n?: number | undefined;
23372
+ stop?: string[] | undefined;
23373
+ reasoning_effort?: "none" | "minimal" | "low" | "medium" | "high" | undefined;
23374
+ verbosity?: "low" | "medium" | "high" | undefined;
23375
+ top_k?: number | undefined;
23376
+ stop_sequences?: string[] | undefined;
23377
+ reasoning_enabled?: boolean | undefined;
23378
+ reasoning_budget?: number | undefined;
23379
+ max_tokens_to_sample?: number | undefined;
23380
+ maxOutputTokens?: number | undefined;
23381
+ topP?: number | undefined;
23382
+ topK?: number | undefined;
23383
+ use_cache?: boolean | undefined;
23384
+ }, "response_format" | "reasoning_effort" | "use_cache"> & {
23385
+ reasoning_effort?: CompiledPromptReasoningEffort;
23386
+ response_format?: {
23387
+ type: "json_object";
23388
+ } | {
23389
+ type: "text";
23390
+ } | (Omit<{
23391
+ type: "json_schema";
23392
+ json_schema: {
23393
+ name: string;
23394
+ description?: string | undefined;
23395
+ schema?: string | z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
23396
+ strict?: boolean | null | undefined;
23397
+ };
23398
+ }, "json_schema"> & {
23399
+ json_schema: Omit<{
23400
+ name: string;
23401
+ description?: string | undefined;
23402
+ schema?: string | z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
23403
+ strict?: boolean | null | undefined;
23404
+ }, "schema"> & {
23405
+ schema?: Record<string, unknown> | undefined;
23406
+ };
23407
+ }) | undefined;
23408
+ model: string;
23409
+ } & {
23410
+ max_tokens: number;
23411
+ temperature?: number | undefined;
23412
+ top_p?: number | undefined;
23413
+ max_completion_tokens?: number | undefined;
23414
+ frequency_penalty?: number | undefined;
23415
+ presence_penalty?: number | undefined;
23416
+ response_format?: {
23417
+ type: "json_object";
23418
+ } | {
23419
+ type: "json_schema";
23420
+ json_schema: {
23421
+ name: string;
23422
+ description?: string | undefined;
23423
+ schema?: string | z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
23424
+ strict?: boolean | null | undefined;
23425
+ };
23426
+ } | {
23427
+ type: "text";
23428
+ } | null | undefined;
23429
+ tool_choice?: "auto" | "none" | "required" | {
23430
+ function: {
23431
+ name: string;
23432
+ };
23433
+ type: "function";
23434
+ } | undefined;
23435
+ function_call?: "auto" | "none" | {
23436
+ name: string;
23437
+ } | undefined;
23438
+ n?: number | undefined;
23439
+ stop?: string[] | undefined;
23440
+ reasoning_effort?: "none" | "minimal" | "low" | "medium" | "high" | undefined;
23441
+ verbosity?: "low" | "medium" | "high" | undefined;
23442
+ top_k?: number | undefined;
23443
+ stop_sequences?: string[] | undefined;
23444
+ reasoning_enabled?: boolean | undefined;
23445
+ reasoning_budget?: number | undefined;
23446
+ max_tokens_to_sample?: number | undefined;
23447
+ maxOutputTokens?: number | undefined;
23448
+ topP?: number | undefined;
23449
+ topK?: number | undefined;
23450
+ use_cache?: boolean | undefined;
23451
+ } & ChatPrompt & CompletionPrompt>;
23452
+ noTrace: boolean;
23453
+ };
23078
23454
  static fromPromptData(name: string, promptData: PromptDataType): Prompt<false, false>;
23079
23455
  }
23080
23456
  declare class RemoteEvalParameters<HasId extends boolean = true, HasVersion extends boolean = true, T extends Record<string, unknown> = Record<string, unknown>> {
@@ -23088,6 +23464,24 @@ declare class RemoteEvalParameters<HasId extends boolean = true, HasVersion exte
23088
23464
  get version(): HasVersion extends true ? TransactionId : TransactionId | undefined;
23089
23465
  get schema(): Record<string, unknown>;
23090
23466
  get data(): T;
23467
+ /** @internal */
23468
+ _internalSerializeForCache(): {
23469
+ metadata: {
23470
+ _xact_id: string;
23471
+ id: string;
23472
+ project_id: string;
23473
+ function_data: {
23474
+ type: "parameters";
23475
+ __schema: Record<string, unknown>;
23476
+ data?: Record<string, unknown> | undefined;
23477
+ };
23478
+ name: string;
23479
+ slug: string;
23480
+ function_type: "parameters";
23481
+ description?: string | null | undefined;
23482
+ metadata?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | null | undefined;
23483
+ };
23484
+ };
23091
23485
  validate(data: unknown): boolean;
23092
23486
  static isParameters(x: unknown): x is RemoteEvalParameters<boolean, boolean, Record<string, unknown>>;
23093
23487
  }
@@ -23746,12 +24140,24 @@ interface OpenAIChatToolFunction {
23746
24140
  name?: string;
23747
24141
  [key: string]: unknown;
23748
24142
  }
24143
+ interface OpenAIChatToolFunctionDelta {
24144
+ arguments?: string;
24145
+ name?: string;
24146
+ [key: string]: unknown;
24147
+ }
23749
24148
  interface OpenAIChatToolCall {
23750
24149
  id?: string;
23751
24150
  type?: string;
23752
24151
  function: OpenAIChatToolFunction;
23753
24152
  [key: string]: unknown;
23754
24153
  }
24154
+ interface OpenAIChatToolCallDelta {
24155
+ index: number;
24156
+ id?: string;
24157
+ type?: string;
24158
+ function?: OpenAIChatToolFunctionDelta;
24159
+ [key: string]: unknown;
24160
+ }
23755
24161
  interface OpenAIChatMessage {
23756
24162
  role?: string;
23757
24163
  content?: unknown;
@@ -23787,11 +24193,12 @@ interface OpenAIChatDelta {
23787
24193
  role?: string;
23788
24194
  content?: string;
23789
24195
  refusal?: string;
23790
- tool_calls?: OpenAIChatToolCall[];
24196
+ tool_calls?: OpenAIChatToolCallDelta[];
23791
24197
  finish_reason?: string | null;
23792
24198
  [key: string]: unknown;
23793
24199
  }
23794
24200
  interface OpenAIChatChunkChoice {
24201
+ index: number;
23795
24202
  delta?: OpenAIChatDelta;
23796
24203
  finish_reason?: string | null;
23797
24204
  logprobs?: OpenAIChatLogprobs | null;
@@ -24348,7 +24755,7 @@ type EveModelMessage = EveSystemModelMessage | {
24348
24755
  readonly role: "tool";
24349
24756
  };
24350
24757
  interface EveInstrumentationModelInput {
24351
- readonly instructions?: string | readonly EveSystemModelMessage[];
24758
+ readonly instructions?: string | EveSystemModelMessage | readonly EveSystemModelMessage[];
24352
24759
  readonly messages: readonly EveModelMessage[];
24353
24760
  }
24354
24761
  interface EveInstrumentationStepStartedEventInput {
@@ -24377,6 +24784,183 @@ interface EveInstrumentationDefinition {
24377
24784
  readonly recordOutputs?: boolean;
24378
24785
  readonly setup?: (context: EveInstrumentationSetupContext) => void;
24379
24786
  }
24787
+ /**
24788
+ * Vendored types for Eve's instrumentation-provider API, introduced in
24789
+ * eve@0.34.0. Keep this limited to lifecycle events consumed by Braintrust.
24790
+ */
24791
+ interface EveProviderSetupContext {
24792
+ readonly agentName: string;
24793
+ readonly environment?: "development" | "preview" | "production";
24794
+ readonly evaluation?: {
24795
+ readonly runId: string;
24796
+ };
24797
+ readonly frameworkVersion?: string;
24798
+ }
24799
+ interface EveProviderState {
24800
+ get(): EveJsonValue | undefined;
24801
+ set(value: EveJsonValue | undefined): void;
24802
+ }
24803
+ interface EveProviderContext {
24804
+ readonly state: EveProviderState;
24805
+ }
24806
+ interface EveInstrumentationAttemptScope {
24807
+ readonly attemptId: string;
24808
+ readonly attemptIndex: number;
24809
+ readonly functionId?: string;
24810
+ readonly rootSessionId?: string;
24811
+ readonly sessionId: string;
24812
+ readonly stepIndex: number;
24813
+ readonly turnId: string;
24814
+ }
24815
+ interface EveInstrumentationParentLineage {
24816
+ readonly callId: string;
24817
+ readonly sessionId: string;
24818
+ readonly subagentName?: string;
24819
+ readonly turnId: string;
24820
+ }
24821
+ interface EveInstrumentationTraceContext {
24822
+ readonly isRemote?: boolean;
24823
+ readonly spanId: string;
24824
+ readonly traceFlags: number;
24825
+ readonly traceId: string;
24826
+ }
24827
+ interface EveProviderTurnStartedEvent {
24828
+ readonly idempotencyKey: string;
24829
+ readonly parentLineage?: EveInstrumentationParentLineage;
24830
+ readonly parentTraceContext?: EveInstrumentationTraceContext;
24831
+ readonly rootSessionId: string;
24832
+ readonly sequence: number;
24833
+ readonly sessionId: string;
24834
+ readonly turnId: string;
24835
+ readonly type: "turn.started";
24836
+ }
24837
+ type EveProviderTurnTerminalEvent = {
24838
+ readonly idempotencyKey: string;
24839
+ readonly sessionId: string;
24840
+ readonly turnId: string;
24841
+ readonly type: "turn.cancelled" | "turn.completed";
24842
+ } | {
24843
+ readonly error?: unknown;
24844
+ readonly idempotencyKey: string;
24845
+ readonly sessionId: string;
24846
+ readonly turnId: string;
24847
+ readonly type: "turn.failed";
24848
+ };
24849
+ interface EveProviderModelCallStartedEvent {
24850
+ readonly idempotencyKey: string;
24851
+ readonly input?: EveInstrumentationModelInput;
24852
+ readonly model: {
24853
+ readonly modelId: string;
24854
+ readonly provider: string;
24855
+ };
24856
+ readonly scope: EveInstrumentationAttemptScope;
24857
+ readonly type: "model.call.started";
24858
+ }
24859
+ type EveProviderContentPart = {
24860
+ readonly text: string;
24861
+ readonly type: "text";
24862
+ } | {
24863
+ readonly text: string;
24864
+ readonly type: "reasoning";
24865
+ } | {
24866
+ readonly callId: string;
24867
+ readonly input: unknown;
24868
+ readonly toolName: string;
24869
+ readonly type: "tool-call";
24870
+ } | {
24871
+ readonly callId: string;
24872
+ readonly input: unknown;
24873
+ readonly output: unknown;
24874
+ readonly toolName: string;
24875
+ readonly type: "tool-result";
24876
+ } | {
24877
+ readonly callId: string;
24878
+ readonly error: unknown;
24879
+ readonly input: unknown;
24880
+ readonly toolName: string;
24881
+ readonly type: "tool-error";
24882
+ };
24883
+ interface EveProviderUsage {
24884
+ readonly inputTokenDetails?: {
24885
+ readonly cacheReadTokens?: number;
24886
+ readonly cacheWriteTokens?: number;
24887
+ };
24888
+ readonly inputTokens?: number;
24889
+ readonly outputTokens?: number;
24890
+ }
24891
+ type EveProviderModelCallTerminalEvent = {
24892
+ readonly content?: readonly EveProviderContentPart[];
24893
+ readonly finishReason: string;
24894
+ readonly idempotencyKey: string;
24895
+ readonly scope: EveInstrumentationAttemptScope;
24896
+ readonly type: "model.call.completed";
24897
+ readonly usage: EveProviderUsage;
24898
+ } | {
24899
+ readonly error?: unknown;
24900
+ readonly idempotencyKey: string;
24901
+ readonly scope: EveInstrumentationAttemptScope;
24902
+ readonly type: "model.call.failed";
24903
+ };
24904
+ type EveProviderActionKind = "load-skill" | "remote-agent-call" | "subagent-call" | "tool-call";
24905
+ interface EveProviderActionStartedEvent {
24906
+ readonly callId: string;
24907
+ readonly idempotencyKey: string;
24908
+ readonly input?: unknown;
24909
+ readonly kind: EveProviderActionKind;
24910
+ readonly name: string;
24911
+ readonly scope: EveInstrumentationAttemptScope;
24912
+ readonly type: "action.started";
24913
+ }
24914
+ type EveProviderActionTerminalEvent = {
24915
+ readonly acceptedAtMs?: number;
24916
+ readonly idempotencyKey: string;
24917
+ readonly outcome: "completed";
24918
+ readonly output: {
24919
+ readonly output?: unknown;
24920
+ readonly type: "result";
24921
+ } | {
24922
+ readonly error?: unknown;
24923
+ readonly type: "error";
24924
+ };
24925
+ readonly scope: EveInstrumentationAttemptScope;
24926
+ readonly type: "action.completed";
24927
+ readonly usage?: EveProviderUsage;
24928
+ } | {
24929
+ readonly acceptedAtMs?: number;
24930
+ readonly error?: unknown;
24931
+ readonly errorCode?: string;
24932
+ readonly idempotencyKey: string;
24933
+ readonly outcome: "abandoned" | "cancelled" | "failed" | "rejected";
24934
+ readonly scope: EveInstrumentationAttemptScope;
24935
+ readonly type: "action.failed";
24936
+ };
24937
+ type EveProviderStepAttemptTerminalEvent = {
24938
+ readonly error?: unknown;
24939
+ readonly idempotencyKey: string;
24940
+ readonly scope: EveInstrumentationAttemptScope;
24941
+ readonly type: "step.attempt.completed" | "step.attempt.failed";
24942
+ };
24943
+ type EveProviderHandler<TEvent> = (event: TEvent, context: EveProviderContext) => void | PromiseLike<void>;
24944
+ interface EveProviderDefinition {
24945
+ readonly capture?: "content" | "metadata";
24946
+ readonly events?: {
24947
+ readonly "action.completed"?: EveProviderHandler<EveProviderActionTerminalEvent>;
24948
+ readonly "action.failed"?: EveProviderHandler<EveProviderActionTerminalEvent>;
24949
+ readonly "action.started"?: EveProviderHandler<EveProviderActionStartedEvent>;
24950
+ readonly "model.call.completed"?: EveProviderHandler<EveProviderModelCallTerminalEvent>;
24951
+ readonly "model.call.failed"?: EveProviderHandler<EveProviderModelCallTerminalEvent>;
24952
+ readonly "model.call.started"?: EveProviderHandler<EveProviderModelCallStartedEvent>;
24953
+ readonly "step.attempt.completed"?: EveProviderHandler<EveProviderStepAttemptTerminalEvent>;
24954
+ readonly "step.attempt.failed"?: EveProviderHandler<EveProviderStepAttemptTerminalEvent>;
24955
+ readonly "turn.cancelled"?: EveProviderHandler<EveProviderTurnTerminalEvent>;
24956
+ readonly "turn.completed"?: EveProviderHandler<EveProviderTurnTerminalEvent>;
24957
+ readonly "turn.failed"?: EveProviderHandler<EveProviderTurnTerminalEvent>;
24958
+ readonly "turn.started"?: EveProviderHandler<EveProviderTurnStartedEvent>;
24959
+ };
24960
+ readonly flush?: () => void | PromiseLike<void>;
24961
+ readonly setup?: (context: EveProviderSetupContext) => void | PromiseLike<void>;
24962
+ readonly shutdown?: () => void | PromiseLike<void>;
24963
+ }
24380
24964
 
24381
24965
  type EveStateHandle<T> = {
24382
24966
  get(): T;
@@ -24388,7 +24972,20 @@ declare function braintrustEveHook(options: {
24388
24972
  defineState: EveDefineState;
24389
24973
  metadata?: Record<string, unknown>;
24390
24974
  }): EveHookDefinition;
24391
- /** Eve instrumentation helper for logger setup and durable LLM input capture. */
24975
+
24976
+ type EveProviderInstrumentationOptions = {
24977
+ metadata?: Record<string, unknown>;
24978
+ setup?: EveProviderDefinition["setup"];
24979
+ };
24980
+ /**
24981
+ * Braintrust instrumentation for Eve.
24982
+ *
24983
+ * Pass `defineState` when using Eve's legacy authored instrumentation API.
24984
+ * With Eve 0.34+, omit `defineState` to use the instrumentation-provider
24985
+ * lifecycle and enable `experimental.instrumentationProviders` on the agent.
24986
+ * The result is ready to export directly from the instrumentation module.
24987
+ */
24988
+ declare function braintrustEveInstrumentation(options: EveProviderInstrumentationOptions): EveProviderDefinition;
24392
24989
  declare function braintrustEveInstrumentation(options: {
24393
24990
  defineState: EveDefineState;
24394
24991
  setup?: EveInstrumentationDefinition["setup"];
@@ -24593,8 +25190,8 @@ declare function wrapPiCodingAgentSDK<T>(sdk: T): T;
24593
25190
  declare function wrapCloudflareAgent<T>(Agent: T): T;
24594
25191
 
24595
25192
  /**
24596
- * Wraps the Strands Agent SDK with Braintrust tracing. The wrapper emits
24597
- * diagnostics-channel events; the Strands plugin owns span lifecycle.
25193
+ * Wraps the Strands Agent SDK with Braintrust tracing. The wrapper invokes
25194
+ * typed instrumentation channels; the Strands plugin owns span lifecycle.
24598
25195
  */
24599
25196
  declare function wrapStrandsAgentSDK<T>(sdk: T): T;
24600
25197
 
@@ -30292,6 +30889,15 @@ declare const evalParametersSerializedSchema: z.ZodRecord<z.ZodString, z.ZodUnio
30292
30889
  type: "global";
30293
30890
  name: string;
30294
30891
  function_type?: "preprocessor" | undefined;
30892
+ }>, z.ZodObject<{
30893
+ type: z.ZodLiteral<"inline">;
30894
+ code: z.ZodString;
30895
+ }, "strip", z.ZodTypeAny, {
30896
+ code: string;
30897
+ type: "inline";
30898
+ }, {
30899
+ code: string;
30900
+ type: "inline";
30295
30901
  }>, z.ZodNull]>>;
30296
30902
  tool_functions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
30297
30903
  type: z.ZodLiteral<"function">;
@@ -30602,6 +31208,9 @@ declare const evalParametersSerializedSchema: z.ZodRecord<z.ZodString, z.ZodUnio
30602
31208
  type: "global";
30603
31209
  name: string;
30604
31210
  function_type: "preprocessor";
31211
+ } | {
31212
+ code: string;
31213
+ type: "inline";
30605
31214
  } | null | undefined;
30606
31215
  origin?: {
30607
31216
  project_id?: string | undefined;
@@ -30876,6 +31485,9 @@ declare const evalParametersSerializedSchema: z.ZodRecord<z.ZodString, z.ZodUnio
30876
31485
  type: "global";
30877
31486
  name: string;
30878
31487
  function_type?: "preprocessor" | undefined;
31488
+ } | {
31489
+ code: string;
31490
+ type: "inline";
30879
31491
  } | null | undefined;
30880
31492
  origin?: {
30881
31493
  project_id?: string | undefined;
@@ -31155,6 +31767,9 @@ declare const evalParametersSerializedSchema: z.ZodRecord<z.ZodString, z.ZodUnio
31155
31767
  type: "global";
31156
31768
  name: string;
31157
31769
  function_type: "preprocessor";
31770
+ } | {
31771
+ code: string;
31772
+ type: "inline";
31158
31773
  } | null | undefined;
31159
31774
  origin?: {
31160
31775
  project_id?: string | undefined;
@@ -31433,6 +32048,9 @@ declare const evalParametersSerializedSchema: z.ZodRecord<z.ZodString, z.ZodUnio
31433
32048
  type: "global";
31434
32049
  name: string;
31435
32050
  function_type?: "preprocessor" | undefined;
32051
+ } | {
32052
+ code: string;
32053
+ type: "inline";
31436
32054
  } | null | undefined;
31437
32055
  origin?: {
31438
32056
  project_id?: string | undefined;
@@ -32955,6 +33573,15 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
32955
33573
  type: "global";
32956
33574
  name: string;
32957
33575
  function_type?: "preprocessor" | undefined;
33576
+ }>, z.ZodObject<{
33577
+ type: z.ZodLiteral<"inline">;
33578
+ code: z.ZodString;
33579
+ }, "strip", z.ZodTypeAny, {
33580
+ code: string;
33581
+ type: "inline";
33582
+ }, {
33583
+ code: string;
33584
+ type: "inline";
32958
33585
  }>, z.ZodNull]>>;
32959
33586
  tool_functions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
32960
33587
  type: z.ZodLiteral<"function">;
@@ -33265,6 +33892,9 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
33265
33892
  type: "global";
33266
33893
  name: string;
33267
33894
  function_type: "preprocessor";
33895
+ } | {
33896
+ code: string;
33897
+ type: "inline";
33268
33898
  } | null | undefined;
33269
33899
  origin?: {
33270
33900
  project_id?: string | undefined;
@@ -33539,6 +34169,9 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
33539
34169
  type: "global";
33540
34170
  name: string;
33541
34171
  function_type?: "preprocessor" | undefined;
34172
+ } | {
34173
+ code: string;
34174
+ type: "inline";
33542
34175
  } | null | undefined;
33543
34176
  origin?: {
33544
34177
  project_id?: string | undefined;
@@ -33818,6 +34451,9 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
33818
34451
  type: "global";
33819
34452
  name: string;
33820
34453
  function_type: "preprocessor";
34454
+ } | {
34455
+ code: string;
34456
+ type: "inline";
33821
34457
  } | null | undefined;
33822
34458
  origin?: {
33823
34459
  project_id?: string | undefined;
@@ -34096,6 +34732,9 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
34096
34732
  type: "global";
34097
34733
  name: string;
34098
34734
  function_type?: "preprocessor" | undefined;
34735
+ } | {
34736
+ code: string;
34737
+ type: "inline";
34099
34738
  } | null | undefined;
34100
34739
  origin?: {
34101
34740
  project_id?: string | undefined;
@@ -34405,6 +35044,9 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
34405
35044
  type: "global";
34406
35045
  name: string;
34407
35046
  function_type: "preprocessor";
35047
+ } | {
35048
+ code: string;
35049
+ type: "inline";
34408
35050
  } | null | undefined;
34409
35051
  origin?: {
34410
35052
  project_id?: string | undefined;
@@ -34696,6 +35338,9 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
34696
35338
  type: "global";
34697
35339
  name: string;
34698
35340
  function_type?: "preprocessor" | undefined;
35341
+ } | {
35342
+ code: string;
35343
+ type: "inline";
34699
35344
  } | null | undefined;
34700
35345
  origin?: {
34701
35346
  project_id?: string | undefined;
@@ -36110,6 +36755,15 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
36110
36755
  type: "global";
36111
36756
  name: string;
36112
36757
  function_type?: "preprocessor" | undefined;
36758
+ }>, z.ZodObject<{
36759
+ type: z.ZodLiteral<"inline">;
36760
+ code: z.ZodString;
36761
+ }, "strip", z.ZodTypeAny, {
36762
+ code: string;
36763
+ type: "inline";
36764
+ }, {
36765
+ code: string;
36766
+ type: "inline";
36113
36767
  }>, z.ZodNull]>>;
36114
36768
  tool_functions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
36115
36769
  type: z.ZodLiteral<"function">;
@@ -36420,6 +37074,9 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
36420
37074
  type: "global";
36421
37075
  name: string;
36422
37076
  function_type: "preprocessor";
37077
+ } | {
37078
+ code: string;
37079
+ type: "inline";
36423
37080
  } | null | undefined;
36424
37081
  origin?: {
36425
37082
  project_id?: string | undefined;
@@ -36694,6 +37351,9 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
36694
37351
  type: "global";
36695
37352
  name: string;
36696
37353
  function_type?: "preprocessor" | undefined;
37354
+ } | {
37355
+ code: string;
37356
+ type: "inline";
36697
37357
  } | null | undefined;
36698
37358
  origin?: {
36699
37359
  project_id?: string | undefined;
@@ -36973,6 +37633,9 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
36973
37633
  type: "global";
36974
37634
  name: string;
36975
37635
  function_type: "preprocessor";
37636
+ } | {
37637
+ code: string;
37638
+ type: "inline";
36976
37639
  } | null | undefined;
36977
37640
  origin?: {
36978
37641
  project_id?: string | undefined;
@@ -37251,6 +37914,9 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
37251
37914
  type: "global";
37252
37915
  name: string;
37253
37916
  function_type?: "preprocessor" | undefined;
37917
+ } | {
37918
+ code: string;
37919
+ type: "inline";
37254
37920
  } | null | undefined;
37255
37921
  origin?: {
37256
37922
  project_id?: string | undefined;
@@ -37572,6 +38238,9 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
37572
38238
  type: "global";
37573
38239
  name: string;
37574
38240
  function_type: "preprocessor";
38241
+ } | {
38242
+ code: string;
38243
+ type: "inline";
37575
38244
  } | null | undefined;
37576
38245
  origin?: {
37577
38246
  project_id?: string | undefined;
@@ -37876,6 +38545,9 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
37876
38545
  type: "global";
37877
38546
  name: string;
37878
38547
  function_type: "preprocessor";
38548
+ } | {
38549
+ code: string;
38550
+ type: "inline";
37879
38551
  } | null | undefined;
37880
38552
  origin?: {
37881
38553
  project_id?: string | undefined;
@@ -38173,6 +38845,9 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
38173
38845
  type: "global";
38174
38846
  name: string;
38175
38847
  function_type?: "preprocessor" | undefined;
38848
+ } | {
38849
+ code: string;
38850
+ type: "inline";
38176
38851
  } | null | undefined;
38177
38852
  origin?: {
38178
38853
  project_id?: string | undefined;
@@ -38477,6 +39152,9 @@ declare const evaluatorDefinitionSchema: z.ZodObject<{
38477
39152
  type: "global";
38478
39153
  name: string;
38479
39154
  function_type?: "preprocessor" | undefined;
39155
+ } | {
39156
+ code: string;
39157
+ type: "inline";
38480
39158
  } | null | undefined;
38481
39159
  origin?: {
38482
39160
  project_id?: string | undefined;
@@ -39970,6 +40648,15 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
39970
40648
  type: "global";
39971
40649
  name: string;
39972
40650
  function_type?: "preprocessor" | undefined;
40651
+ }>, z.ZodObject<{
40652
+ type: z.ZodLiteral<"inline">;
40653
+ code: z.ZodString;
40654
+ }, "strip", z.ZodTypeAny, {
40655
+ code: string;
40656
+ type: "inline";
40657
+ }, {
40658
+ code: string;
40659
+ type: "inline";
39973
40660
  }>, z.ZodNull]>>;
39974
40661
  tool_functions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
39975
40662
  type: z.ZodLiteral<"function">;
@@ -40280,6 +40967,9 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
40280
40967
  type: "global";
40281
40968
  name: string;
40282
40969
  function_type: "preprocessor";
40970
+ } | {
40971
+ code: string;
40972
+ type: "inline";
40283
40973
  } | null | undefined;
40284
40974
  origin?: {
40285
40975
  project_id?: string | undefined;
@@ -40554,6 +41244,9 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
40554
41244
  type: "global";
40555
41245
  name: string;
40556
41246
  function_type?: "preprocessor" | undefined;
41247
+ } | {
41248
+ code: string;
41249
+ type: "inline";
40557
41250
  } | null | undefined;
40558
41251
  origin?: {
40559
41252
  project_id?: string | undefined;
@@ -40833,6 +41526,9 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
40833
41526
  type: "global";
40834
41527
  name: string;
40835
41528
  function_type: "preprocessor";
41529
+ } | {
41530
+ code: string;
41531
+ type: "inline";
40836
41532
  } | null | undefined;
40837
41533
  origin?: {
40838
41534
  project_id?: string | undefined;
@@ -41111,6 +41807,9 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
41111
41807
  type: "global";
41112
41808
  name: string;
41113
41809
  function_type?: "preprocessor" | undefined;
41810
+ } | {
41811
+ code: string;
41812
+ type: "inline";
41114
41813
  } | null | undefined;
41115
41814
  origin?: {
41116
41815
  project_id?: string | undefined;
@@ -41420,6 +42119,9 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
41420
42119
  type: "global";
41421
42120
  name: string;
41422
42121
  function_type: "preprocessor";
42122
+ } | {
42123
+ code: string;
42124
+ type: "inline";
41423
42125
  } | null | undefined;
41424
42126
  origin?: {
41425
42127
  project_id?: string | undefined;
@@ -41711,6 +42413,9 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
41711
42413
  type: "global";
41712
42414
  name: string;
41713
42415
  function_type?: "preprocessor" | undefined;
42416
+ } | {
42417
+ code: string;
42418
+ type: "inline";
41714
42419
  } | null | undefined;
41715
42420
  origin?: {
41716
42421
  project_id?: string | undefined;
@@ -43125,6 +43830,15 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
43125
43830
  type: "global";
43126
43831
  name: string;
43127
43832
  function_type?: "preprocessor" | undefined;
43833
+ }>, z.ZodObject<{
43834
+ type: z.ZodLiteral<"inline">;
43835
+ code: z.ZodString;
43836
+ }, "strip", z.ZodTypeAny, {
43837
+ code: string;
43838
+ type: "inline";
43839
+ }, {
43840
+ code: string;
43841
+ type: "inline";
43128
43842
  }>, z.ZodNull]>>;
43129
43843
  tool_functions: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodObject<{
43130
43844
  type: z.ZodLiteral<"function">;
@@ -43435,6 +44149,9 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
43435
44149
  type: "global";
43436
44150
  name: string;
43437
44151
  function_type: "preprocessor";
44152
+ } | {
44153
+ code: string;
44154
+ type: "inline";
43438
44155
  } | null | undefined;
43439
44156
  origin?: {
43440
44157
  project_id?: string | undefined;
@@ -43709,6 +44426,9 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
43709
44426
  type: "global";
43710
44427
  name: string;
43711
44428
  function_type?: "preprocessor" | undefined;
44429
+ } | {
44430
+ code: string;
44431
+ type: "inline";
43712
44432
  } | null | undefined;
43713
44433
  origin?: {
43714
44434
  project_id?: string | undefined;
@@ -43988,6 +44708,9 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
43988
44708
  type: "global";
43989
44709
  name: string;
43990
44710
  function_type: "preprocessor";
44711
+ } | {
44712
+ code: string;
44713
+ type: "inline";
43991
44714
  } | null | undefined;
43992
44715
  origin?: {
43993
44716
  project_id?: string | undefined;
@@ -44266,6 +44989,9 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
44266
44989
  type: "global";
44267
44990
  name: string;
44268
44991
  function_type?: "preprocessor" | undefined;
44992
+ } | {
44993
+ code: string;
44994
+ type: "inline";
44269
44995
  } | null | undefined;
44270
44996
  origin?: {
44271
44997
  project_id?: string | undefined;
@@ -44587,6 +45313,9 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
44587
45313
  type: "global";
44588
45314
  name: string;
44589
45315
  function_type: "preprocessor";
45316
+ } | {
45317
+ code: string;
45318
+ type: "inline";
44590
45319
  } | null | undefined;
44591
45320
  origin?: {
44592
45321
  project_id?: string | undefined;
@@ -44891,6 +45620,9 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
44891
45620
  type: "global";
44892
45621
  name: string;
44893
45622
  function_type: "preprocessor";
45623
+ } | {
45624
+ code: string;
45625
+ type: "inline";
44894
45626
  } | null | undefined;
44895
45627
  origin?: {
44896
45628
  project_id?: string | undefined;
@@ -45188,6 +45920,9 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
45188
45920
  type: "global";
45189
45921
  name: string;
45190
45922
  function_type?: "preprocessor" | undefined;
45923
+ } | {
45924
+ code: string;
45925
+ type: "inline";
45191
45926
  } | null | undefined;
45192
45927
  origin?: {
45193
45928
  project_id?: string | undefined;
@@ -45492,6 +46227,9 @@ declare const evaluatorDefinitionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
45492
46227
  type: "global";
45493
46228
  name: string;
45494
46229
  function_type?: "preprocessor" | undefined;
46230
+ } | {
46231
+ code: string;
46232
+ type: "inline";
45495
46233
  } | null | undefined;
45496
46234
  origin?: {
45497
46235
  project_id?: string | undefined;