Skip to content

feat(js): merge host package into reachy-mini-sdk#1141

Merged
tfrere merged 5 commits into
mainfrom
feat/merge-js-packages
May 21, 2026
Merged

feat(js): merge host package into reachy-mini-sdk#1141
tfrere merged 5 commits into
mainfrom
feat/merge-js-packages

Conversation

@tfrere
Copy link
Copy Markdown
Contributor

@tfrere tfrere commented May 21, 2026

Summary

Fold @pollen-robotics/reachy-mini-host into @pollen-robotics/reachy-mini-sdk so app authors install, version, and import from a single entry point. The SDK and the host shell already shipped in lockstep (single repo, single release); the second package was just extra friction.

- "@pollen-robotics/reachy-mini-host": "^1.x",
- "@pollen-robotics/reachy-mini-sdk":  "^1.x"
+ "@pollen-robotics/reachy-mini-sdk":  "^1.x"
- import { mountHost }        from '@pollen-robotics/reachy-mini-host/auto';
- import { connectToHost }    from '@pollen-robotics/reachy-mini-host/embed';
- import { PROTOCOL_VERSION } from '@pollen-robotics/reachy-mini-host/protocol';
+ import { mountHost }        from '@pollen-robotics/reachy-mini-sdk/host/auto';
+ import { connectToHost }    from '@pollen-robotics/reachy-mini-sdk/host/embed';
+ import { PROTOCOL_VERSION } from '@pollen-robotics/reachy-mini-sdk/host/protocol';

What changes

Layout

  • js/host/js/sdk/host/ (the whole directory; git tracks it as a pure rename so blame survives)
  • js/sdk/host/src/lib/sdk-types.tsjs/sdk/reachy-mini-sdk.d.ts (the canonical type declarations now ship as the .d.ts companion next to the SDK runtime; host re-exports them from the new location)
  • js/package.json (workspace root) deleted: there is now a single npm package, js/sdk/
  • js/package-lock.jsonjs/sdk/package-lock.json

Package surface (js/sdk/package.json)

Single package, new subpath exports:

Export Resolves to Use
. reachy-mini-sdk.js The ReachyMini class (unchanged)
./host host/dist/index.js mountHost, connectToHost, types
./host/auto host/dist/entry/auto.js CDN auto bundle
./host/embed host/dist/entry/embed.js CDN embed bundle
./host/protocol host/dist/lib/protocol.js PROTOCOL_VERSION, helpers

React/MUI/Emotion deps + devDeps for the host build moved into the SDK package. npm run build (from js/sdk/) drives vite + tsc end-to-end.

Runtime cleanup

The host's entry/auto.ts, entry/embed.ts and the ./host npm entry now import ReachyMini directly from the SDK module and self-assign window.ReachyMini (when unset) before exposing window.ReachyMiniHost / window.ReachyMiniHostEmbed. Effects:

  • Apps consuming the host no longer need a separate <script type="module"> to load the SDK on the global.
  • Legacy apps that still set window.ReachyMini themselves are untouched (we only assign when missing).
  • useSdk / connectToHost stop racing against a late-arriving global.

Log-prefix tag harmonised to [reachy-mini-sdk/host] / [reachy-mini-sdk/host/embed] for greppability.

CI

.github/workflows/npm-publish.yml simplified: one npm ci, one npm run build, one npm publish (no more --workspace=sdk / --workspace=host pairs). The version-from-pyproject.toml flow is unchanged.

Docs

  • js/README.md rewritten for the single-package layout (with a migration note).
  • js/sdk/README.md adds the ./host subpath section + migration note.
  • js/sdk/host/{README,SPEC,APP_AUTHOR_GUIDE,CHANGELOG}.md updated to the new import paths.
  • docs/source/SDK/javascript-sdk.md cross-links the host subpath exports.

Compat / rollout

  • @pollen-robotics/reachy-mini-host stays available on npm at its current version for one minor cycle so consumers can switch on their own schedule, then we'll npm deprecate it with a pointer to the new subpaths. The post-deprecation tarball is a tiny shim that re-exports from @pollen-robotics/reachy-mini-sdk/host.
  • Reference apps (reachy_mini_emotions, reachy_mini_telepresence, reachy_mini_minimal_conversation) are already on ^1.7.3 of both packages and have been independently migrated to the new import paths (see the corresponding app repos).

