braintrust 3.3.0-rc.45 → 3.4.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 (44) hide show
  1. package/README.md +52 -67
  2. package/dev/dist/index.d.mts +53 -9
  3. package/dev/dist/index.d.ts +53 -9
  4. package/dev/dist/index.js +1839 -1298
  5. package/dev/dist/index.mjs +1503 -962
  6. package/dist/auto-instrumentations/bundler/esbuild.cjs +270 -23
  7. package/dist/auto-instrumentations/bundler/esbuild.mjs +2 -2
  8. package/dist/auto-instrumentations/bundler/rollup.cjs +270 -23
  9. package/dist/auto-instrumentations/bundler/rollup.mjs +2 -2
  10. package/dist/auto-instrumentations/bundler/vite.cjs +270 -23
  11. package/dist/auto-instrumentations/bundler/vite.mjs +2 -2
  12. package/dist/auto-instrumentations/bundler/webpack.cjs +270 -23
  13. package/dist/auto-instrumentations/bundler/webpack.mjs +2 -2
  14. package/dist/auto-instrumentations/{chunk-OLOPGWTJ.mjs → chunk-D5ZPIUEL.mjs} +1 -1
  15. package/dist/auto-instrumentations/chunk-LVWWLUMN.mjs +535 -0
  16. package/dist/auto-instrumentations/hook.mjs +306 -23
  17. package/dist/auto-instrumentations/index.cjs +270 -23
  18. package/dist/auto-instrumentations/index.d.mts +5 -5
  19. package/dist/auto-instrumentations/index.d.ts +5 -5
  20. package/dist/auto-instrumentations/index.mjs +1 -1
  21. package/dist/auto-instrumentations/loader/esm-hook.mjs +7 -8
  22. package/dist/browser.d.mts +558 -47
  23. package/dist/browser.d.ts +558 -47
  24. package/dist/browser.js +2432 -2174
  25. package/dist/browser.mjs +2432 -2174
  26. package/dist/cli.js +1732 -1105
  27. package/dist/edge-light.d.mts +1 -1
  28. package/dist/edge-light.d.ts +1 -1
  29. package/dist/edge-light.js +2342 -2086
  30. package/dist/edge-light.mjs +2342 -2086
  31. package/dist/index.d.mts +558 -47
  32. package/dist/index.d.ts +558 -47
  33. package/dist/index.js +2655 -2399
  34. package/dist/index.mjs +2433 -2177
  35. package/dist/instrumentation/index.d.mts +16 -22
  36. package/dist/instrumentation/index.d.ts +16 -22
  37. package/dist/instrumentation/index.js +1558 -1068
  38. package/dist/instrumentation/index.mjs +1558 -1068
  39. package/dist/workerd.d.mts +1 -1
  40. package/dist/workerd.d.ts +1 -1
  41. package/dist/workerd.js +2342 -2086
  42. package/dist/workerd.mjs +2342 -2086
  43. package/package.json +6 -3
  44. package/dist/auto-instrumentations/chunk-KVX7OFPD.mjs +0 -288
package/README.md CHANGED
@@ -1,39 +1,29 @@
1
- An isomorphic JS library for logging data to Braintrust.
1
+ # Braintrust JavaScript SDK
2
2
 
