@pollen-robotics/reachy-mini-sdk 1.12.0-dev.0.main.fca0550 → 1.12.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/APP_CREATION_GUIDE.md +90 -41
- package/README.md +1 -1
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.d.ts.map +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/lib/version.js.map +1 -1
- package/host/README.md +2 -2
- package/package.json +1 -1
package/APP_CREATION_GUIDE.md
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
# App Creation Guide
|
|
2
2
|
|
|
3
|
-
> ### Use `@pollen-robotics/reachy-mini-sdk
|
|
3
|
+
> ### Use the latest `@pollen-robotics/reachy-mini-sdk` release
|
|
4
4
|
>
|
|
5
|
-
>
|
|
6
|
-
>
|
|
7
|
-
>
|
|
5
|
+
> Install the latest stable release from
|
|
6
|
+
> [npm](https://www.npmjs.com/package/@pollen-robotics/reachy-mini-sdk):
|
|
7
|
+
>
|
|
8
|
+
> ```bash
|
|
9
|
+
> npm install @pollen-robotics/reachy-mini-sdk@latest
|
|
10
|
+
> ```
|
|
11
|
+
>
|
|
12
|
+
> This pins the exact resolved version in your `package.json` (npm
|
|
13
|
+
> versions are immutable, so this is fully reproducible). The minimum
|
|
14
|
+
> supported version is **`1.8.0`** — anything older predates the host
|
|
15
|
+
> shell contract described here. Every
|
|
16
|
+
> reference app pins the same SDK release. The host shell, the embed
|
|
8
17
|
> adapter, the SDK runtime, and the daemon on the robot are validated
|
|
9
18
|
> end-to-end against that release. Mixing versions across these
|
|
10
19
|
> boundaries causes silent protocol drift - see
|
|
11
20
|
> [§10 SDK version pinning](#10-sdk-version-pinning).
|
|
12
|
-
>
|
|
13
|
-
> Add this to your `package.json`:
|
|
14
|
-
>
|
|
15
|
-
> ```json
|
|
16
|
-
> { "dependencies": { "@pollen-robotics/reachy-mini-sdk": "1.8.0" } }
|
|
17
|
-
> ```
|
|
18
21
|
|
|
19
22
|
**This is the single source of truth for building a Reachy Mini JS
|
|
20
23
|
app.** [`../AGENTS.md`](../AGENTS.md) at the repo root points here;
|
|
@@ -127,7 +130,8 @@ npm run dev
|
|
|
127
130
|
```
|
|
128
131
|
|
|
129
132
|
All three reference apps pin `@pollen-robotics/reachy-mini-sdk` to
|
|
130
|
-
the same
|
|
133
|
+
the same exact version (the latest npm release) in their
|
|
134
|
+
`package.json` - see [§10 SDK version pinning](#10-sdk-version-pinning).
|
|
131
135
|
|
|
132
136
|
> **Prefer a no-build path?** You can also ship the app as a single
|
|
133
137
|
> `index.html` with the SDK loaded from a CDN. No `package.json`, no
|
|
@@ -363,6 +367,7 @@ The resolved `handle` exposes:
|
|
|
363
367
|
interface ConnectedHandle<TConfig> {
|
|
364
368
|
// Live state at boot
|
|
365
369
|
reachy: ReachyMiniInstance; // SDK instance, session live, robot awake
|
|
370
|
+
media: RobotMedia; // WebRTC streams - see "Video: use `handle.media`"
|
|
366
371
|
theme: 'dark' | 'light';
|
|
367
372
|
config: TConfig | null;
|
|
368
373
|
appName: string;
|
|
@@ -385,6 +390,41 @@ The API is intentionally minimal. If you need a custom channel
|
|
|
385
390
|
between host and embed, file a feature request - we'll add it as
|
|
386
391
|
a typed message rather than expose a free-form sink.
|
|
387
392
|
|
|
393
|
+
### Video: use `handle.media`
|
|
394
|
+
|
|
395
|
+
`connectToHost()` resolves only *after* the WebRTC handshake is
|
|
396
|
+
complete. By the time your app mounts, the SDK's one-shot
|
|
397
|
+
`videoTrack` event and the underlying `pc.ontrack` have **already
|
|
398
|
+
fired**. So `reachy.attachVideo(el)` installs a listener that never
|
|
399
|
+
fires, and an embed never calls `startSession()` again: the element
|
|
400
|
+
stays black forever, with no error anywhere.
|
|
401
|
+
|
|
402
|
+
`handle.media` exists for exactly this. It replays the streams from a
|
|
403
|
+
synchronous snapshot of the peer connection's receivers, so a
|
|
404
|
+
late-mounting consumer sees the camera immediately:
|
|
405
|
+
|
|
406
|
+
```ts
|
|
407
|
+
interface RobotMedia {
|
|
408
|
+
attachVideo(el: HTMLVideoElement): () => void; // returns a detach fn
|
|
409
|
+
readonly robotStream: MediaStream | null; // robot video + audio
|
|
410
|
+
readonly micStream: MediaStream | null; // local mic, if enabled
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
const handle = await connectToHost();
|
|
414
|
+
const detach = handle.media.attachVideo(videoEl);
|
|
415
|
+
handle.onLeave(() => detach());
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
There is no equivalent race for the data channel, mute toggles, motor
|
|
419
|
+
commands or state updates: the bridge resolves only once ICE **and**
|
|
420
|
+
the data channel are connected, and state events keep arriving (every
|
|
421
|
+
~500 ms, or ~30 Hz after `subscribePose()`). Keep calling `reachy.setHeadRpyDeg(...)`,
|
|
422
|
+
`reachy.setMicMuted(...)` and `reachy.addEventListener('state', ...)`
|
|
423
|
+
directly.
|
|
424
|
+
|
|
425
|
+
`reachy.attachVideo()` remains correct in a **standalone** app
|
|
426
|
+
(`mountHost`), where your code runs before the session starts.
|
|
427
|
+
|
|
388
428
|
### Typing your config
|
|
389
429
|
|
|
390
430
|
`connectToHost<T>()` types the `config` field; runtime validation
|
|
@@ -645,30 +685,31 @@ Pin yours the same way - mixing versions across `@pollen-robotics/reachy-mini-sd
|
|
|
645
685
|
`@pollen-robotics/reachy-mini-sdk/host`, and the daemon on the robot
|
|
646
686
|
produces hard-to-debug protocol drift.
|
|
647
687
|
|
|
648
|
-
|
|
688
|
+
Install the latest stable release from
|
|
689
|
+
[npm](https://www.npmjs.com/package/@pollen-robotics/reachy-mini-sdk):
|
|
649
690
|
|
|
650
|
-
```
|
|
651
|
-
|
|
652
|
-
"dependencies": {
|
|
653
|
-
"@pollen-robotics/reachy-mini-sdk": "1.8.0"
|
|
654
|
-
}
|
|
655
|
-
}
|
|
691
|
+
```bash
|
|
692
|
+
npm install @pollen-robotics/reachy-mini-sdk@latest
|
|
656
693
|
```
|
|
657
694
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
the
|
|
662
|
-
tracking a newer
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
695
|
+
npm writes the exact resolved version into your `package.json`. npm
|
|
696
|
+
versions are immutable, so pinning the exact version is fully
|
|
697
|
+
reproducible — no commit suffix needed. The stable release is
|
|
698
|
+
validated end-to-end against the host shell + daemon. **Use the exact
|
|
699
|
+
version string npm writes** unless you're explicitly tracking a newer
|
|
700
|
+
release. In all cases the version must be **`>= 1.8.0`** — older
|
|
701
|
+
releases predate the host shell + protocol v1 contract and are not
|
|
702
|
+
supported.
|
|
703
|
+
|
|
704
|
+
> The source of truth for "what's current" is the
|
|
705
|
+
> [npm package page](https://www.npmjs.com/package/@pollen-robotics/reachy-mini-sdk)
|
|
706
|
+
> (`npm view @pollen-robotics/reachy-mini-sdk version` works too), and
|
|
707
|
+
> whichever string is currently shared by [`reachy_mini_minimal_conversation`'s
|
|
666
708
|
> `package.json`](https://huggingface.co/spaces/pollen-robotics/reachy_mini_minimal_conversation/blob/main/package.json),
|
|
667
709
|
> [`reachy_mini_emotions`'s `package.json`](https://huggingface.co/spaces/pollen-robotics/reachy_mini_emotions/blob/main/package.json),
|
|
668
710
|
> and [`reachy_mini_telepresence`'s `package.json`](https://huggingface.co/spaces/pollen-robotics/reachy_mini_telepresence/blob/main/package.json).
|
|
669
|
-
> If those three diverge, fall back to whatever this guide says.
|
|
670
711
|
|
|
671
|
-
### Why pin a specific build (not `^
|
|
712
|
+
### Why pin a specific build (not `^x.y.z` or a major like `@1`)?
|
|
672
713
|
|
|
673
714
|
The host shell, the embed adapter (`connectToHost`), the SDK, and the
|
|
674
715
|
robot daemon negotiate over a versioned WebRTC data-channel protocol.
|
|
@@ -920,16 +961,18 @@ my-bare-app/
|
|
|
920
961
|
|
|
921
962
|
**Importing the SDK from a CDN**
|
|
922
963
|
|
|
923
|
-
Pin to an exact
|
|
924
|
-
`package.json
|
|
925
|
-
|
|
926
|
-
|
|
964
|
+
Pin to an exact version - **the same string you would use in
|
|
965
|
+
`package.json`**, i.e. the latest release shown on
|
|
966
|
+
[npm](https://www.npmjs.com/package/@pollen-robotics/reachy-mini-sdk)
|
|
967
|
+
(see [§10 SDK version pinning](#10-sdk-version-pinning)). Substitute it
|
|
968
|
+
for `<version>` below. jsDelivr's `/+esm` suffix tells the CDN to bundle
|
|
969
|
+
the package to ESM at the edge:
|
|
927
970
|
|
|
928
971
|
```html
|
|
929
972
|
<script type="module">
|
|
930
|
-
import { ReachyMini } from "https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk
|
|
931
|
-
import { mountHost } from "https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk
|
|
932
|
-
import { connectToHost } from "https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk
|
|
973
|
+
import { ReachyMini } from "https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@<version>/+esm";
|
|
974
|
+
import { mountHost } from "https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@<version>/host/dist/entry/auto.js";
|
|
975
|
+
import { connectToHost } from "https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@<version>/host/dist/entry/embed.js";
|
|
933
976
|
|
|
934
977
|
window.ReachyMini = ReachyMini;
|
|
935
978
|
window.dispatchEvent(new Event("reachymini:ready"));
|
|
@@ -993,9 +1036,10 @@ shell without touching your motion code. The four-step recipe:
|
|
|
993
1036
|
import { ReachyMini } from "https://cdn.jsdelivr.net/gh/pollen-robotics/reachy_mini@v1.7.2/js/reachy-mini.js";
|
|
994
1037
|
|
|
995
1038
|
// AFTER (modern host shell, same SDK runtime API)
|
|
996
|
-
|
|
997
|
-
import {
|
|
998
|
-
import {
|
|
1039
|
+
// <version> = latest release on npm (see §10 SDK version pinning)
|
|
1040
|
+
import { ReachyMini } from "https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@<version>/+esm";
|
|
1041
|
+
import { mountHost } from "https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@<version>/host/dist/entry/auto.js";
|
|
1042
|
+
import { connectToHost } from "https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@<version>/host/dist/entry/embed.js";
|
|
999
1043
|
```
|
|
1000
1044
|
|
|
1001
1045
|
2. **Branch on `?embedded=1`.** Wrap your existing app boot in:
|
|
@@ -1030,8 +1074,11 @@ shell without touching your motion code. The four-step recipe:
|
|
|
1030
1074
|
only exists on the modern SDK; if you weren't using it, nothing
|
|
1031
1075
|
changes. If you reached into private fields like `robot._pc`
|
|
1032
1076
|
(RTCPeerConnection), prefer the public alternatives:
|
|
1033
|
-
`
|
|
1034
|
-
`mountHost` for bidirectional audio.
|
|
1077
|
+
`handle.media.attachVideo(videoEl)` for video, `enableMicrophone: true`
|
|
1078
|
+
on `mountHost` for bidirectional audio. Once embedded, use
|
|
1079
|
+
`handle.media.attachVideo()` and **not** `robot.attachVideo()`: the
|
|
1080
|
+
latter silently no-ops because the handshake completed before your
|
|
1081
|
+
app mounted (see [§5 Video](#video-use-handlemedia)).
|
|
1035
1082
|
|
|
1036
1083
|
Your `README.md` frontmatter doesn't need any changes: `sdk: static`
|
|
1037
1084
|
and `hf_oauth: true` work for both variants. You can still skip
|
|
@@ -1467,7 +1514,9 @@ rolled out by the SDK team, not by every app team.
|
|
|
1467
1514
|
- App bundles (`index-<hash>.js`): hashed by Vite, cache-busted
|
|
1468
1515
|
on deploy.
|
|
1469
1516
|
- `@pollen-robotics/reachy-mini-sdk` in `package.json`: pinned to
|
|
1470
|
-
an **exact version** (
|
|
1517
|
+
an **exact version** (the latest release on
|
|
1518
|
+
[npm](https://www.npmjs.com/package/@pollen-robotics/reachy-mini-sdk)),
|
|
1519
|
+
not a range. See
|
|
1471
1520
|
[§10 SDK version pinning](#10-sdk-version-pinning).
|
|
1472
1521
|
- `@pollen-robotics/reachy-mini-sdk/host` subpath imports: same
|
|
1473
1522
|
pin, same package.
|
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ See the JSDoc header in [`reachy-mini-sdk.js`](./reachy-mini-sdk.js) for the ful
|
|
|
98
98
|
|
|
99
99
|
For Hugging Face Spaces apps that need OAuth + a robot picker + iframe lifecycle management:
|
|
100
100
|
|
|
101
|
-
- **[`APP_CREATION_GUIDE.md`](./APP_CREATION_GUIDE.md)** — single source of truth for app authors (scaffold, `sdk: static` deploy, host ↔ embed contract, invariants).
|
|
101
|
+
- **[`APP_CREATION_GUIDE.md`](./APP_CREATION_GUIDE.md)** — single source of truth for app authors (scaffold, `sdk: static` deploy, host ↔ embed contract, invariants). SDK pin: the latest stable release on [npm](https://www.npmjs.com/package/@pollen-robotics/reachy-mini-sdk).
|
|
102
102
|
- [`host/README.md`](./host/README.md) — one-page tour of the host package layout
|
|
103
103
|
|
|
104
104
|
## Migration from `@pollen-robotics/reachy-mini-host`
|
package/dist/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.12.0-
|
|
1
|
+
export declare const SDK_VERSION = "1.12.0-rc.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../lib/version.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../lib/version.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,gBAAgB,CAAC"}
|
package/dist/lib/version.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// AUTO-GENERATED by scripts/gen-version.mjs — DO NOT EDIT.
|
|
2
2
|
// Source of truth is the `version` field in package.json (bumped by CI at
|
|
3
3
|
// release). Regenerated by the `prebuild:sdk` npm lifecycle hook.
|
|
4
|
-
export const SDK_VERSION = "1.12.0-
|
|
4
|
+
export const SDK_VERSION = "1.12.0-rc.1";
|
|
5
5
|
//# sourceMappingURL=version.js.map
|
package/dist/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../lib/version.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,0EAA0E;AAC1E,kEAAkE;AAClE,MAAM,CAAC,MAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../lib/version.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,0EAA0E;AAC1E,kEAAkE;AAClE,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC"}
|
package/host/README.md
CHANGED
|
@@ -32,7 +32,7 @@ The same app code works in both modes; only the entry point differs.
|
|
|
32
32
|
|
|
33
33
|
| Document | Audience | Read it when… |
|
|
34
34
|
|----------|----------|----------------|
|
|
35
|
-
| **[`../APP_CREATION_GUIDE.md`](../APP_CREATION_GUIDE.md)** | app authors **and** host maintainers | Single source of truth: scaffold, `sdk: static` deploy, host ↔ embed contract, invariants, protocol v1.
|
|
35
|
+
| **[`../APP_CREATION_GUIDE.md`](../APP_CREATION_GUIDE.md)** | app authors **and** host maintainers | Single source of truth: scaffold, `sdk: static` deploy, host ↔ embed contract, invariants, protocol v1. SDK pin: the latest stable release on [npm](https://www.npmjs.com/package/@pollen-robotics/reachy-mini-sdk). |
|
|
36
36
|
|
|
37
37
|
App authors and library maintainers both start with the
|
|
38
38
|
**[App Creation Guide](../APP_CREATION_GUIDE.md)**: §1-§12 are the
|
|
@@ -149,7 +149,7 @@ incompatible postMessage changes
|
|
|
149
149
|
(see [`APP_CREATION_GUIDE.md` §13.6](../APP_CREATION_GUIDE.md#136-protocol-v1-messages)).
|
|
150
150
|
|
|
151
151
|
App authors should **pin to the exact version that the reference
|
|
152
|
-
apps use** -
|
|
152
|
+
apps use** - the latest stable release on [npm](https://www.npmjs.com/package/@pollen-robotics/reachy-mini-sdk), see
|
|
153
153
|
[`APP_CREATION_GUIDE.md` §10](../APP_CREATION_GUIDE.md#10-sdk-version-pinning).
|
|
154
154
|
|
|
155
155
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pollen-robotics/reachy-mini-sdk",
|
|
3
|
-
"version": "1.12.0-
|
|
3
|
+
"version": "1.12.0-rc.1",
|
|
4
4
|
"description": "Browser SDK for controlling a Reachy Mini robot over WebRTC, plus an optional Hugging Face Spaces host shell (OAuth + robot picker + iframe bridge) exposed via the ./host subpath.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/reachy-mini-sdk.js",
|