Test plan

  • cd js/sdk && npm ci && npm run typecheck && npm run build (clean)
  • cd js/sdk && npm pack --dry-run — single tarball, contains reachy-mini-sdk.js, reachy-mini-sdk.d.ts, host/dist/, host/{README,SPEC,APP_AUTHOR_GUIDE,CHANGELOG}.md
  • CI dry-run on the PR (npm-publish workflow re-pointed at js/sdk/)
  • Manual smoke: load host/dist/entry/auto.js from a local Space — host renders, window.ReachyMini is set without an SDK script tag
  • Manual smoke: import mountHost from @pollen-robotics/reachy-mini-sdk/host in a bundler-driven app, confirm SDK is initialised before useSdk reads it

Made with Cursor

Fold @pollen-robotics/reachy-mini-host into @pollen-robotics/reachy-mini-sdk
so app authors install, version, and import from a single entry point:

  import { ReachyMini }       from '@pollen-robotics/reachy-mini-sdk';
  import { mountHost }        from '@pollen-robotics/reachy-mini-sdk/host/auto';
  import { connectToHost }    from '@pollen-robotics/reachy-mini-sdk/host/embed';
  import { PROTOCOL_VERSION } from '@pollen-robotics/reachy-mini-sdk/host/protocol';

Layout changes
- js/host/                    -> js/sdk/host/                (whole directory)
- js/host/src/lib/sdk-types   -> js/sdk/reachy-mini-sdk.d.ts (canonical types,
                                shipped as .d.ts companion to the SDK runtime;
                                host re-exports from the new location)
- js/package.json (workspaces) deleted; js/sdk/ is now the only npm package
- js/package-lock.json moved to js/sdk/package-lock.json

Package surface
- New subpath exports on @pollen-robotics/reachy-mini-sdk:
    ./host           (mountHost + types)
    ./host/auto      (CDN auto bundle)
    ./host/embed     (CDN embed bundle)
    ./host/protocol  (PROTOCOL_VERSION + helpers)
- Host React/MUI deps and devDeps moved into js/sdk/package.json
- Single build script (`npm run build`) drives vite + tsc for the host bundles
- CI publishes one tarball instead of two (--workspace flags dropped)

Runtime cleanup
- entry/auto.ts, entry/embed.ts and the `./host` npm entry now import
  ReachyMini directly from the SDK module and self-assign window.ReachyMini
  (when unset) at module-load time, dispatching reachymini:ready before
  exposing window.ReachyMiniHost / ReachyMiniHostEmbed. Apps that consume
  the host no longer need a separate `<script type="module">` to load the
  SDK on the global; legacy apps that still set it themselves are
  untouched (we only assign when missing).
- Log-prefix tag harmonised to [reachy-mini-sdk/host] / [reachy-mini-sdk/host/embed]
  for greppability.

Docs
- js/README.md rewritten for single-package layout + migration note
- js/sdk/README.md adds the ./host subpath section + migration note
- js/sdk/host/{README,SPEC,APP_AUTHOR_GUIDE,CHANGELOG}.md updated to the
  new import paths
- docs/source/SDK/javascript-sdk.md cross-links the host subpaths

Compat
- @pollen-robotics/reachy-mini-host stays available on npm at its current
  version for one minor cycle to give consumers time to switch, then will
  be deprecated with a pointer to the new subpaths.

Co-authored-by: Cursor <cursoragent@cursor.com>
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

tfrere and others added 3 commits May 21, 2026 17:09
… js/

Now that there is only one npm package, the `sdk/` directory level
no longer carries meaning. Move everything up one level so:

  js/
  ├── package.json            # @pollen-robotics/reachy-mini-sdk
  ├── package-lock.json
  ├── README.md               # the published package README
  ├── LICENSE
  ├── reachy-mini-sdk.js
  ├── reachy-mini-sdk.d.ts
  └── host/                   # was js/sdk/host/

No public-API change. Internal updates:

- `js/package.json`: `repository.directory` "js/sdk" → "js".
- `.github/workflows/npm-publish.yml`: `working-directory: js/sdk`
  → `js`, and the `pyproject.toml` relative path goes from
  `../../pyproject.toml` back to `../pyproject.toml`.
- `.gitignore`: prefixes shed (`js/sdk/node_modules` → `js/node_modules`,
  `js/sdk/host/dist` → `js/host/dist`, etc.).
- `tests/unit_tests/test_no_token_in_urls.py` and
  `tests/unit_tests/test_js_protocol_sync.py`: SDK path
  `js/sdk/reachy-mini-sdk.js` → `js/reachy-mini-sdk.js`.
