Repository navigation
Commit 51bef8c
authored
ref!: Reduce API to a minimum that makes sense (#2429)
ref
[#1841](#1841)
- Replaced the root `braintrust` export surface with an explicit
allowlist, removing roughly 140 named exports—primarily internal
helpers, implementation classes, schemas, constants, and low-level
types.
- Stopped named-exporting most SDK-owned request/result types. Retained
types are primarily user extension points, including `StartSpanArgs`,
`Span`, tracing context types, eval callbacks, reporters, template
plugins, and durable-eval stores.
- Removed package subpaths `braintrust/browser`, `braintrust/util`, and
`braintrust/webpack-loader`; the util bundle is no longer built or
published.
- Kept the webpack loader private: `braintrust/next` now resolves its
built loader directly instead of exposing it as a package entrypoint.
- Removed public implementation/testing exports such as
`_exportsForTestingOnly`, `_internalIso`, `_internalGetGlobalState`,
`_internalSetInitialState`, `SpanImpl`, `NoopSpan`,
`TestBackgroundLogger`, `ObjectFetcher`, and ID-generator classes.
- Removed public runtime schemas and serialization internals, including
prompt, stream-chunk, attachment-reference, logs-overflow, and
propagation schemas/constants.
- Removed lower-level project/building APIs such as `graph`, `Project`,
`CodeFunction`, `CodePrompt`, `PromptBuilder`, `ScorerBuilder`, and
`ToolBuilder`; the `projects` facade remains.
- Removed miscellaneous convenience and implementation exports including
`log`, `summarize`, `traceable`, `newId`, `permalink`, `deepCopyEvent`,
template-registry internals, span fetchers, and logs-overflow helpers.
- Removed deprecated APIs:
- `BraintrustMiddleware` and `wrapAISDKModel`
- `wrapMastraAgent`
- `withExperiment` and `withDataset`
- `toAIStreamResponse`
- deprecated bundler aliases `esbuildPlugin`, `rollupPlugin`,
`vitePlugin`, and `webpackPlugin`
- deprecated `useDiagnosticChannelCompatShim`
- `Experiment.close()`, `Dataset.close()`, and `Span.close()`
- `EvalHooks.meta`, `EvalResultWithSummary.toString()`, and
`Score.error`
- Removed legacy aliases and call shapes:
- `initExperiment`
- string-first `init()` and `initDataset()` overloads
- dataset `useOutput` mode and the `output` record alias
- deprecated event `inputs` and `datasetRecordId` fields
- `wrapOpenAIv4`
- Changed `EvalResultWithSummary` from an exported runtime class to a
plain `{ summary, results }` result shape.
- Restricted public span parenting to opaque `PropagationContext`;
serialized span-slug strings remain internal plumbing. The public type
is still named `StartSpanArgs`.
- Added `configureContextManager()` and
`ContextManager.getCurrentSpanStore()` as the supported context
integration mechanism, replacing global symbols and direct state
mutation.
- Moved instrumentation-only APIs off the root:
- `configureInstrumentation`, `InstrumentationConfig`, and Eve/Flue
instrumentation remain under `braintrust/instrumentation`.
- `registerOtelFlush` now lives there as the narrow OTEL hook.
- Simplified OTEL integration:
- Uses `configureContextManager()` instead of internal globals.
- No longer overrides ID generation or V4 span serialization.
- Replaced `contextFromSpanExport(string)` with `contextFromSpan(span)`.
- `parentFromHeaders()` now returns opaque W3C propagation context.
- Environment and `.env.braintrust` handling is self-contained and
Edge-safe.
- Removed the OTEL-specific exported ID generator.
- Migrated Temporal propagation from private serialized span headers to
standard `traceparent`, `tracestate`, and `baggage`, covering
client→workflow, child workflow, and same-/cross-worker activity
parenting.
- Reworked `@braintrust/browser` to install a browser `ContextManager`
through the public configuration API instead of mutating core isomorph
internals.
- Updated OpenAI Agents and the Vercel adapter to avoid
`braintrust/util` and the exported `BraintrustStreamChunk`; the adapter
now derives its stream chunk type from `BraintrustStream`.
- Canonicalized instrumentation config keys by removing typed aliases
such as `vercel`, `google`, `cursor`, `bedrock`, and `awsBedrock`;
environment spellings still map to canonical keys.
- Updated smoke tests, integration tests, Deno/browser coverage, and e2e
scenarios to use only the curated public surface; added explicit tests
for the allowed root types and published package entrypoints.1 parent 34bff9d commit 51bef8c
149 files changed
Lines changed: 1406 additions & 3917 deletions
File tree
- .changeset
- e2e
- scenarios
- cloudflare-agents-instrumentation
- cloudflare-ai-chat-instrumentation
- cloudflare-think-instrumentation
- deno-browser
- __snapshots__
- deno-node
- eve-instrumentation
- agent
- instrumentation
- subagents/researcher/instrumentation
- flue-instrumentation
- .flue
- otel-compat-mixed-tracing
- test-framework-evals-jest
- trace-context-and-continuation
- integrations
- browser-js/src
- langchain-js/src/test
- openai-agents-js
- src
- otel-js
- src
- tests
- temporal-js
- src
- vercel-ai-sdk/src
- js
- smoke
- scenarios
- browser-main-package
- src
- tests
- cloudflare-vite-hono-vite-dev-node-esm/tests
- cloudflare-vite-hono-vite-dev
- cloudflare-vite-hono-wrangler-dev
- playwright-browser/src
- src
- auto-instrumentations
- bundler
- configs
- browser
- edge-light
- functions
- instrumentation
- core
- providers
- node
- template
- workerd
- wrappers
- ai-sdk
- deprecated
- langchain
- node-test
- vitest-evals
- vitest
- tests
- api-compatibility
- auto-instrumentations
- util
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
| 10 | + | |
13 | 11 | | |
14 | 12 | | |
15 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
| 28 | + | |
31 | 29 | | |
32 | 30 | | |
33 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
| 16 | + | |
19 | 17 | | |
20 | 18 | | |
21 | 19 | | |
| |||
0 commit comments