3
- ## Version information
3
+ [![npm version](https://img.shields.io/npm/v/braintrust.svg)](https://www.npmjs.com/package/braintrust)
4
4
 
5
- **2.x** is the current stable release. [Zod](https://zod.dev/) is now a peer dependency instead of a bundled dependency. This gives you control over the Zod version in your project and reduces bundle size if you’re already using Zod.
5
+ An isomorphic JavaScript/TypeScript SDK for logging, tracing, and evaluating AI applications with [Braintrust](https://www.braintrust.dev/). For more details, see the [Braintrust docs](https://www.braintrust.dev/docs)
6
6
 
7
- The SDK requires Zod v3.25.34 or later.
7
+ ## Installation
8
8
 
9
- ### Upgrading from 1.x
10
-
11
- See the [Migrate from v1.x to v2.x guide](https://www.braintrust.dev/docs/reference/sdks/typescript/migrations/v1-to-v2) for instructions.
12
-
13
- ### Upgrading from 0.x
14
-
15
- First follow the [Migrate from v0.x to v1.x guide](https://www.braintrust.dev/docs/reference/sdks/typescript/migrations/v0-to-v1), then proceed to the [Migrate from v1.x to v2.x guide](https://www.braintrust.dev/docs/reference/sdks/typescript/migrations/v1-to-v2).
16
-
17
- **Note:** If you do not have OpenTelemetry you can upgrade directly from v0.x to v2.x.
18
-
19
- ### Quickstart
20
-
21
- Install the library with npm (or yarn).
9
+ Install the SDK:
22
10
 
23
11
  ```bash
24
- npm install braintrust zod
12
+ npm install braintrust
25
13
  ```
26
14
 
27
- Then, run a simple experiment with the following code (replace `YOUR_API_KEY` with
28
- your Braintrust API key):
15
+ ## Quickstart
16
+
17
+ Run a simple experiment (replace `YOUR_API_KEY` with your Braintrust API key):
29
18
 
30
- ```javascript
19
+ ```typescript
31
20
  import * as braintrust from "braintrust";
32
21
 
33
22
  async function main() {
34
23
  const experiment = await braintrust.init("NodeTest", {
35
24
  apiKey: "YOUR_API_KEY",
36
25
  });
26
+
37
27
  experiment.log({
38
28
  input: { test: 1 },
39
29
  output: "foo",
@@ -45,53 +35,32 @@ async function main() {
45
35
  id: 1,
46
36
  },
47
37
  });
38
+
48
39
  console.log(await experiment.summarize());
49
40
  }
50
41
 
51
42
  main().catch(console.error);
52
43
  ```
53
44
 
54
- ### Browser Support
55
-
56
- **For browser-only applications, use the dedicated browser package:**
57
-
58
- ```bash
59
- npm install @braintrust/browser
60
- ```
61
-
62
- The `@braintrust/browser` package is optimized for browser environments and includes the `als-browser` polyfill for AsyncLocalStorage support. It's a standalone package with no peer dependencies.
63
-
64
- **When to use each package:**
65
-
66
- - **`braintrust`** (this package) - For Node.js applications, full-stack frameworks (Next.js, etc.), and edge runtimes with native AsyncLocalStorage (Cloudflare Workers, Vercel Edge)
67
- - **`@braintrust/browser`** - For browser-only applications that need AsyncLocalStorage support in standard browsers
68
-
69
- See the [@braintrust/browser README](../integrations/browser-js/README.md) for more details.
70
-
71
- **Breaking change in v3.0.0:** The `braintrust/browser` subpath export has been deprecated. Browser users should migrate to the `@braintrust/browser` package.
72
-
73
- ### Auto-Instrumentation
45
+ ## Auto-Instrumentation
74
46
 
75
- Braintrust provides automatic instrumentation for popular AI SDKs, eliminating the need for manual wrapping. This feature automatically logs all AI SDK calls (OpenAI, Anthropic, Vercel AI SDK, etc.) to Braintrust without any code changes.
47
+ Braintrust can automatically instrument popular AI SDKs (OpenAI, Anthropic, Vercel AI SDK, and others) to log calls without manual wrapper code.
76
48
 
77
- #### Node.js Applications
49
+ ### Node.js
78
50
 
79
- For Node.js applications, use the `--import` flag to load the instrumentation hook:
51
+ Use the runtime import hook:
80
52
 
81
53
  ```bash
82
54
  node --import braintrust/hook.mjs app.js
83
55
  ```
84
56
 
85
- This works with both ESM and CommonJS modules automatically.
57
+ ### Bundled Apps
86
58
 
87
- #### Browser/Bundled Applications
59
+ Use a bundler plugin:
88
60
 
89
- For browser applications or bundled Node.js applications, use the appropriate bundler plugin:
61
+ Vite:
90
62
 
91
- **Vite:**
92
-
93
- ```typescript
94
- // vite.config.ts
63
+ ```ts
95
64
  import { vitePlugin } from "braintrust/vite";
96
65
 
97
66
  export default {
@@ -99,10 +68,9 @@ export default {
99
68
  };
100
69
  ```
101
70
 
102
- **Webpack:**
71
+ Webpack:
103
72
 
104
- ```javascript
105
- // webpack.config.js
73
+ ```js
106
74
  const { webpackPlugin } = require("braintrust/webpack");
107
75
 
108
76
  module.exports = {
@@ -110,9 +78,9 @@ module.exports = {
110
78
  };
111
79
  ```
112
80
 
113
- **esbuild:**
81
+ esbuild:
114
82
 
115
- ```typescript
83
+ ```ts
116
84
  import { esbuildPlugin } from "braintrust/esbuild";
117
85
 
118
86
  await esbuild.build({
@@ -120,9 +88,9 @@ await esbuild.build({
120
88
  });
121
89
  ```
122
90
 
123
- **Rollup:**
91
+ Rollup:
124
92
 
125
- ```typescript
93
+ ```ts
126
94
  import { rollupPlugin } from "braintrust/rollup";
127
95
 
128
96
  export default {
@@ -130,15 +98,32 @@ export default {
130
98
  };
131
99
  ```
132
100
 
133
- **Important:** If you're using TypeScript or other transpilation plugins, place the Braintrust plugin **after** them in the plugin array to ensure it instruments the transformed code:
101
+ If you use TypeScript or other transpilation plugins, place the Braintrust plugin after them so transformed output is instrumented.
134
102
 
135
- ```typescript
136
- export default {
137
- plugins: [
138
- typescript(), // or other transpilation plugins
139
- vitePlugin(), // Braintrust plugin should come after
140
- ],
141
- };
103
+ For deeper details, see the [auto-instrumentation architecture docs](src/auto-instrumentations/README.md).
104
+
105
+ ## Browser Support
106
+
107
+ For browser-only applications, use the dedicated browser package:
108
+
109
+ ```bash
110
+ npm install @braintrust/browser braintrust
142
111
  ```
143
112
 
144
- For more information on auto-instrumentation, see the [internal architecture docs](src/auto-instrumentations/README.md).
113
+ See the [`@braintrust/browser` README](../integrations/browser-js/README.md) for details and current limitations.
114
+
115
+ ## Migration Guides
116
+
117
+ ### Upgrading from 2.x to 3.x
118
+
119
+ See the [Migrate from v2.x to v3.x guide](https://www.braintrust.dev/docs/reference/sdks/typescript/migrations/v2-to-v3).
120
+
121
+ In 3.x, browser usage should move to `@braintrust/browser` instead of relying on the legacy `braintrust/browser` path.
122
+
123
+ ### Upgrading from 1.x to 2.x
124
+
125
+ See the [Migrate from v1.x to v2.x guide](https://www.braintrust.dev/docs/reference/sdks/typescript/migrations/v1-to-v2).
126
+
127
+ ### Upgrading from 0.x to 1.x
128
+
129
+ See the [Migrate from v1.x to v2.x guide](https://www.braintrust.dev/docs/reference/sdks/typescript/migrations/v0-to-v1).
@@ -8382,6 +8382,14 @@ declare const ToolFunctionDefinition: z.ZodObject<{
8382
8382
  type ToolFunctionDefinitionType = z.infer<typeof ToolFunctionDefinition>;
8383
8383
 
8384
8384
  type GenericFunction<Input, Output> = ((input: Input) => Output) | ((input: Input) => Promise<Output>);
8385
+ interface BaseFnOpts {
8386
+ name: string;
8387
+ slug: string;
8388
+ description: string;
8389
+ ifExists: IfExistsType;
8390
+ tags?: string[];
8391
+ metadata?: Record<string, unknown>;
8392
+ }
8385
8393
 
8386
8394
  interface IsoAsyncLocalStorage<T> {
8387
8395
  enterWith(store: T): void;
@@ -8389,6 +8397,9 @@ interface IsoAsyncLocalStorage<T> {
8389
8397
  getStore(): T | undefined;
8390
8398
  }
8391
8399
 
8400
+ type DebugLogLevel = "error" | "warn" | "info" | "debug";
8401
+ type DebugLogLevelOption = DebugLogLevel | false | undefined;
8402
+
8392
8403
  /**
8393
8404
  * Abstract base class for ID generators
8394
8405
  */
@@ -10424,11 +10435,25 @@ declare const evalParametersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodOb
10424
10435
  type: "function";
10425
10436
  }[] | undefined;
10426
10437
  }) | undefined;
10438
+ }>, z.ZodObject<{
10439
+ type: z.ZodLiteral<"model">;
10440
+ default: z.ZodOptional<z.ZodString>;
10441
+ description: z.ZodOptional<z.ZodString>;
10442
+ }, "strip", z.ZodTypeAny, {
10443
+ type: "model";
10444
+ description?: string | undefined;
10445
+ default?: string | undefined;
10446
+ }, {
10447
+ type: "model";
10448
+ description?: string | undefined;
10449
+ default?: string | undefined;
10427
10450
  }>, z.ZodType<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeDef, z.ZodType<unknown, z.ZodTypeDef, unknown>>]>>;
10428
10451
  type EvalParameters = z.infer<typeof evalParametersSchema>;
10429
10452
  type InferParameterValue<T> = T extends {
10430
10453
  type: "prompt";
10431
- } ? Prompt : T extends z.ZodType ? z.infer<T> : never;
10454
+ } ? Prompt : T extends {
10455
+ type: "model";
10456
+ } ? string : T extends z.ZodType ? z.infer<T> : never;
10432
10457
  type InferParameters<T extends EvalParameters> = {
10433
10458
  [K in keyof T]: InferParameterValue<T[K]>;
10434
10459
  };
@@ -10706,6 +10731,8 @@ declare const loginSchema: z.ZodObject<{
10706
10731
  collect: "some" | "none" | "all";
10707
10732
  fields?: ("dirty" | "tag" | "commit" | "branch" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
10708
10733
  }>>>;
10734
+ debugLogLevel: z.ZodOptional<z.ZodEnum<["error", "warn", "info", "debug"]>>;
10735
+ debugLogLevelDisabled: z.ZodOptional<z.ZodBoolean>;
10709
10736
  }, "strict", z.ZodTypeAny, {
10710
10737
  appUrl: string;
10711
10738
  appPublicUrl: string;
@@ -10718,6 +10745,8 @@ declare const loginSchema: z.ZodObject<{
10718
10745
  collect: "some" | "none" | "all";
10719
10746
  fields?: ("dirty" | "tag" | "commit" | "branch" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
10720
10747
  } | null | undefined;
10748
+ debugLogLevel?: "error" | "warn" | "info" | "debug" | undefined;
10749
+ debugLogLevelDisabled?: boolean | undefined;
10721
10750
  }, {
10722
10751
  appUrl: string;
10723
10752
  appPublicUrl: string;
@@ -10730,6 +10759,8 @@ declare const loginSchema: z.ZodObject<{
10730
10759
  collect: "some" | "none" | "all";
10731
10760
  fields?: ("dirty" | "tag" | "commit" | "branch" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
10732
10761
  } | null | undefined;
10762
+ debugLogLevel?: "error" | "warn" | "info" | "debug" | undefined;
10763
+ debugLogLevelDisabled?: boolean | undefined;
10733
10764
  }>;
10734
10765
  type SerializedBraintrustState = z.infer<typeof loginSchema>;
10735
10766
  declare class BraintrustState {
@@ -10750,6 +10781,8 @@ declare class BraintrustState {
10750
10781
  proxyUrl: string | null;
10751
10782
  loggedIn: boolean;
10752
10783
  gitMetadataSettings?: GitMetadataSettingsType;
10784
+ debugLogLevel?: DebugLogLevel;
10785
+ private debugLogLevelConfigured;
10753
10786
  fetch: typeof globalThis.fetch;
10754
10787
  private _appConn;
10755
10788
  private _apiConn;
@@ -10780,6 +10813,9 @@ declare class BraintrustState {
10780
10813
  static deserialize(serialized: unknown, opts?: LoginOptions): BraintrustState;
10781
10814
  setFetch(fetch: typeof globalThis.fetch): void;
10782
10815
  setMaskingFunction(maskingFunction: ((value: unknown) => unknown) | null): void;
10816
+ setDebugLogLevel(option: DebugLogLevelOption): void;
10817
+ getDebugLogLevel(): DebugLogLevel | undefined;
10818
+ hasDebugLogLevelOverride(): boolean;
10783
10819
  login(loginParams: LoginOptions & {
10784
10820
  forceLogin?: boolean;
10785
10821
  }): Promise<void>;
@@ -11028,6 +11064,19 @@ interface LoginOptions {
11028
11064
  * server. Defaults to false.
11029
11065
  */
11030
11066
  disableSpanCache?: boolean;
11067
+ /**
11068
+ * Controls internal Braintrust SDK troubleshooting output.
11069
+ *
11070
+ * Use `"error"`, `"warn"`, `"info"`, or `"debug"` to control how much
11071
+ * internal SDK troubleshooting output is emitted. Use `false` to explicitly
11072
+ * disable this output.
11073
+ *
11074
+ * When omitted, the SDK remains silent unless
11075
+ * `BRAINTRUST_DEBUG_LOG_LEVEL` is set to `"error"`, `"warn"`, `"info"`, or
11076
+ * `"debug"`. This option only affects local console output; it does not
11077
+ * change what data is logged to Braintrust.
11078
+ */
11079
+ debugLogLevel?: DebugLogLevel | false;
11031
11080
  }
11032
11081
  type OptionalStateArg = {
11033
11082
  state?: BraintrustState;
@@ -12720,14 +12769,6 @@ declare const promptDefinitionSchema: z.ZodIntersection<z.ZodUnion<[z.ZodObject<
12720
12769
  }>>;
12721
12770
  type PromptDefinition = z.infer<typeof promptDefinitionSchema>;
12722
12771
 
12723
- interface BaseFnOpts {
12724
- name: string;
12725
- slug: string;
12726
- description: string;
12727
- ifExists: IfExistsType;
12728
- metadata?: Record<string, unknown>;
12729
- }
12730
-
12731
12772
  type NameOrId = {
12732
12773
  name: string;
12733
12774
  } | {
@@ -12814,6 +12855,7 @@ declare class CodeFunction<Input, Output, Fn extends GenericFunction<Input, Outp
12814
12855
  readonly parameters?: z.ZodSchema<Input>;
12815
12856
  readonly returns?: z.ZodSchema<Output>;
12816
12857
  readonly ifExists?: IfExistsType;
12858
+ readonly tags?: string[];
12817
12859
  readonly metadata?: Record<string, unknown>;
12818
12860
  constructor(project: Project, opts: Omit<CodeOpts<Input, Output, Fn>, "name" | "slug"> & {
12819
12861
  name: string;
@@ -12833,6 +12875,7 @@ declare class CodePrompt {
12833
12875
  readonly id?: string;
12834
12876
  readonly functionType?: FunctionTypeEnumType;
12835
12877
  readonly toolFunctions: (SavedFunctionIdType | GenericCodeFunction)[];
12878
+ readonly tags?: string[];
12836
12879
  readonly metadata?: Record<string, unknown>;
12837
12880
  constructor(project: Project, prompt: PromptDataType, toolFunctions: (SavedFunctionIdType | GenericCodeFunction)[], opts: Omit<PromptOpts<false, false, false, false>, "name" | "slug"> & {
12838
12881
  name: string;
@@ -12900,6 +12943,7 @@ interface FunctionEvent {
12900
12943
  function_data: z.infer<typeof FunctionData>;
12901
12944
  function_type?: FunctionTypeEnumType;
12902
12945
  if_exists?: IfExistsType;
12946
+ tags?: string[];
12903
12947
  metadata?: Record<string, unknown>;
12904
12948
  }
12905
12949
  declare class ProjectNameIdMap {
@@ -8382,6 +8382,14 @@ declare const ToolFunctionDefinition: z.ZodObject<{
8382
8382
  type ToolFunctionDefinitionType = z.infer<typeof ToolFunctionDefinition>;
8383
8383
 
8384
8384
  type GenericFunction<Input, Output> = ((input: Input) => Output) | ((input: Input) => Promise<Output>);
8385
+ interface BaseFnOpts {
8386
+ name: string;
8387
+ slug: string;
8388
+ description: string;
8389
+ ifExists: IfExistsType;
8390
+ tags?: string[];
8391
+ metadata?: Record<string, unknown>;
8392
+ }
8385
8393
 
8386
8394
  interface IsoAsyncLocalStorage<T> {
8387
8395
  enterWith(store: T): void;
@@ -8389,6 +8397,9 @@ interface IsoAsyncLocalStorage<T> {
8389
8397
  getStore(): T | undefined;
8390
8398
  }
8391
8399
 
8400
+ type DebugLogLevel = "error" | "warn" | "info" | "debug";
8401
+ type DebugLogLevelOption = DebugLogLevel | false | undefined;
8402
+
8392
8403
  /**
8393
8404
  * Abstract base class for ID generators
8394
8405
  */
@@ -10424,11 +10435,25 @@ declare const evalParametersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodOb
10424
10435
  type: "function";
10425
10436
  }[] | undefined;
10426
10437
  }) | undefined;
10438
+ }>, z.ZodObject<{
10439
+ type: z.ZodLiteral<"model">;
10440
+ default: z.ZodOptional<z.ZodString>;
10441
+ description: z.ZodOptional<z.ZodString>;
10442
+ }, "strip", z.ZodTypeAny, {
10443
+ type: "model";
10444
+ description?: string | undefined;
10445
+ default?: string | undefined;
10446
+ }, {
10447
+ type: "model";
10448
+ description?: string | undefined;
10449
+ default?: string | undefined;
10427
10450
  }>, z.ZodType<z.ZodType<unknown, z.ZodTypeDef, unknown>, z.ZodTypeDef, z.ZodType<unknown, z.ZodTypeDef, unknown>>]>>;
10428
10451
  type EvalParameters = z.infer<typeof evalParametersSchema>;
10429
10452
  type InferParameterValue<T> = T extends {
10430
10453
  type: "prompt";
10431
- } ? Prompt : T extends z.ZodType ? z.infer<T> : never;
10454
+ } ? Prompt : T extends {
10455
+ type: "model";
10456
+ } ? string : T extends z.ZodType ? z.infer<T> : never;
10432
10457
  type InferParameters<T extends EvalParameters> = {
10433
10458
  [K in keyof T]: InferParameterValue<T[K]>;
10434
10459
  };
@@ -10706,6 +10731,8 @@ declare const loginSchema: z.ZodObject<{
10706
10731
  collect: "some" | "none" | "all";
10707
10732
  fields?: ("dirty" | "tag" | "commit" | "branch" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
10708
10733
  }>>>;
10734
+ debugLogLevel: z.ZodOptional<z.ZodEnum<["error", "warn", "info", "debug"]>>;
10735
+ debugLogLevelDisabled: z.ZodOptional<z.ZodBoolean>;
10709
10736
  }, "strict", z.ZodTypeAny, {
10710
10737
  appUrl: string;
10711
10738
  appPublicUrl: string;
@@ -10718,6 +10745,8 @@ declare const loginSchema: z.ZodObject<{
10718
10745
  collect: "some" | "none" | "all";
10719
10746
  fields?: ("dirty" | "tag" | "commit" | "branch" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
10720
10747
  } | null | undefined;
10748
+ debugLogLevel?: "error" | "warn" | "info" | "debug" | undefined;
10749
+ debugLogLevelDisabled?: boolean | undefined;
10721
10750
  }, {
10722
10751
  appUrl: string;
10723
10752
  appPublicUrl: string;
@@ -10730,6 +10759,8 @@ declare const loginSchema: z.ZodObject<{
10730
10759
  collect: "some" | "none" | "all";
10731
10760
  fields?: ("dirty" | "tag" | "commit" | "branch" | "author_name" | "author_email" | "commit_message" | "commit_time" | "git_diff")[] | undefined;
10732
10761
  } | null | undefined;
10762
+ debugLogLevel?: "error" | "warn" | "info" | "debug" | undefined;
10763
+ debugLogLevelDisabled?: boolean | undefined;
10733
10764
  }>;
10734
10765
  type SerializedBraintrustState = z.infer<typeof loginSchema>;
10735
10766
  declare class BraintrustState {
@@ -10750,6 +10781,8 @@ declare class BraintrustState {
10750
10781
  proxyUrl: string | null;
10751
10782
  loggedIn: boolean;
10752
10783
  gitMetadataSettings?: GitMetadataSettingsType;
10784
+ debugLogLevel?: DebugLogLevel;
10785
+ private debugLogLevelConfigured;
10753
10786
  fetch: typeof globalThis.fetch;
10754
10787
  private _appConn;
10755
10788
  private _apiConn;
@@ -10780,6 +10813,9 @@ declare class BraintrustState {
10780
10813
  static deserialize(serialized: unknown, opts?: LoginOptions): BraintrustState;
10781
10814
  setFetch(fetch: typeof globalThis.fetch): void;
10782
10815
  setMaskingFunction(maskingFunction: ((value: unknown) => unknown) | null): void;
10816
+ setDebugLogLevel(option: DebugLogLevelOption): void;
10817
+ getDebugLogLevel(): DebugLogLevel | undefined;
10818
+ hasDebugLogLevelOverride(): boolean;
10783
10819
  login(loginParams: LoginOptions & {
10784
10820
  forceLogin?: boolean;
10785
10821
  }): Promise<void>;
@@ -11028,6 +11064,19 @@ interface LoginOptions {
11028
11064
  * server. Defaults to false.
11029
11065
  */
11030
11066
  disableSpanCache?: boolean;
11067
+ /**
11068
+ * Controls internal Braintrust SDK troubleshooting output.
11069
+ *
11070
+ * Use `"error"`, `"warn"`, `"info"`, or `"debug"` to control how much
11071
+ * internal SDK troubleshooting output is emitted. Use `false` to explicitly
11072
+ * disable this output.
11073
+ *
11074
+ * When omitted, the SDK remains silent unless
11075
+ * `BRAINTRUST_DEBUG_LOG_LEVEL` is set to `"error"`, `"warn"`, `"info"`, or
11076
+ * `"debug"`. This option only affects local console output; it does not
11077
+ * change what data is logged to Braintrust.
11078
+ */
11079
+ debugLogLevel?: DebugLogLevel | false;
11031
11080
  }
11032
11081
  type OptionalStateArg = {
11033
11082
  state?: BraintrustState;
@@ -12720,14 +12769,6 @@ declare const promptDefinitionSchema: z.ZodIntersection<z.ZodUnion<[z.ZodObject<
12720
12769
  }>>;
12721
12770
  type PromptDefinition = z.infer<typeof promptDefinitionSchema>;
12722
12771
 
12723
- interface BaseFnOpts {
12724
- name: string;
12725
- slug: string;
12726
- description: string;
12727
- ifExists: IfExistsType;
12728
- metadata?: Record<string, unknown>;
12729
- }
12730
-
12731
12772
  type NameOrId = {
12732
12773
  name: string;
12733
12774
  } | {
@@ -12814,6 +12855,7 @@ declare class CodeFunction<Input, Output, Fn extends GenericFunction<Input, Outp
12814
12855
  readonly parameters?: z.ZodSchema<Input>;
12815
12856
  readonly returns?: z.ZodSchema<Output>;
12816
12857
  readonly ifExists?: IfExistsType;
12858
+ readonly tags?: string[];
12817
12859
  readonly metadata?: Record<string, unknown>;
12818
12860
  constructor(project: Project, opts: Omit<CodeOpts<Input, Output, Fn>, "name" | "slug"> & {
12819
12861
  name: string;
@@ -12833,6 +12875,7 @@ declare class CodePrompt {
12833
12875
  readonly id?: string;
12834
12876
  readonly functionType?: FunctionTypeEnumType;
12835
12877
  readonly toolFunctions: (SavedFunctionIdType | GenericCodeFunction)[];
12878
+ readonly tags?: string[];
12836
12879
  readonly metadata?: Record<string, unknown>;
12837
12880
  constructor(project: Project, prompt: PromptDataType, toolFunctions: (SavedFunctionIdType | GenericCodeFunction)[], opts: Omit<PromptOpts<false, false, false, false>, "name" | "slug"> & {
12838
12881
  name: string;
@@ -12900,6 +12943,7 @@ interface FunctionEvent {
12900
12943
  function_data: z.infer<typeof FunctionData>;
12901
12944
  function_type?: FunctionTypeEnumType;
12902
12945
  if_exists?: IfExistsType;
12946
+ tags?: string[];
12903
12947
  metadata?: Record<string, unknown>;
12904
12948
  }
12905
12949
  declare class ProjectNameIdMap {