- `AGENTS.md`, `docs/source/SDK/javascript-sdk.md`,
  `js/host/CHANGELOG.md`, `js/host/src/lib/sdk-types.ts`: stale
  `js/sdk/...` link / comment refs updated.
- `js/sdk/README.md` (the workspace overview that lived alongside
  the published one) is gone; the package README at `js/README.md`
  is now the only one.

Relative imports inside the host (`../../reachy-mini-sdk`,
`../../../reachy-mini-sdk`) stay valid because the host moved up
one level along with everything else — same number of `..` hops to
reach the SDK runtime.

`npm install && npm run typecheck && npm run build && npm pack --dry-run`
from `js/` is clean; tarball is byte-identical in shape to the
previous commit (1.7 MB, 85 files).

Co-authored-by: Cursor <cursoragent@cursor.com>
- `pyproject.toml`: 1.7.3 → 1.8.1 (drives the npm package version
  via the publish CI). `uv.lock` regenerated.
- `js/host/CHANGELOG.md` → `js/CHANGELOG.md`: now that the host
  is a subpath of the SDK, the changelog covers the whole package.
- 1.8.1 entry rewritten as the headline release note: package
  merge (host folded in), new `./host*` subpath exports, runtime
  cleanup (host bundles import the SDK directly + auto-install
  `window.ReachyMini`), repo layout collapse, and the SDK changes
  that landed earlier in the 1.8 cycle but weren't yet published.
- `js/package.json`: `files` array swaps `host/CHANGELOG.md` for
  the package-root `CHANGELOG.md`.
- `js/README.md` cross-links the new CHANGELOG location; the host
  README cross-links it as `../CHANGELOG.md`.

Why 1.8.1 and not 1.8.0
- 1.8.0 had been earmarked internally for a different in-flight
  bump; using 1.8.1 keeps a clean number for the unified-package
  release without competing with that train.

npm publish CI is unchanged; it will read 1.8.1 from
`pyproject.toml` and publish the single `@pollen-robotics/reachy-mini-sdk`
tarball on the next push to `main` (with `-main.<sha>` suffix) or
on the next GitHub release (with the `latest` dist-tag).

Co-authored-by: Cursor <cursoragent@cursor.com>
The previous commit (8b77153) pinned `pyproject.toml` to `1.8.1`
inside the PR. The convention in this repo is to bump the version
at release time (cf. `d0d3ba28 bump to 1.7.3`, `22f862bc enhancement
#1077: bump to 1.7.1`), not in feature PRs. Revert:

- `pyproject.toml`: `1.8.1` → `1.7.3` (back to the previous
  released version; the npm `main` channel currently serves
  `1.7.3-main.<sha>`).
- `uv.lock`: regenerated to match.
- `js/CHANGELOG.md`: the `1.8.1 - unreleased` header is now
  `Unreleased — succeeds 1.7.3`. The intro explicitly states the
  target version is left unset and will be picked at release time.

No other content reverted: the merge structure, CHANGELOG body,
and CI workflow stay as-is. Whoever cuts the next release just
needs to:

1. Bump `pyproject.toml` (likely a minor bump given the breaking
   import-path change for `@pollen-robotics/reachy-mini-host`
   consumers, but the exact number is a release-time decision).
2. `uv lock --upgrade-package reachy-mini`.
3. Rename the `Unreleased — succeeds 1.7.3` header in
   `js/CHANGELOG.md` to `<version> - YYYY-MM-DD`.
4. Push the GitHub release; npm publish CI takes over.

Co-authored-by: Cursor <cursoragent@cursor.com>
`tests/unit_tests/test_js_protocol_sync.py` carries the SDK file
path in a module-level constant (`JS_SDK_PATH`) on top of the
docstring reference I'd already updated. The `js/sdk/` collapse
left the constant pointing at the old location, so the three
tests that read `js/sdk/reachy-mini-sdk.js` (command type sync,
field shape sync, error code sync) failed with `FileNotFoundError`.

Bring the constant in line with the actual layout
(`js/reachy-mini-sdk.js`). All 6 JS-protocol-related tests now
pass; the other unrelated failures in `tests/unit_tests/` are the
pre-existing audio / daemon / placo / video / wireless ones that
need hardware or system deps absent on this machine.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tfrere tfrere merged commit b44388c into main May 21, 2026
10 checks passed
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