Repository navigation
Plugin SDK 0.3: consolidated API and SDK change - #716
Merged
Merged
Conversation
# Conflicts: # packages/plugin-sdk/bundled-types/bb-plugin-sdk.d.ts # packages/plugin-sdk/src/testing/__tests__/fake-plugin-host.test.ts # packages/plugin-sdk/src/testing/fake-plugin-host.ts # packages/templates/src/generated/plugin-sdk-dts.generated.ts # packages/templates/src/generated/templates.generated.ts
# Conflicts: # packages/templates/src/generated/plugin-sdk-dts.generated.ts # packages/templates/src/generated/templates.generated.ts # packages/templates/src/templates/bb-guide-plugins.md
…ion/plugin-1-0-official-example-base # Conflicts: # apps/app/src/views/PluginPanelView.tsx # apps/server/src/services/plugins/plugin-runtime.ts # apps/server/src/services/skills/builtin-skills/bb-plugin-authoring/SKILL.md # packages/templates/src/generated/plugin-sdk-dts.generated.ts # packages/templates/src/generated/templates.generated.ts # plans/plugin-system-qa-catalog.md
This was referenced Jul 15, 2026
Collaborator
Author
|
Overnight Plugin 1.0 live E2E is complete.
The isolated dev app remains available through the owner-gated share. |
SawyerHood
added a commit
that referenced
this pull request
Jul 16, 2026
…735) ## Summary Booting bb after the Plugin SDK 0.3 bump (#716) failed to load every builtin plugin: ``` plugin automations failed to load: bb.storage.sqlite is not a function plugin connect failed to load: rpc.register handlers must be an object ``` `resolveServerEntry` prefers a prebuilt `dist/server.js` for non-path installs, gated only on `sdkMajor`. Bundles built with SDK 0.2.0 pass that check under the 0.3.0 server (both major 0), so stale bundles left in `plugins/*/dist` by an earlier packaging run kept loading and hit renamed 0.3 APIs. The `secrets` plugin was worse: its stale bundle loaded "successfully" and silently ran 0.2 code. CI never catches this because `plugins/*/dist` is gitignored — clean checkouts always fall back to source. ## Fix Pre-1.0, minor SDK bumps are breaking per semver, so prebuilt compatibility now requires the exact SDK version (`isPrebuiltServerSdkCompatible`). Once the SDK reaches 1.0, matching major suffices as before. Rejected bundles fall back to source with a warning naming the full built/running versions. This mirrors the frontend bundle path, which already compares full `sdkVersion` and rebuilds. Managed-install validation (`validatePluginArtifactMeta`) and the frontend `compatible` flag keep their major-only checks — engine ranges are the documented pre-1.0 gate there. ## Testing - New regression test: same major, different minor → source entry wins (`prebuilt-server-loading.test.ts`), alongside existing fresh-dist / path-install / major-mismatch cases; all pass. - `turbo run typecheck --filter=@bb/server` clean. - Verified live: deleted the stale dists, reloaded builtins on a running 0.3 server — all five now `running`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <[email protected]>
SawyerHood
added a commit
that referenced
this pull request
Jul 18, 2026
…#794) ## Problem The published **bb-app 0.0.31 boots with every builtin plugin except `secrets` failing** — connect, automations, custom-instructions, inline-vis all report: ``` plugin connect failed to load: Cannot find module '@bb/plugin-sdk' ``` 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: 1. `buildPluginServer` keeps `@bb/plugin-sdk` external 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. 2. That was accidentally fine until now: plugins only imported SDK **types**, which are erased at build. Every 0.0.30 bundle has zero runtime SDK references. 3. Plugin SDK 0.3 (#716) introduced `defineRpcContract` — the first **runtime** SDK export — and the plugins adopted it. 0.0.31 bundles carry a live `import { defineRpcContract } from "@bb/plugin-sdk"`, which resolves in source checkouts (workspace node_modules) but not in the packaged app, where `@bb/plugin-sdk` is 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.ts` files only), so the specifier must survive to load time and be provided by the server. ## Fix - The server build now bundles the SDK runtime (tiny: `defineRpcContract` + one constant, zero deps) into `dist/plugin-sdk-runtime.js`. - 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, so dev behavior is unchanged. - This fixes builtins, store officials, and third-party plugins (bundled *and* source-loaded) in one place, matching the original design intent. - Updated the stale comments in `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 polls `bb plugin list --json` until every default-enabled builtin reaches `running` and fails on any plugin in `error`, closing this regression class for good. ## Validation - `pnpm exec turbo run typecheck --filter=@bb/server --filter=@bb/plugin-build` - `pnpm exec turbo run smoke:tarball --filter=bb-app --force` — packs the tarball, boots it, and all five default-enabled builtins reach `running` (the same assertion fails against the published 0.0.31, which reports `status: "error"` for four of five) - jiti `alias` behavior verified in isolation against the shipped jiti version Needs 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](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <[email protected]>
Closed
3 tasks done
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.
Summary
This is the single consolidated Plugin SDK 0.3 API/SDK review and landing PR. It preserves the 18 reviewed component histories as ancestry while presenting one combined diff against
main.mainbase:1449fbbbe56dcb738c88bb1fc5a6a3ae04ac1c4464da9a9e8efa4480fbf1ec6bd05bc9fc22bf8e0314c53c277f9298b0a56c1a6b823136b5c348ead6249b50ba0a2a3c269ef2c96e00797e595363fb87What changed and why
ThreadSpawnResult,FileReadResult, andProjectGetResult, and every supported SDK entrypoint exports the same contract.bb.name,bb.description, and explicitbb.branding; separated package identity from human-facing identity; defined compact icon versus roomy light/dark logo behavior.bb.ui.requestInput,bb.events.on, andstorage.database(); kept KV and relational storage separate; renamed SDK realtime observation tosubscribe; rejected duplicate keyed registrations; made reload atomic while listeners remain additive.navPanel.chrome; retained the shared title bar andheaderContent; made panel bodies full-bleed; introduced recursiveJsonValuefor persisted/transmitted params.text,setText,updateText, andclearwhile preserving attachments and reconciling mentions.defineRpcContractwith Standard Schema/Zod-compatible input and output schemas, inferred backend handlers/frontend clients, strict JSON handling, and stable validation errors.bb.agents.configureselection of registered tools, skills, and instructions with machine/provider/side-chat context.--machine/--hostselectors with documented primary fallback.bb.terminalsandbb terminalacross global/project/thread scopes, including get, rename, restart, and ID-based mutations; removed the nested compatibility shim.--client-fileCLI semantics.@bb/plugin-sdk/testingand/testing/app; added fake host/SDK, fixtures, frontend slot runtime, behavior/inspection/lifecycle views, pack/install tests, and strict external scaffold typechecks.HTTP routes remain alongside RPC because webhooks and external callers need them.
storage.kvremains alongsidestorage.database()because small JSON state and relational datasets have different limits and lifecycle needs. No1.0.0version bump is included.Diff-size accounting
The current PR has 26,127 additions, down from 36,473 after removing duplicated testing declarations.
The cleanup commit changes the testing declaration strategy from independently flattening the whole SDK to reusing the already-portable public
@bb/plugin-sdkroot. The two testing declarations fell from 10,860 to 470 lines and by 421,015 bytes. They still contain no dependency on unpublished@bb/sdkor@bb/server-contractpackages.Component PRs and review
All 18 reviewed component heads are ancestors of the current head and are now closed as superseded, without merging their individual PRs or deleting their branches:
#690, #691, #693, #694, #695, #696, #697, #698, #699, #700, #702, #703, #704, #707, #708, #709, #712, and #715.
The exhaustive API/SDK reference is included. The one permitted final review returned
REQUEST CHANGES; all four documentation findings were accepted and fixed in aggregate head64da9a9e8, with no second review pass.Current-main integration
RootComposeView.tsxby keeping one bounded query in the aggregate's earlier location and removing the duplicate declaration found by focused testing.Validation
Initial consolidation validation:
git diff --checkaudits passed.Declaration cleanup validation:
skipLibCheck: false, scaffold-vendored root resolution, and installed-package self-reference resolution.git diff --check.SDK 0.3 release coordination
@bb/plugin-sdkadvances from0.2.0to0.3.0.0.2.0and require SDK^0.3.0.^0.3.0.0.1.x/SDK0.2.xline until the new release artifacts exist.Landing policy
There is no Plugin SDK or API
1.0.0version bump in this PR.@bb/plugin-sdkadvances to the pre-1.00.3.0compatibility line.Sawyer approved merging after the final CI matrix passes.