Skip to content

Expose public bb-app SDK - #343

Merged
ymichael merged 1 commit into
mainfrom
bb/import-bbsdk-modules-thr_7vw3bzbyww
Jun 24, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/import-bbsdk-modules-thr_7vw3bzbyww

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Summary

  • expose a Node scripting SDK from the published bb-app package via import { BBSdk } from "bb-app"
  • move shared thread spawn normalization and wait behavior into @bb/sdk, with bb thread wait delegating to it
  • build and package dist/index.js / dist/index.d.ts, document the SDK, and add tarball smoke coverage for JS/TS imports plus a live SDK status call

Validation

  • pnpm exec turbo run typecheck --filter=@bb/sdk --filter=@bb/cli --filter=bb-app --filter=@bb/server-contract
  • pnpm exec turbo run test --filter=@bb/sdk --force
  • pnpm exec turbo run test --filter=@bb/server-contract --force
  • pnpm exec turbo run test --filter=@bb/cli --force
  • pnpm exec turbo run test --filter=bb-app --force
  • pnpm exec turbo run build --filter=bb-app --force
  • pnpm exec turbo run smoke:tarball --filter=bb-app --force
  • git diff --check

@ymichael
ymichael marked this pull request as ready for review June 24, 2026 16:58
@ymichael
ymichael merged commit d3a08f6 into main Jun 24, 2026
6 checks passed
@ymichael
ymichael deleted the bb/import-bbsdk-modules-thr_7vw3bzbyww branch June 24, 2026 17:12
SawyerHood added a commit that referenced this pull request Jun 25, 2026
## Problem

The packaged desktop app crashes at startup:

```
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/bb-app.js' is
not defined by "exports" in .../node_modules/bb-app/package.json imported from
.../dist/bb-app-bridge.mjs
```

## Root cause

The desktop bridge (`apps/desktop/src/bb-app-bridge.ts`) boots the app
via a
side-effect import of the launcher entry:

```ts
import "bb-app/dist/bb-app.js";
```

Before #343, `bb-app` had no `exports` field, so Node allowed any deep
import.
#343 ("Expose public bb-app SDK") added an `exports` map declaring only
the
`"."` entry. Once `exports` is present, Node's exports encapsulation
rejects
every subpath that isn't listed — breaking the bridge's deep import.

`npx bb-app` is unaffected because it launches through the `bin` field
(a direct
file path that bypasses module-exports resolution), which is why only
the
desktop app failed.

## Fix

Add the `./dist/bb-app.js` subpath to the `exports` map. Verified with
`import.meta.resolve` that both the deep launcher import and the root
SDK entry
resolve correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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.

1 participant