@pollen-robotics/reachy-mini-sdk 1.7.3-main.7457b2b

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.
Files changed (85) hide show
  1. package/CHANGELOG.md +188 -0
  2. package/LICENSE +201 -0
  3. package/README.md +129 -0
  4. package/host/APP_AUTHOR_GUIDE.md +646 -0
  5. package/host/README.md +155 -0
  6. package/host/SPEC.md +618 -0
  7. package/host/dist/ReachyHost.d.ts +39 -0
  8. package/host/dist/ReachyHost.d.ts.map +1 -0
  9. package/host/dist/assets/index.d.ts +16 -0
  10. package/host/dist/assets/index.d.ts.map +1 -0
  11. package/host/dist/chunks/index-C3B3FuBC.js +402 -0
  12. package/host/dist/chunks/index-C3B3FuBC.js.map +1 -0
  13. package/host/dist/chunks/mountHost-8f-laxwI.js +48280 -0
  14. package/host/dist/chunks/mountHost-8f-laxwI.js.map +1 -0
  15. package/host/dist/chunks/reachy-mini-sdk-T3Zr7Hwc.js +1726 -0
  16. package/host/dist/chunks/reachy-mini-sdk-T3Zr7Hwc.js.map +1 -0
  17. package/host/dist/components/ConnectingView.d.ts +13 -0
  18. package/host/dist/components/ConnectingView.d.ts.map +1 -0
  19. package/host/dist/components/EmbedFrame.d.ts +16 -0
  20. package/host/dist/components/EmbedFrame.d.ts.map +1 -0
  21. package/host/dist/components/ErrorView.d.ts +21 -0
  22. package/host/dist/components/ErrorView.d.ts.map +1 -0
  23. package/host/dist/components/LeavingView.d.ts +33 -0
  24. package/host/dist/components/LeavingView.d.ts.map +1 -0
  25. package/host/dist/components/PickerView.d.ts +51 -0
  26. package/host/dist/components/PickerView.d.ts.map +1 -0
  27. package/host/dist/components/ReachyHostShell.d.ts +21 -0
  28. package/host/dist/components/ReachyHostShell.d.ts.map +1 -0
  29. package/host/dist/components/SignInView.d.ts +32 -0
  30. package/host/dist/components/SignInView.d.ts.map +1 -0
  31. package/host/dist/components/StepsProgressIndicator.d.ts +41 -0
  32. package/host/dist/components/StepsProgressIndicator.d.ts.map +1 -0
  33. package/host/dist/components/TopBar.d.ts +52 -0
  34. package/host/dist/components/TopBar.d.ts.map +1 -0
  35. package/host/dist/components/WelcomeBackOverlay.d.ts +28 -0
  36. package/host/dist/components/WelcomeBackOverlay.d.ts.map +1 -0
  37. package/host/dist/embed/index.d.ts +150 -0
  38. package/host/dist/embed/index.d.ts.map +1 -0
  39. package/host/dist/entry/auto.d.ts +12 -0
  40. package/host/dist/entry/auto.d.ts.map +1 -0
  41. package/host/dist/entry/auto.js +7 -0
  42. package/host/dist/entry/auto.js.map +1 -0
  43. package/host/dist/entry/embed.d.ts +12 -0
  44. package/host/dist/entry/embed.d.ts.map +1 -0
  45. package/host/dist/entry/embed.js +7 -0
  46. package/host/dist/entry/embed.js.map +1 -0
  47. package/host/dist/hooks/useHfProfile.d.ts +7 -0
  48. package/host/dist/hooks/useHfProfile.d.ts.map +1 -0
  49. package/host/dist/hooks/useHostBridge.d.ts +37 -0
  50. package/host/dist/hooks/useHostBridge.d.ts.map +1 -0
  51. package/host/dist/hooks/useOAuth.d.ts +16 -0
  52. package/host/dist/hooks/useOAuth.d.ts.map +1 -0
  53. package/host/dist/hooks/useRobots.d.ts +17 -0
  54. package/host/dist/hooks/useRobots.d.ts.map +1 -0
  55. package/host/dist/hooks/useSdk.d.ts +16 -0
  56. package/host/dist/hooks/useSdk.d.ts.map +1 -0
  57. package/host/dist/index.d.ts +25 -0
  58. package/host/dist/index.d.ts.map +1 -0
  59. package/host/dist/index.js +15 -0
  60. package/host/dist/index.js.map +1 -0
  61. package/host/dist/lib/centralListener.d.ts +73 -0
  62. package/host/dist/lib/centralListener.d.ts.map +1 -0
  63. package/host/dist/lib/centralRest.d.ts +35 -0
  64. package/host/dist/lib/centralRest.d.ts.map +1 -0
  65. package/host/dist/lib/protocol.d.ts +230 -0
  66. package/host/dist/lib/protocol.d.ts.map +1 -0
  67. package/host/dist/lib/protocol.js +48 -0
  68. package/host/dist/lib/protocol.js.map +1 -0
  69. package/host/dist/lib/sdk-types.d.ts +46 -0
  70. package/host/dist/lib/sdk-types.d.ts.map +1 -0
  71. package/host/dist/lib/settings.d.ts +69 -0
  72. package/host/dist/lib/settings.d.ts.map +1 -0
  73. package/host/dist/lib/signalingUrl.d.ts +28 -0
  74. package/host/dist/lib/signalingUrl.d.ts.map +1 -0
  75. package/host/dist/lib/theme.d.ts +4 -0
  76. package/host/dist/lib/theme.d.ts.map +1 -0
  77. package/host/dist/lib/themeMode.d.ts +9 -0
  78. package/host/dist/lib/themeMode.d.ts.map +1 -0
  79. package/host/dist/lib/tokens.d.ts +64 -0
  80. package/host/dist/lib/tokens.d.ts.map +1 -0
  81. package/host/dist/mountHost.d.ts +36 -0
  82. package/host/dist/mountHost.d.ts.map +1 -0
  83. package/package.json +109 -0
  84. package/reachy-mini-sdk.d.ts +285 -0
  85. package/reachy-mini-sdk.js +2625 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,188 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@pollen-robotics/reachy-mini-sdk` are
4
+ documented here. The format follows
5
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versions
6
+ are kept in lock-step with the Reachy Mini Python daemon and are
7
+ driven from `pyproject.toml` at the repo root (the npm publish CI
8
+ overrides the `version` placeholder in `package.json`).
9
+
10
+ The host shell shares this package's version (single source of
11
+ truth); the wire protocol is versioned separately in
12
+ `PROTOCOL_VERSION` (see [host/SPEC.md §11](./host/SPEC.md#11-backlog)).
13
+
14
+ ## Unreleased — succeeds 1.7.3
15
+
16
+ > **Breaking change.** Every app currently using
17
+ > `@pollen-robotics/reachy-mini-host` has to update its imports
18
+ > when it upgrades. Existing `1.7.x` installs keep working against
19
+ > the legacy `reachy-mini-host@1.7.x` tarball that stays on npm;
20
+ > only consumers who upgrade past `1.7.3` need to migrate. The
21
+ > target version is intentionally left unset in this PR — it will
22
+ > be picked at release time when `pyproject.toml` is bumped from
23
+ > `1.7.3` to the next number (the npm publish CI mirrors that bump
24
+ > into the package manifest).
25
+
26
+ **Single-package release: `@pollen-robotics/reachy-mini-host` is folded
27
+ into `@pollen-robotics/reachy-mini-sdk`.** App authors install,
28
+ version, and import from one entry point. The old package stays
29
+ available on npm at `1.7.x` for one minor cycle for graceful
30
+ migration and will then be `npm deprecate`d with a pointer to the
31
+ new subpaths.
32
+
33
+ ### Migration
34
+
35
+ ```diff
36
+ - "@pollen-robotics/reachy-mini-host": "^1.7.x",
37
+ - "@pollen-robotics/reachy-mini-sdk": "^1.7.x"
38
+ + "@pollen-robotics/reachy-mini-sdk": "^<next-release>"
39
+ ```
40
+
41
+ ```diff
42
+ - import { mountHost } from '@pollen-robotics/reachy-mini-host/auto';
43
+ - import { connectToHost } from '@pollen-robotics/reachy-mini-host/embed';
44
+ - import { PROTOCOL_VERSION } from '@pollen-robotics/reachy-mini-host/protocol';
45
+ + import { mountHost } from '@pollen-robotics/reachy-mini-sdk/host/auto';
46
+ + import { connectToHost } from '@pollen-robotics/reachy-mini-sdk/host/embed';
47
+ + import { PROTOCOL_VERSION } from '@pollen-robotics/reachy-mini-sdk/host/protocol';
48
+ ```
49
+
50
+ The host CDN bundles also moved:
51
+
52
+ ```diff
53
+ - https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-host@1/dist/entry/auto.js
54
+ + https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@1/host/dist/entry/auto.js
55
+ ```
56
+
57
+ ### Added
58
+
59
+ - New subpath exports on `@pollen-robotics/reachy-mini-sdk`:
60
+ - `./host` — `mountHost`, `connectToHost`, types
61
+ - `./host/auto` — CDN auto bundle for standalone apps
62
+ - `./host/embed` — CDN embed bundle for the iframe side
63
+ - `./host/protocol` — `PROTOCOL_VERSION`, `decodeCredsFromHash`, etc.
64
+ - `reachy-mini-sdk.d.ts` ships next to `reachy-mini-sdk.js` as the
65
+ canonical SDK type surface. The host re-exports from there
66
+ (`host/src/lib/sdk-types.ts` is now a thin barrel), removing the
67
+ earlier duplication TODO.
68
+
69
+ ### Changed
70
+
71
+ - The host bundles (`./host`, `./host/auto`, `./host/embed`) now
72
+ import the SDK runtime directly and self-assign
73
+ `window.ReachyMini` (when unset) at module-load time, dispatching
74
+ `reachymini:ready`. App `index.html` files no longer need a
75
+ separate `<script type="module">` to load the SDK on the global,
76
+ and `useSdk` + `connectToHost` no longer race against a
77
+ late-arriving global. Apps that still set `window.ReachyMini`
78
+ themselves are unaffected — we only assign when it's missing.
79
+ - Log-prefix tag harmonised to `[reachy-mini-sdk/host]` /
80
+ `[reachy-mini-sdk/host/embed]` for greppability.
81
+ - Internal repo layout: `js/sdk/*` collapsed into `js/*` now that
82
+ there is only one package. The host source lives at `js/host/`,
83
+ the SDK runtime at `js/reachy-mini-sdk.js`, the package manifest
84
+ at `js/package.json`. No effect on consumers; only the
85
+ `repository.directory` field and the npm-publish CI working
86
+ directory changed.
87
+
88
+ ### Removed
89
+
90
+ - Workspace coordinator `js/package.json` (was an npm workspace
91
+ root) and `js/package-lock.json` at the workspace level. The
92
+ single package's lockfile lives at `js/package-lock.json`.
93
+ - `@pollen-robotics/reachy-mini-host` package manifest — the host
94
+ ships under `@pollen-robotics/reachy-mini-sdk/host*` now. The
95
+ legacy npm package stays on `1.7.x` for one minor cycle for
96
+ graceful migration, then will be `npm deprecate`d.
97
+
98
+ ### SDK changes drafted between 1.7.3 and the package merge
99
+
100
+ The following landed on `main` after `1.7.3` was published but
101
+ were never released on their own; they ship with this release:
102
+
103
+ - **Breaking (SDK)**: `wakeUp()` and `gotoSleep()` now return
104
+ `Promise<void>` (previously `boolean`). The promise resolves on
105
+ the daemon's `{command, completed: true}` response, after the
106
+ trajectory player has fully landed. Apps that previously relied
107
+ on the boolean return are unaffected in practice; apps that
108
+ *want* to await trajectory completion (e.g. to chain
109
+ `setMotorMode("disabled")` after a `gotoSleep`) can now do so
110
+ without racing.
111
+ - **SDK**: both motion helpers take an optional `{ timeoutMs }`
112
+ (default 8000 ms). The promise rejects on session teardown
113
+ (`stopSession` / `disconnect`) so consumers never wait forever
114
+ on an interrupted trajectory.
115
+ - **SDK**: `POST /send` responses with a 4xx / 5xx status now
116
+ produce a `console.warn` carrying the rejected message `type`
117
+ and the response body, making racy `setPeerStatus` /
118
+ `endSession` failures easier to diagnose.
119
+ - **Host types**: `src/lib/sdk-types.ts` refreshed to cover the
120
+ full SDK public surface (`autoConnect`, `gotoTarget`,
121
+ `setMotorTorque`, `subscribeLogs`, `requestState`, version /
122
+ hardware-id helpers, `robotState`, `isEmbedded`, jitter buffer
123
+ option, `autoStartFromUrl`). The motion helpers now type as
124
+ `Promise<void>` to match the SDK.
125
+
126
+ ## 0.3.0 - 2026-05-16 (unreleased)
127
+
128
+ **This release is a full rewrite of the package against
129
+ [SPEC.md v1.0](./host/SPEC.md).** The public surface and the wire
130
+ protocol both change in incompatible ways.
131
+
132
+ ### Breaking changes
133
+
134
+ - **API**: `mountHost()` options reduced to the documented surface
135
+ (`appName`, `appIconUrl`, `appEmoji`, `enableMicrophone`,
136
+ `clientId`, `devToken`, `target`). The following are removed:
137
+ - `theme: { light, dark }` (host owns its bundled MUI theme).
138
+ - `skipTheme` (no consumer-driven theming).
139
+ - `skipAuth` (host owns OAuth).
140
+ - **API**: `ConnectedHandle` reduced to the documented surface.
141
+ The following are removed:
142
+ - `sendCustom()` / `onCustom()` (no free-form bidi channel).
143
+ - `requestConfigUpdate()` (apps don't push config upstream).
144
+ - **API**: `devToken` payload renamed `{ token, username }` →
145
+ `{ token, userName }` for camelCase consistency with `appName`
146
+ and `hostName`.
147
+ - **API**: `ConnectedHandle.username` renamed to `ConnectedHandle.userName`.
148
+ - **Protocol**: `host:custom` / `embed:custom` removed.
149
+ - **Protocol**: `embed:request-config-update` removed.
150
+ - **Host shell**: removed the legacy `?app=<owner>/<space>`
151
+ branding-swap behaviour. The host renders exactly the app it
152
+ ships with, never another. Multi-app routing now lives in the
153
+ mobile catalog only.
154
+
155
+ ### Added
156
+
157
+ - `SPEC.md` (v1.0): behavioural contract, state machines,
158
+ 4 engineering invariants (single SDK per tab, token hygiene,
159
+ bundle pinning, React Strict Mode safety).
160
+ - `APP_AUTHOR_GUIDE.md`: step-by-step guide for building a new
161
+ app on top of the host.
162
+ - `REBUILD_PLAN.md`: project plan tracking the rewrite (deleted
163
+ once 0.3.0 ships).
164
+ - `LICENSE` (MIT).
165
+
166
+ ### Changed
167
+
168
+ - **Documentation**: replaced the legacy `SPEC.md` (823 lines,
169
+ ambitious-future spec) with a focused v1.0 spec (~620 lines)
170
+ matching what we actually want to ship.
171
+ - **Package metadata**: `repository.url` now points at the
172
+ host-only repo. `homepage` and `bugs` added.
173
+ - **Versioning policy**: stays permissive pre-1.0 (see SPEC §11
174
+ "Versioning policy"); each minor release between 0.x.y may
175
+ ship breaking changes. Semver-strict starts at 1.0.
176
+
177
+ ### Why a rewrite instead of a refactor
178
+
179
+ See `REBUILD_PLAN.md` § "Why a rebuild, not a refactor". TL;DR:
180
+ the API surface shrinks too much, and the previous code carried
181
+ half-implemented features (protocol-version negotiation,
182
+ heartbeat, custom channels) that were cheaper to retype than to
183
+ selectively remove.
184
+
185
+ ## 0.2.0 - 2026-05-15
186
+
187
+ Initial extraction of the host shell into a standalone package.
188
+ Predates the SPEC.md v1.0 rewrite; deprecated in favour of 0.3.0.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Pollen Robotics
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,129 @@
1
+ # @pollen-robotics/reachy-mini-sdk
2
+
3
+ The JS package for [Reachy Mini](https://github.com/pollen-robotics/reachy_mini). It ships:
4
+
5
+ - The **browser SDK** (`ReachyMini` class) for direct WebRTC control — the default export.
6
+ - An optional **host shell** (OAuth + robot picker + iframe bridge) for apps deployed as Hugging Face Spaces, exposed under the `./host*` subpaths.
7
+
8
+ Both used to be separate npm packages (`@pollen-robotics/reachy-mini-sdk` + `@pollen-robotics/reachy-mini-host`); they were merged into a single entry point so app authors only install, version, and import from one place.
9
+
10
+ The full SDK API reference lives in the JSDoc header of [`reachy-mini-sdk.js`](./reachy-mini-sdk.js): constructor options, read-only properties, the `disconnected → connected → streaming` state machine, the event list, and every command helper.
11
+
12
+ ## Install
13
+
14
+ ### With a bundler / Node
15
+
16
+ ```bash
17
+ npm install @pollen-robotics/reachy-mini-sdk
18
+ ```
19
+
20
+ ```js
21
+ // Low-level robot control
22
+ import { ReachyMini } from "@pollen-robotics/reachy-mini-sdk";
23
+
24
+ // Host shell for Hugging Face Spaces apps (OAuth + picker + iframe)
25
+ import { mountHost } from "@pollen-robotics/reachy-mini-sdk/host";
26
+ import { connectToHost } from "@pollen-robotics/reachy-mini-sdk/host/embed";
27
+ import { PROTOCOL_VERSION } from "@pollen-robotics/reachy-mini-sdk/host/protocol";
28
+ ```
29
+
30
+ ### From a browser, no build step (Hugging Face Spaces, static hosting…)
31
+
32
+ Use an ESM CDN. The `+esm` suffix tells jsdelivr to resolve bare specifiers (the `@huggingface/hub` dependency) recursively, so the import just works:
33
+
34
+ ```js
35
+ import { ReachyMini } from "https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@1/+esm";
36
+ ```
37
+
38
+ Or via esm.sh:
39
+
40
+ ```js
41
+ import { ReachyMini } from "https://esm.sh/@pollen-robotics/reachy-mini-sdk@1";
42
+ ```
43
+
44
+ Track bleeding-edge from `main`:
45
+
46
+ ```js
47
+ import { ReachyMini } from "https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@main/+esm";
48
+ ```
49
+
50
+ The host CDN bundles live under the same package:
51
+
52
+ ```html
53
+ <!-- Standalone host shell entry -->
54
+ <script type="module"
55
+ src="https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@1/host/dist/entry/auto.js">
56
+ </script>
57
+
58
+ <!-- Embed-side client (inside the iframe) -->
59
+ <script type="module"
60
+ src="https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@1/host/dist/entry/embed.js">
61
+ </script>
62
+ ```
63
+
64
+ Both bundles auto-install the SDK on `window.ReachyMini` at load time, so an app that uses the host no longer needs a separate `<script type="module">` to expose the SDK.
65
+
66
+ ## Quick start (SDK only)
67
+
68
+ ```js
69
+ import { ReachyMini } from "@pollen-robotics/reachy-mini-sdk";
70
+
71
+ const robot = new ReachyMini();
72
+
73
+ // 1. Auth (HuggingFace OAuth — required by the signaling server)
74
+ if (!await robot.authenticate()) { robot.login(); return; }
75
+
76
+ // 2. Connect to the signaling server
77
+ await robot.connect();
78
+
79
+ // 3. Pick a robot once the list arrives
80
+ robot.addEventListener("robotsChanged", (e) => {
81
+ const robots = e.detail.robots; // [{ id, meta: { name } }, ...]
82
+ });
83
+
84
+ // 4. Start a WebRTC session
85
+ const detach = robot.attachVideo(document.querySelector("video"));
86
+ await robot.startSession(robotId);
87
+
88
+ // 5. Send commands — degree-friendly helpers
89
+ robot.setHeadRpyDeg(0, 10, -5);
90
+ robot.setAntennasDeg(30, -30);
91
+ robot.setBodyYawDeg(15);
92
+ robot.playSound("wake_up.wav");
93
+ ```
94
+
95
+ See the JSDoc header in [`reachy-mini-sdk.js`](./reachy-mini-sdk.js) for the full surface (events, raw `setTarget`, audio controls, embedded-mode auto-start, etc.).
96
+
97
+ ## Host shell
98
+
99
+ For Hugging Face Spaces apps that need OAuth + a robot picker + iframe lifecycle management:
100
+
101
+ - [`host/README.md`](./host/README.md) — quickstart and integration overview
102
+ - [`host/APP_AUTHOR_GUIDE.md`](./host/APP_AUTHOR_GUIDE.md) — full guide for app authors
103
+ - [`host/SPEC.md`](./host/SPEC.md) — host ↔ embed protocol spec
104
+
105
+ ## Migration from `@pollen-robotics/reachy-mini-host`
106
+
107
+ ```diff
108
+ - import { mountHost } from '@pollen-robotics/reachy-mini-host/auto';
109
+ - import { connectToHost } from '@pollen-robotics/reachy-mini-host/embed';
110
+ - import { PROTOCOL_VERSION } from '@pollen-robotics/reachy-mini-host/protocol';
111
+ + import { mountHost } from '@pollen-robotics/reachy-mini-sdk/host/auto';
112
+ + import { connectToHost } from '@pollen-robotics/reachy-mini-sdk/host/embed';
113
+ + import { PROTOCOL_VERSION } from '@pollen-robotics/reachy-mini-sdk/host/protocol';
114
+ ```
115
+
116
+ You can drop `@pollen-robotics/reachy-mini-host` from your `package.json`. The host CDN bundles also moved — adjust the jsdelivr URL in your `index.html`:
117
+
118
+ ```diff
119
+ - https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-host@1/dist/entry/auto.js
120
+ + https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@1/host/dist/entry/auto.js
121
+ ```
122
+
123
+ The host bundles now import the SDK directly and assign it on `window.ReachyMini` at load time, so apps no longer need a second `<script type="module">` for the SDK alone.
124
+
125
+ See the [CHANGELOG](./CHANGELOG.md) for the full release history.
126
+
127
+ ## License
128
+
129
+ Apache-2.0 — see [LICENSE](./LICENSE).