Repository navigation
Ship a plugin SDK runtime bundle so packaged builtin plugins can load - #794
Merged
SawyerHood merged 1 commit intoJul 18, 2026
Merged
Conversation
The published bb-app 0.0.31 boots with every builtin plugin except secrets failing: "Cannot find module '@bb/plugin-sdk'". Plugin server bundles keep @bb/plugin-sdk external on the assumption the server's loader resolves it, but the jiti loader had no such mapping — it only worked in source checkouts where the workspace package resolves from node_modules. Plugin SDK 0.3 introduced defineRpcContract, the first runtime (non-type) SDK export, so 0.0.31 is the first release whose bundles carry a live SDK import into the packaged app, where nothing can resolve it. Inlining at build time is not an option: third-party authors only ever have the SDK's bundled .d.ts (it is not on npm), so the specifier must survive to load time. Fix: the server build now bundles the SDK runtime into dist/plugin-sdk-runtime.js, and the plugin loader aliases @bb/plugin-sdk to that file when it exists next to the server bundle (packaged app, built checkout). Source checkouts have no such file and keep workspace resolution. This covers builtins, store officials, and third-party plugins in one place. The publish workflow's tarball smoke passed on 0.0.31 because plugin load failures are warn-level and it only checked /health. It now polls `bb plugin list --json` until every default-enabled builtin reaches "running" and fails on any plugin in "error". Co-Authored-By: Claude Fable 5 <[email protected]>
SawyerHood
deleted the
bb/built-in-plugins-stopped-working-thr_iwa34dp467
branch
July 18, 2026 00:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The published bb-app 0.0.31 boots with every builtin plugin except
secretsfailing — connect, automations, custom-instructions, inline-vis all report:Reproduced against the real npm artifacts: 0.0.30 loads all builtins; 0.0.31 fails on both upgraded and fresh data dirs, so every packaged 0.0.31 install is affected (npm + desktop). Store officials (github, docs, memory, tasks) carry the same import and fail on install.
Root cause
Three things intersect:
buildPluginServerkeeps@bb/plugin-sdkexternal in plugin server bundles, per a comment claiming "the server's loader resolves it" — but the jiti loader had no such mapping; it relied on normal Node resolution.defineRpcContract— the first runtime SDK export — and the plugins adopted it. 0.0.31 bundles carry a liveimport { defineRpcContract } from "@bb/plugin-sdk", which resolves in source checkouts (workspace node_modules) but not in the packaged app, where@bb/plugin-sdkis inlined into the server bundle and never shipped as a resolvable module.Inlining the SDK into plugin bundles at build time is not a viable fix: third-party authors never have the SDK installed (it's not on npm — the scaffold maps the specifier to bundled
.d.tsfiles only), so the specifier must survive to load time and be provided by the server.Fix
defineRpcContract+ one constant, zero deps) intodist/plugin-sdk-runtime.js.@bb/plugin-sdkto that file when it exists next to the server bundle (packaged app, built checkout). Source checkouts have no such file and keep workspace resolution, so dev behavior is unchanged.build-plugin-server.ts.Why CI and the publish smoke missed it
Same blind spot as #735: clean checkouts always resolve the workspace SDK, so only packed artifacts fail. The publish workflow's tarball smoke boots the full stack but only checked
/health— plugin load failures are warn-level. The smoke now pollsbb plugin list --jsonuntil every default-enabled builtin reachesrunningand fails on any plugin inerror, closing this regression class for good.Validation
pnpm exec turbo run typecheck --filter=@bb/server --filter=@bb/plugin-buildpnpm exec turbo run smoke:tarball --filter=bb-app --force— packs the tarball, boots it, and all five default-enabled builtins reachrunning(the same assertion fails against the published 0.0.31, which reportsstatus: "error"for four of five)aliasbehavior verified in isolation against the shipped jiti versionNeeds a 0.0.32 release to reach affected users; until then rolling back to 0.0.30 is the only workaround.
🤖 Generated with Claude Code