Skip to content

Reorganize js sdk wrappers - #1011

Merged
Ken Jiang (knjiang) merged 11 commits into
mainfrom
ken/fix-ai-sdk-deps
Oct 21, 2025
Merged

Ken Jiang (knjiang) merged 11 commits into
mainfrom
ken/fix-ai-sdk-deps

Conversation

@knjiang

@knjiang Ken Jiang (knjiang) commented Oct 20, 2025 •

Copy link
Copy Markdown
Contributor

This PR reorganizes js sdk wrappers and runs via pnpm-workspace:
example:
image

the package.json files are mainly to run tests/golden tests and are private submodules. this is to make sure we don't accidentally introduce "real" dependencies to the actual package.

Comment thread js/package.json
"watch": "tsup --watch",
"clean": "rm -r dist/* && rm -r dev/dist/*",
"docs": "npx typedoc --options typedoc.json src/index.ts",
"test": "vitest run --exclude src/wrappers/anthropic.test.ts --exclude src/wrappers/oai.test.ts --exclude src/otel.test.ts --exclude src/otel-no-deps.test.ts --exclude src/wrappers/ai-sdk-v1.test.ts --exclude src/wrappers/ai-sdk-v2.test.ts --exclude src/wrappers/ai-sdk-v3.test.ts --exclude src/wrappers/mastra.test.ts --exclude src/wrappers/claude-agent-sdk.test.ts --exclude src/wrappers/google-genai.test.ts",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the main win from this is we are now always running all the wrapper tests with conflicting deps in CI now. I've also moved the code around to be more understandable.

expect(taskSpan!.output).toBeDefined();

// Verify task span metrics match the result message usage
// Verify result message has usage data

@knjiang Ken Jiang (knjiang) Oct 20, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test was broken lol, fixing now that we run in CI

@knjiang

Copy link
Copy Markdown
Contributor Author

Codex (@codex) review

@ibolmo Olmo Maldonado (ibolmo) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL! This is going to be a great improvement

Comment thread js/vitest.config.js
"**/cypress/**",
"**/.{idea,git,cache,output,temp}/**",
"**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*",
"src/wrappers/ai-sdk-4/**",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i suppose if we moved every wrapper to this pattern we might eventually just do src/wrappers/**

Comment thread js/Makefile
# -------------------------------------------------------------------------------------------------

test-ai-sdk-4:
cd src/wrappers/ai-sdk-4 && pnpm install && pnpm test

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if we could just have the main package.json delegate to the underlying ones.

i.e.

"test": "pnpm test:ai-sdk-v4 && ...",
"test:ai-sdk-v4": "cd src/wrappers/ai-sdk-v4 && pnpm test",

tl;dr i wonder if there's a nice way to get this without each of these make targets (always seemed odd)

@knjiang Ken Jiang (knjiang) Oct 21, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i'd be fine with just moving all of this in package.json. I'll make a ticket

@knjiang
Ken Jiang (knjiang) merged commit 2cbf350 into main Oct 21, 2025
35 checks passed
@knjiang
Ken Jiang (knjiang) deleted the ken/fix-ai-sdk-deps branch October 21, 2025 18:03
Ken Jiang (knjiang) added a commit that referenced this pull request Oct 21, 2025
…1012)

I tried prereleasing
#1011 but didn't
specify a prerelease suffix so ended up releasing `0.4.7` on beta tag 🤦
https://www.npmjs.com/package/braintrust/v/0.4.6?activeTab=versions

new github flow:
<img width="1160" height="1000" alt="image"
src="https://github.com/user-attachments/assets/c0a13f61-35e8-4c1d-ad86-48471dd268fb"
/>


new package release (github run number used for uniqueness):
`0.4.7-rc.8`
https://www.npmjs.com/package/braintrust/v/0.4.7-rc.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants