@pollen-robotics/reachy-mini-sdk 1.7.3 → 1.8.0-main.54c2dcd
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 +1795 -0
- package/README.md +65 -5
- package/dist/animation/distance.d.ts +87 -0
- package/dist/animation/distance.d.ts.map +1 -0
- package/dist/animation/distance.js +140 -0
- package/dist/animation/distance.js.map +1 -0
- package/dist/animation/index.d.ts +34 -0
- package/dist/animation/index.d.ts.map +1 -0
- package/dist/animation/index.js +33 -0
- package/dist/animation/index.js.map +1 -0
- package/dist/animation/pose.d.ts +40 -0
- package/dist/animation/pose.d.ts.map +1 -0
- package/dist/animation/pose.js +15 -0
- package/dist/animation/pose.js.map +1 -0
- package/dist/animation/presets.d.ts +85 -0
- package/dist/animation/presets.d.ts.map +1 -0
- package/dist/animation/presets.js +82 -0
- package/dist/animation/presets.js.map +1 -0
- package/dist/animation/safe-return.d.ts +90 -0
- package/dist/animation/safe-return.d.ts.map +1 -0
- package/dist/animation/safe-return.js +123 -0
- package/dist/animation/safe-return.js.map +1 -0
- package/dist/lib/math.d.ts +23 -0
- package/dist/lib/math.d.ts.map +1 -0
- package/dist/lib/math.js +40 -0
- package/dist/lib/math.js.map +1 -0
- package/dist/lib/reachy-mini.d.ts +193 -0
- package/dist/lib/reachy-mini.d.ts.map +1 -0
- package/dist/lib/reachy-mini.js +1495 -0
- package/dist/lib/reachy-mini.js.map +1 -0
- package/dist/lib/types.d.ts +384 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +9 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/upload-helpers.d.ts +18 -0
- package/dist/lib/upload-helpers.d.ts.map +1 -0
- package/dist/lib/upload-helpers.js +44 -0
- package/dist/lib/upload-helpers.js.map +1 -0
- package/dist/lib/url-helpers.d.ts +63 -0
- package/dist/lib/url-helpers.d.ts.map +1 -0
- package/dist/lib/url-helpers.js +153 -0
- package/dist/lib/url-helpers.js.map +1 -0
- package/dist/reachy-mini-sdk.d.ts +69 -0
- package/dist/reachy-mini-sdk.d.ts.map +1 -0
- package/dist/reachy-mini-sdk.js +68 -0
- package/dist/reachy-mini-sdk.js.map +1 -0
- package/host/README.md +157 -0
- package/host/dist/ReachyHost.d.ts +40 -0
- package/host/dist/ReachyHost.d.ts.map +1 -0
- package/host/dist/assets/index.d.ts +16 -0
- package/host/dist/assets/index.d.ts.map +1 -0
- package/host/dist/chunks/index-CyLPysJS.js +400 -0
- package/host/dist/chunks/mountHost-zdJ99_oZ.js +48392 -0
- package/host/dist/chunks/reachy-mini-BV9nAnC1.js +1283 -0
- package/host/dist/components/ConnectingView.d.ts +13 -0
- package/host/dist/components/ConnectingView.d.ts.map +1 -0
- package/host/dist/components/EmbedFrame.d.ts +16 -0
- package/host/dist/components/EmbedFrame.d.ts.map +1 -0
- package/host/dist/components/ErrorView.d.ts +21 -0
- package/host/dist/components/ErrorView.d.ts.map +1 -0
- package/host/dist/components/LeavingView.d.ts +33 -0
- package/host/dist/components/LeavingView.d.ts.map +1 -0
- package/host/dist/components/PickerView.d.ts +51 -0
- package/host/dist/components/PickerView.d.ts.map +1 -0
- package/host/dist/components/PostOAuthSplash.d.ts +25 -0
- package/host/dist/components/PostOAuthSplash.d.ts.map +1 -0
- package/host/dist/components/ReachyHostShell.d.ts +21 -0
- package/host/dist/components/ReachyHostShell.d.ts.map +1 -0
- package/host/dist/components/SignInView.d.ts +32 -0
- package/host/dist/components/SignInView.d.ts.map +1 -0
- package/host/dist/components/StepsProgressIndicator.d.ts +41 -0
- package/host/dist/components/StepsProgressIndicator.d.ts.map +1 -0
- package/host/dist/components/TopBar.d.ts +52 -0
- package/host/dist/components/TopBar.d.ts.map +1 -0
- package/host/dist/components/WelcomeBackOverlay.d.ts +28 -0
- package/host/dist/components/WelcomeBackOverlay.d.ts.map +1 -0
- package/host/dist/embed/index.d.ts +152 -0
- package/host/dist/embed/index.d.ts.map +1 -0
- package/host/dist/entry/auto.d.ts +12 -0
- package/host/dist/entry/auto.d.ts.map +1 -0
- package/host/dist/entry/auto.js +6 -0
- package/host/dist/entry/embed.d.ts +12 -0
- package/host/dist/entry/embed.d.ts.map +1 -0
- package/host/dist/entry/embed.js +6 -0
- package/host/dist/hooks/useHfProfile.d.ts +7 -0
- package/host/dist/hooks/useHfProfile.d.ts.map +1 -0
- package/host/dist/hooks/useHostBridge.d.ts +37 -0
- package/host/dist/hooks/useHostBridge.d.ts.map +1 -0
- package/host/dist/hooks/useOAuth.d.ts +16 -0
- package/host/dist/hooks/useOAuth.d.ts.map +1 -0
- package/host/dist/hooks/useRobots.d.ts +17 -0
- package/host/dist/hooks/useRobots.d.ts.map +1 -0
- package/host/dist/hooks/useSdk.d.ts +16 -0
- package/host/dist/hooks/useSdk.d.ts.map +1 -0
- package/host/dist/index.d.ts +25 -0
- package/host/dist/index.d.ts.map +1 -0
- package/host/dist/index.js +14 -0
- package/host/dist/lib/centralListener.d.ts +73 -0
- package/host/dist/lib/centralListener.d.ts.map +1 -0
- package/host/dist/lib/centralRest.d.ts +35 -0
- package/host/dist/lib/centralRest.d.ts.map +1 -0
- package/host/dist/lib/protocol.d.ts +230 -0
- package/host/dist/lib/protocol.d.ts.map +1 -0
- package/host/dist/lib/protocol.js +47 -0
- package/host/dist/lib/sdk-types.d.ts +46 -0
- package/host/dist/lib/sdk-types.d.ts.map +1 -0
- package/host/dist/lib/settings.d.ts +70 -0
- package/host/dist/lib/settings.d.ts.map +1 -0
- package/host/dist/lib/signalingUrl.d.ts +28 -0
- package/host/dist/lib/signalingUrl.d.ts.map +1 -0
- package/host/dist/lib/theme.d.ts +4 -0
- package/host/dist/lib/theme.d.ts.map +1 -0
- package/host/dist/lib/themeMode.d.ts +9 -0
- package/host/dist/lib/themeMode.d.ts.map +1 -0
- package/host/dist/lib/tokens.d.ts +64 -0
- package/host/dist/lib/tokens.d.ts.map +1 -0
- package/host/dist/mountHost.d.ts +36 -0
- package/host/dist/mountHost.d.ts.map +1 -0
- package/package.json +79 -11
- package/reachy-mini-sdk.js +0 -2013
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL / SDP helpers used by the ReachyMini SDK at construction
|
|
3
|
+
* time and during signaling.
|
|
4
|
+
*
|
|
5
|
+
* Each function is a no-op outside the browser (SSR / Worker
|
|
6
|
+
* contexts) so the module is import-safe everywhere.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Pick up HuggingFace credentials passed via the URL fragment and move them
|
|
10
|
+
* into `sessionStorage`, where `authenticate()` looks them up.
|
|
11
|
+
*
|
|
12
|
+
* This is the bridge that lets a host page (e.g. the Reachy Mini mobile
|
|
13
|
+
* app, or the vibe-coder preview iframe) embed a Space hosting a SDK
|
|
14
|
+
* consumer despite `X-Frame-Options: SAMEORIGIN` on `huggingface.co/login`:
|
|
15
|
+
* the host already holds a valid token (through its own OAuth flow) and
|
|
16
|
+
* appends it to the iframe URL as
|
|
17
|
+
*
|
|
18
|
+
* #hf_token=<jwt>&hf_username=<handle>&hf_token_expires=<iso>
|
|
19
|
+
*
|
|
20
|
+
* Fragments are NOT sent over HTTP, so the credentials never leak to
|
|
21
|
+
* the HF Space backend or to intermediate proxies.
|
|
22
|
+
*
|
|
23
|
+
* Why all three keys: `authenticate()`'s cache check requires the token,
|
|
24
|
+
* the username AND a future expiry to ALL be present in `sessionStorage`,
|
|
25
|
+
* otherwise it returns `false` and the app falls through to a full OAuth
|
|
26
|
+
* round-trip — which can't complete inside an iframe.
|
|
27
|
+
*
|
|
28
|
+
* Called once from the top of `authenticate()` so SDK consumers don't
|
|
29
|
+
* need any boilerplate of their own. We clear the fragment right after
|
|
30
|
+
* reading it so a page reload does not keep the credentials visible in
|
|
31
|
+
* the address bar.
|
|
32
|
+
*
|
|
33
|
+
* No-op when:
|
|
34
|
+
* - there is no `window` (SSR / Worker contexts),
|
|
35
|
+
* - the URL has no fragment,
|
|
36
|
+
* - the fragment carries no `hf_token` (other apps may use the
|
|
37
|
+
* fragment for theme / route / etc.; we leave those alone).
|
|
38
|
+
*/
|
|
39
|
+
export declare function consumeFragmentCredentials(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Pick up a preselected robot peer id from the URL.
|
|
42
|
+
*
|
|
43
|
+
* Looked up in this order:
|
|
44
|
+
* 1. URL fragment (`#robot_peer_id=<peerId>`)
|
|
45
|
+
* 2. URL query (`?robot_peer_id=<peerId>`)
|
|
46
|
+
*
|
|
47
|
+
* Both spellings are accepted because:
|
|
48
|
+
* - the Reachy Mini mobile shell sends it in the query today,
|
|
49
|
+
* - the vibe-coder preview / future hosts may prefer the fragment for
|
|
50
|
+
* symmetry with `consumeFragmentCredentials`,
|
|
51
|
+
* - the value is NOT a secret (peer ids are public on the central
|
|
52
|
+
* signaling server's robot listing) so query is fine.
|
|
53
|
+
*
|
|
54
|
+
* Returns `null` when no peer id is found in either location, when there
|
|
55
|
+
* is no `window` (SSR / Worker context), or on parse error. Unlike
|
|
56
|
+
* credentials, we do NOT strip the param from the URL: the value is
|
|
57
|
+
* harmless to keep visible and removing it would break tools that read
|
|
58
|
+
* the URL for context.
|
|
59
|
+
*/
|
|
60
|
+
export declare function readPreselectedRobotIdFromUrl(): string | null;
|
|
61
|
+
/** Check if the audio m= section of an SDP has a=sendrecv (bidirectional audio). */
|
|
62
|
+
export declare function sdpHasAudioSendRecv(sdp: string): boolean;
|
|
63
|
+
//# sourceMappingURL=url-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-helpers.d.ts","sourceRoot":"","sources":["../../lib/url-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CA0CjD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,GAAG,IAAI,CAsB7D;AAED,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CASxD"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL / SDP helpers used by the ReachyMini SDK at construction
|
|
3
|
+
* time and during signaling.
|
|
4
|
+
*
|
|
5
|
+
* Each function is a no-op outside the browser (SSR / Worker
|
|
6
|
+
* contexts) so the module is import-safe everywhere.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Pick up HuggingFace credentials passed via the URL fragment and move them
|
|
10
|
+
* into `sessionStorage`, where `authenticate()` looks them up.
|
|
11
|
+
*
|
|
12
|
+
* This is the bridge that lets a host page (e.g. the Reachy Mini mobile
|
|
13
|
+
* app, or the vibe-coder preview iframe) embed a Space hosting a SDK
|
|
14
|
+
* consumer despite `X-Frame-Options: SAMEORIGIN` on `huggingface.co/login`:
|
|
15
|
+
* the host already holds a valid token (through its own OAuth flow) and
|
|
16
|
+
* appends it to the iframe URL as
|
|
17
|
+
*
|
|
18
|
+
* #hf_token=<jwt>&hf_username=<handle>&hf_token_expires=<iso>
|
|
19
|
+
*
|
|
20
|
+
* Fragments are NOT sent over HTTP, so the credentials never leak to
|
|
21
|
+
* the HF Space backend or to intermediate proxies.
|
|
22
|
+
*
|
|
23
|
+
* Why all three keys: `authenticate()`'s cache check requires the token,
|
|
24
|
+
* the username AND a future expiry to ALL be present in `sessionStorage`,
|
|
25
|
+
* otherwise it returns `false` and the app falls through to a full OAuth
|
|
26
|
+
* round-trip — which can't complete inside an iframe.
|
|
27
|
+
*
|
|
28
|
+
* Called once from the top of `authenticate()` so SDK consumers don't
|
|
29
|
+
* need any boilerplate of their own. We clear the fragment right after
|
|
30
|
+
* reading it so a page reload does not keep the credentials visible in
|
|
31
|
+
* the address bar.
|
|
32
|
+
*
|
|
33
|
+
* No-op when:
|
|
34
|
+
* - there is no `window` (SSR / Worker contexts),
|
|
35
|
+
* - the URL has no fragment,
|
|
36
|
+
* - the fragment carries no `hf_token` (other apps may use the
|
|
37
|
+
* fragment for theme / route / etc.; we leave those alone).
|
|
38
|
+
*/
|
|
39
|
+
export function consumeFragmentCredentials() {
|
|
40
|
+
if (typeof window === 'undefined' || !window.location.hash)
|
|
41
|
+
return;
|
|
42
|
+
const raw = window.location.hash.startsWith('#')
|
|
43
|
+
? window.location.hash.slice(1)
|
|
44
|
+
: window.location.hash;
|
|
45
|
+
let params;
|
|
46
|
+
try {
|
|
47
|
+
params = new URLSearchParams(raw);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const token = params.get('hf_token');
|
|
53
|
+
if (!token)
|
|
54
|
+
return;
|
|
55
|
+
// `hf_username` is required by the cache check. Hosts that haven't
|
|
56
|
+
// resolved the user's HF handle yet may pass a literal "user"
|
|
57
|
+
// placeholder; the SDK only uses the value for display and never
|
|
58
|
+
// round-trips it server-side, so the placeholder is harmless.
|
|
59
|
+
const username = params.get('hf_username') || 'user';
|
|
60
|
+
// `hf_token_expires` is a far-future ISO date for personal access
|
|
61
|
+
// tokens (no real expiry). Hosts typically synthesise ~1 year out;
|
|
62
|
+
// we accept whatever was sent and fall back to "1 year from now"
|
|
63
|
+
// if the parameter is missing or unparseable, so a partial fragment
|
|
64
|
+
// still gets the user logged in.
|
|
65
|
+
const expiresParam = params.get('hf_token_expires');
|
|
66
|
+
const expires = expiresParam && !Number.isNaN(new Date(expiresParam).getTime())
|
|
67
|
+
? expiresParam
|
|
68
|
+
: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toISOString();
|
|
69
|
+
try {
|
|
70
|
+
sessionStorage.setItem('hf_token', token);
|
|
71
|
+
sessionStorage.setItem('hf_username', username);
|
|
72
|
+
sessionStorage.setItem('hf_token_expires', expires);
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
console.warn('[reachy-mini] could not persist pre-seeded HF credentials:', err);
|
|
76
|
+
}
|
|
77
|
+
// Strip the auth keys from the address bar but keep any other hash
|
|
78
|
+
// params the app or SDK might care about (theme, embedded, …).
|
|
79
|
+
params.delete('hf_token');
|
|
80
|
+
params.delete('hf_username');
|
|
81
|
+
params.delete('hf_token_expires');
|
|
82
|
+
const remaining = params.toString();
|
|
83
|
+
const cleanUrl = window.location.pathname +
|
|
84
|
+
window.location.search +
|
|
85
|
+
(remaining ? '#' + remaining : '');
|
|
86
|
+
try {
|
|
87
|
+
window.history.replaceState(null, '', cleanUrl);
|
|
88
|
+
}
|
|
89
|
+
catch { /* ignore */ }
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Pick up a preselected robot peer id from the URL.
|
|
93
|
+
*
|
|
94
|
+
* Looked up in this order:
|
|
95
|
+
* 1. URL fragment (`#robot_peer_id=<peerId>`)
|
|
96
|
+
* 2. URL query (`?robot_peer_id=<peerId>`)
|
|
97
|
+
*
|
|
98
|
+
* Both spellings are accepted because:
|
|
99
|
+
* - the Reachy Mini mobile shell sends it in the query today,
|
|
100
|
+
* - the vibe-coder preview / future hosts may prefer the fragment for
|
|
101
|
+
* symmetry with `consumeFragmentCredentials`,
|
|
102
|
+
* - the value is NOT a secret (peer ids are public on the central
|
|
103
|
+
* signaling server's robot listing) so query is fine.
|
|
104
|
+
*
|
|
105
|
+
* Returns `null` when no peer id is found in either location, when there
|
|
106
|
+
* is no `window` (SSR / Worker context), or on parse error. Unlike
|
|
107
|
+
* credentials, we do NOT strip the param from the URL: the value is
|
|
108
|
+
* harmless to keep visible and removing it would break tools that read
|
|
109
|
+
* the URL for context.
|
|
110
|
+
*/
|
|
111
|
+
export function readPreselectedRobotIdFromUrl() {
|
|
112
|
+
if (typeof window === 'undefined')
|
|
113
|
+
return null;
|
|
114
|
+
// 1. Fragment (`#robot_peer_id=…`).
|
|
115
|
+
if (window.location.hash) {
|
|
116
|
+
const raw = window.location.hash.startsWith('#')
|
|
117
|
+
? window.location.hash.slice(1)
|
|
118
|
+
: window.location.hash;
|
|
119
|
+
try {
|
|
120
|
+
const params = new URLSearchParams(raw);
|
|
121
|
+
const fromHash = params.get('robot_peer_id');
|
|
122
|
+
if (fromHash)
|
|
123
|
+
return fromHash;
|
|
124
|
+
}
|
|
125
|
+
catch { /* malformed fragment — fall through */ }
|
|
126
|
+
}
|
|
127
|
+
// 2. Query (`?robot_peer_id=…`).
|
|
128
|
+
if (window.location.search) {
|
|
129
|
+
try {
|
|
130
|
+
const params = new URLSearchParams(window.location.search);
|
|
131
|
+
const fromQuery = params.get('robot_peer_id');
|
|
132
|
+
if (fromQuery)
|
|
133
|
+
return fromQuery;
|
|
134
|
+
}
|
|
135
|
+
catch { /* malformed query — fall through */ }
|
|
136
|
+
}
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
/** Check if the audio m= section of an SDP has a=sendrecv (bidirectional audio). */
|
|
140
|
+
export function sdpHasAudioSendRecv(sdp) {
|
|
141
|
+
const lines = sdp.split('\r\n');
|
|
142
|
+
let inAudio = false;
|
|
143
|
+
for (const line of lines) {
|
|
144
|
+
if (line.startsWith('m=audio'))
|
|
145
|
+
inAudio = true;
|
|
146
|
+
else if (line.startsWith('m='))
|
|
147
|
+
inAudio = false;
|
|
148
|
+
if (inAudio && line === 'a=sendrecv')
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=url-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-helpers.js","sourceRoot":"","sources":["../../lib/url-helpers.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* reachy-mini-sdk — Browser SDK for controlling a Reachy Mini robot over WebRTC.
|
|
3
|
+
* https://github.com/pollen-robotics/reachy-mini
|
|
4
|
+
*
|
|
5
|
+
* QUICK START
|
|
6
|
+
* ───────────
|
|
7
|
+
* import { ReachyMini } from "@pollen-robotics/reachy-mini-sdk";
|
|
8
|
+
* const robot = new ReachyMini();
|
|
9
|
+
*
|
|
10
|
+
* // 1. Auth (HuggingFace OAuth — required for the signaling server)
|
|
11
|
+
* if (!await robot.authenticate()) { robot.login(); return; }
|
|
12
|
+
*
|
|
13
|
+
* // 2. Connect to signaling server (SSE)
|
|
14
|
+
* await robot.connect();
|
|
15
|
+
*
|
|
16
|
+
* // 3. Pick a robot once the list arrives
|
|
17
|
+
* robot.addEventListener("robotsChanged", (e) => {
|
|
18
|
+
* const robots = e.detail.robots; // [{ id, meta: { name } }, ...]
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // 4. Start a WebRTC session (resolves when video + data channel ready)
|
|
22
|
+
* const detach = robot.attachVideo(document.querySelector("video"));
|
|
23
|
+
* await robot.startSession(robotId);
|
|
24
|
+
*
|
|
25
|
+
* // 5. Send commands — degree-friendly helpers, all built on setTarget()
|
|
26
|
+
* robot.setHeadRpyDeg(0, 10, -5); // roll, pitch, yaw in degrees
|
|
27
|
+
* robot.setAntennasDeg(30, -30); // right, left in degrees
|
|
28
|
+
* robot.setBodyYawDeg(15); // body yaw in degrees
|
|
29
|
+
*
|
|
30
|
+
* // …or compose an atomic update in raw wire units (full SE(3); no XYZ loss):
|
|
31
|
+
* robot.setTarget({
|
|
32
|
+
* head: rpyToMatrix(0, 10, -5).flat(),
|
|
33
|
+
* antennas: [degToRad(30), degToRad(-30)],
|
|
34
|
+
* body_yaw: degToRad(15),
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* // 6. Receive live state (emitted every ~500 ms while streaming).
|
|
38
|
+
* robot.addEventListener("state", (e) => {
|
|
39
|
+
* const { head, antennas, body_yaw, motor_mode, is_move_running } = e.detail;
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // 7. Audio controls
|
|
43
|
+
* robot.setAudioMuted(false);
|
|
44
|
+
* robot.setMicMuted(false);
|
|
45
|
+
*
|
|
46
|
+
* // XVF3800 audio-board tuning (the daemon owns the USB board; works
|
|
47
|
+
* // on both Lite and Wireless robots):
|
|
48
|
+
* await robot.applyAudioConfig([{ name: "AUDIO_MGR_MIC_GAIN", values: [1.0] }]);
|
|
49
|
+
* const v = await robot.readAudioParameter("AUDIO_MGR_MIC_GAIN"); // [1.0]
|
|
50
|
+
*
|
|
51
|
+
* // 8. Cleanup
|
|
52
|
+
* detach();
|
|
53
|
+
* await robot.stopSession();
|
|
54
|
+
* robot.disconnect();
|
|
55
|
+
* robot.logout();
|
|
56
|
+
*
|
|
57
|
+
*
|
|
58
|
+
* EXPORTS
|
|
59
|
+
* ───────
|
|
60
|
+
* export default ReachyMini;
|
|
61
|
+
* export { ReachyMini, rpyToMatrix, matrixToRpy, degToRad, radToDeg };
|
|
62
|
+
* plus the public type surface (RobotInfo, RobotState, ReachyMiniOptions, …).
|
|
63
|
+
*/
|
|
64
|
+
export { ReachyMini } from './lib/reachy-mini.js';
|
|
65
|
+
export { degToRad, radToDeg, rpyToMatrix, matrixToRpy } from './lib/math.js';
|
|
66
|
+
export type { RobotInfo, RobotState, ReachyMiniOptions, ReachyMiniInstance, ReachyMiniConstructor, AutoConnectOptions, AutoConnectRobotChoice, AutoConnectResult, MotionAwaitOptions, SubscribeLogsOptions, AudioConfigEntry, ApplyAudioConfigOptions, MoveData, PlayMoveOptions, PlayMoveProgress, PlayMoveResult, PlayMoveStartedInfo, PlayUploadedAudioOptions, UploadAudioOptions, UploadAudioProgress, SessionRejectError, ReachyMiniEventMap, ConnectedEventDetail, DisconnectedEventDetail, RobotsChangedEventDetail, StreamingEventDetail, SessionStoppedEventDetail, SessionRejectedEventDetail, StateEventDetail, VideoTrackEventDetail, MicSupportedEventDetail, ErrorEventDetail, } from './lib/types.js';
|
|
67
|
+
import { ReachyMini } from './lib/reachy-mini.js';
|
|
68
|
+
export default ReachyMini;
|
|
69
|
+
//# sourceMappingURL=reachy-mini-sdk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reachy-mini-sdk.d.ts","sourceRoot":"","sources":["../reachy-mini-sdk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC7E,YAAY,EACR,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,GACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* reachy-mini-sdk — Browser SDK for controlling a Reachy Mini robot over WebRTC.
|
|
3
|
+
* https://github.com/pollen-robotics/reachy-mini
|
|
4
|
+
*
|
|
5
|
+
* QUICK START
|
|
6
|
+
* ───────────
|
|
7
|
+
* import { ReachyMini } from "@pollen-robotics/reachy-mini-sdk";
|
|
8
|
+
* const robot = new ReachyMini();
|
|
9
|
+
*
|
|
10
|
+
* // 1. Auth (HuggingFace OAuth — required for the signaling server)
|
|
11
|
+
* if (!await robot.authenticate()) { robot.login(); return; }
|
|
12
|
+
*
|
|
13
|
+
* // 2. Connect to signaling server (SSE)
|
|
14
|
+
* await robot.connect();
|
|
15
|
+
*
|
|
16
|
+
* // 3. Pick a robot once the list arrives
|
|
17
|
+
* robot.addEventListener("robotsChanged", (e) => {
|
|
18
|
+
* const robots = e.detail.robots; // [{ id, meta: { name } }, ...]
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // 4. Start a WebRTC session (resolves when video + data channel ready)
|
|
22
|
+
* const detach = robot.attachVideo(document.querySelector("video"));
|
|
23
|
+
* await robot.startSession(robotId);
|
|
24
|
+
*
|
|
25
|
+
* // 5. Send commands — degree-friendly helpers, all built on setTarget()
|
|
26
|
+
* robot.setHeadRpyDeg(0, 10, -5); // roll, pitch, yaw in degrees
|
|
27
|
+
* robot.setAntennasDeg(30, -30); // right, left in degrees
|
|
28
|
+
* robot.setBodyYawDeg(15); // body yaw in degrees
|
|
29
|
+
*
|
|
30
|
+
* // …or compose an atomic update in raw wire units (full SE(3); no XYZ loss):
|
|
31
|
+
* robot.setTarget({
|
|
32
|
+
* head: rpyToMatrix(0, 10, -5).flat(),
|
|
33
|
+
* antennas: [degToRad(30), degToRad(-30)],
|
|
34
|
+
* body_yaw: degToRad(15),
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* // 6. Receive live state (emitted every ~500 ms while streaming).
|
|
38
|
+
* robot.addEventListener("state", (e) => {
|
|
39
|
+
* const { head, antennas, body_yaw, motor_mode, is_move_running } = e.detail;
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // 7. Audio controls
|
|
43
|
+
* robot.setAudioMuted(false);
|
|
44
|
+
* robot.setMicMuted(false);
|
|
45
|
+
*
|
|
46
|
+
* // XVF3800 audio-board tuning (the daemon owns the USB board; works
|
|
47
|
+
* // on both Lite and Wireless robots):
|
|
48
|
+
* await robot.applyAudioConfig([{ name: "AUDIO_MGR_MIC_GAIN", values: [1.0] }]);
|
|
49
|
+
* const v = await robot.readAudioParameter("AUDIO_MGR_MIC_GAIN"); // [1.0]
|
|
50
|
+
*
|
|
51
|
+
* // 8. Cleanup
|
|
52
|
+
* detach();
|
|
53
|
+
* await robot.stopSession();
|
|
54
|
+
* robot.disconnect();
|
|
55
|
+
* robot.logout();
|
|
56
|
+
*
|
|
57
|
+
*
|
|
58
|
+
* EXPORTS
|
|
59
|
+
* ───────
|
|
60
|
+
* export default ReachyMini;
|
|
61
|
+
* export { ReachyMini, rpyToMatrix, matrixToRpy, degToRad, radToDeg };
|
|
62
|
+
* plus the public type surface (RobotInfo, RobotState, ReachyMiniOptions, …).
|
|
63
|
+
*/
|
|
64
|
+
export { ReachyMini } from './lib/reachy-mini.js';
|
|
65
|
+
export { degToRad, radToDeg, rpyToMatrix, matrixToRpy } from './lib/math.js';
|
|
66
|
+
import { ReachyMini } from './lib/reachy-mini.js';
|
|
67
|
+
export default ReachyMini;
|
|
68
|
+
//# sourceMappingURL=reachy-mini-sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reachy-mini-sdk.js","sourceRoot":"","sources":["../reachy-mini-sdk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAoC7E,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,eAAe,UAAU,CAAC"}
|
package/host/README.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Host shell
|
|
2
|
+
|
|
3
|
+
> Shell + iframe bridge for [Reachy Mini](https://huggingface.co/pollen-robotics) web apps.
|
|
4
|
+
> Handles Hugging Face OAuth, robot selection, session lifecycle, and the parent / iframe
|
|
5
|
+
> postMessage protocol so app authors only ship their app, not the plumbing.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@pollen-robotics/reachy-mini-sdk)
|
|
8
|
+
[](../LICENSE)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## What is this?
|
|
13
|
+
|
|
14
|
+
Subpath exports of [`@pollen-robotics/reachy-mini-sdk`](https://www.npmjs.com/package/@pollen-robotics/reachy-mini-sdk) that power every Reachy Mini app deployed as a
|
|
15
|
+
[Hugging Face Space](https://huggingface.co/docs/hub/spaces-overview). It exposes:
|
|
16
|
+
|
|
17
|
+
- **`mountHost()`** — the shell rendered around your app's iframe. Renders the
|
|
18
|
+
top bar, sign-in screen, robot picker, and connecting / leaving overlays.
|
|
19
|
+
- **`connectToHost()`** — the vanilla-JS client that runs inside the iframe and
|
|
20
|
+
hands your app a fully-connected `ReachyMini` SDK instance.
|
|
21
|
+
|
|
22
|
+
Two boot modes are supported (cf. [`APP_CREATION_GUIDE.md` §13.3](../APP_CREATION_GUIDE.md#133-two-boot-modes-one-url-surface)):
|
|
23
|
+
|
|
24
|
+
| Mode | Entry point | Use case |
|
|
25
|
+
|------|-------------|----------|
|
|
26
|
+
| **A. Standalone** | `mountHost()` in `dispatch.ts` | A user opens the Space directly in a browser tab. Full OAuth → picker → iframe sequence. |
|
|
27
|
+
| **B. Mobile handoff** | `connectToHost()` in `embed.ts` | The Reachy Mini mobile app launches the app inside a webview with credentials pre-injected via the URL hash. No shell, no picker. |
|
|
28
|
+
|
|
29
|
+
The same app code works in both modes; only the entry point differs.
|
|
30
|
+
|
|
31
|
+
## Documentation
|
|
32
|
+
|
|
33
|
+
| Document | Audience | Read it when… |
|
|
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. Today's SDK pin: `1.8.0`. |
|
|
36
|
+
|
|
37
|
+
App authors and library maintainers both start with the
|
|
38
|
+
**[App Creation Guide](../APP_CREATION_GUIDE.md)**: §1-§12 are the
|
|
39
|
+
app-author recipe, §13 is the host ↔ embed architecture reference.
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
Most app authors load the package from a CDN at runtime; npm install is only
|
|
44
|
+
needed for TypeScript types and local dev:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install --save-dev @pollen-robotics/reachy-mini-sdk
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<!-- Loaded at runtime by every Reachy Mini app's index.html.
|
|
52
|
+
Both bundles auto-install the SDK on window.ReachyMini at
|
|
53
|
+
load time, so no separate `<script>` for the SDK is needed. -->
|
|
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
|
+
<script type="module"
|
|
58
|
+
src="https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@1/host/dist/entry/embed.js">
|
|
59
|
+
</script>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The CDN URL pins to the **major** version (`@1`), so patch + minor releases
|
|
63
|
+
land in every Space automatically; only a deliberate breaking change requires
|
|
64
|
+
each app to update its tag. The host shares its version with the SDK and the
|
|
65
|
+
daemon (single repo, single release, single npm package).
|
|
66
|
+
|
|
67
|
+
## 90-second tour
|
|
68
|
+
|
|
69
|
+
A complete Reachy Mini app, in 4 files:
|
|
70
|
+
|
|
71
|
+
**`index.html`** — picks the entry script based on `?embedded=1`:
|
|
72
|
+
|
|
73
|
+
```html
|
|
74
|
+
<!doctype html>
|
|
75
|
+
<html lang="en">
|
|
76
|
+
<head>
|
|
77
|
+
<meta charset="utf-8" />
|
|
78
|
+
<title>My App</title>
|
|
79
|
+
<script src="https://reachy-mini-js.example/sdk@v1.0.0.js"></script>
|
|
80
|
+
<script type="module" src="/src/dispatch.ts"></script>
|
|
81
|
+
</head>
|
|
82
|
+
<body><div id="root"></div></body>
|
|
83
|
+
</html>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**`src/dispatch.ts`** — routes to host or embed:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
const isEmbed = new URLSearchParams(window.location.search).get('embedded') === '1';
|
|
90
|
+
if (isEmbed) {
|
|
91
|
+
await import('./embed');
|
|
92
|
+
} else {
|
|
93
|
+
await import('./host');
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**`src/host.ts`** — mounts the shell:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import { mountHost } from '@pollen-robotics/reachy-mini-sdk/host/auto';
|
|
101
|
+
|
|
102
|
+
mountHost({
|
|
103
|
+
appName: 'My App',
|
|
104
|
+
appIconUrl: '/icon.svg',
|
|
105
|
+
enableMicrophone: false,
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**`src/embed.ts`** — connects and runs the app:
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
import { connectToHost } from '@pollen-robotics/reachy-mini-sdk/host/embed';
|
|
113
|
+
|
|
114
|
+
const handle = await connectToHost();
|
|
115
|
+
handle.reachy.setHeadRpyDeg(0, 10, 0);
|
|
116
|
+
handle.onLeave(() => {
|
|
117
|
+
console.log('Session ending, cleaning up.');
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
That's the whole contract. The host does OAuth, picks the robot, mounts the
|
|
122
|
+
iframe; the embed wakes the robot and drives it. Everything else is your
|
|
123
|
+
app's logic. See the [App Creation Guide](../APP_CREATION_GUIDE.md)
|
|
124
|
+
for the detailed walk-through and reference apps.
|
|
125
|
+
|
|
126
|
+
## Reference apps
|
|
127
|
+
|
|
128
|
+
Three open-source apps live alongside this package and are kept in lockstep
|
|
129
|
+
with every release:
|
|
130
|
+
|
|
131
|
+
| App | Stack | What it shows |
|
|
132
|
+
|-----|-------|---------------|
|
|
133
|
+
| [`pollen-robotics/reachy_mini_minimal_conversation`](https://huggingface.co/spaces/pollen-robotics/reachy_mini_minimal_conversation) | Vanilla TypeScript | Smallest possible app. Tech-freedom proof. |
|
|
134
|
+
| [`pollen-robotics/reachy_mini_emotions`](https://huggingface.co/spaces/pollen-robotics/reachy_mini_emotions) | React + MUI | Plutchik emotion wheel + dance triggers. |
|
|
135
|
+
| [`pollen-robotics/reachy_mini_telepresence`](https://huggingface.co/spaces/pollen-robotics/reachy_mini_telepresence) | React + MUI | Live video + head / body teleop. |
|
|
136
|
+
|
|
137
|
+
App authors are free to use any UI framework they want inside the iframe; the
|
|
138
|
+
host doesn't care. This is a hard design rule, not an accident
|
|
139
|
+
(see [`APP_CREATION_GUIDE.md` §13.1](../APP_CREATION_GUIDE.md#131-roles-app--host--embed)
|
|
140
|
+
"Why React + MUI for the host (and only the host)").
|
|
141
|
+
|
|
142
|
+
## Versioning
|
|
143
|
+
|
|
144
|
+
The host ships inside `@pollen-robotics/reachy-mini-sdk` and shares its
|
|
145
|
+
version with the SDK and the Reachy Mini Python daemon (a single source of
|
|
146
|
+
truth, enforced by the npm publish CI). The major version of the **wire
|
|
147
|
+
protocol** is tracked separately in `PROTOCOL_VERSION` and bumped only on
|
|
148
|
+
incompatible postMessage changes
|
|
149
|
+
(see [`APP_CREATION_GUIDE.md` §13.6](../APP_CREATION_GUIDE.md#136-protocol-v1-messages)).
|
|
150
|
+
|
|
151
|
+
App authors should **pin to the exact version that the reference
|
|
152
|
+
apps use** - today `1.8.0`, see
|
|
153
|
+
[`APP_CREATION_GUIDE.md` §10](../APP_CREATION_GUIDE.md#10-sdk-version-pinning).
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
Apache-2.0 - see [LICENSE](../LICENSE).
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public React component for the host shell.
|
|
3
|
+
*
|
|
4
|
+
* Wraps `ReachyHostShell` with the bundled MUI theme provider,
|
|
5
|
+
* CssBaseline, and the React-friendly hooks. App authors who
|
|
6
|
+
* want a single `<ReachyHost />` JSX node import this; everyone
|
|
7
|
+
* else uses `mountHost()`.
|
|
8
|
+
*
|
|
9
|
+
* Strict Mode safety: the underlying `useSdk` hook stores its
|
|
10
|
+
* SDK instance at module scope, so a double-mount in dev does
|
|
11
|
+
* NOT create two SDK instances. See APP_CREATION_GUIDE
|
|
12
|
+
* §13.5.1 (single live SDK per tab) and §13.5.4 (StrictMode safety).
|
|
13
|
+
*/
|
|
14
|
+
import type { JSX } from 'react';
|
|
15
|
+
import type { ConfigPayload } from './lib/protocol';
|
|
16
|
+
export interface ReachyHostProps {
|
|
17
|
+
/** App's display name. Required - shown in top bar, passed to
|
|
18
|
+
* the SDK, and surfaced to other apps that may collide on a
|
|
19
|
+
* busy robot. */
|
|
20
|
+
appName: string;
|
|
21
|
+
/** Top-bar icon. Recommended size 32×32. */
|
|
22
|
+
appIconUrl?: string;
|
|
23
|
+
/** Emoji fallback if no icon. */
|
|
24
|
+
appEmoji?: string;
|
|
25
|
+
/** Allow microphone capture inside the iframe. */
|
|
26
|
+
enableMicrophone?: boolean;
|
|
27
|
+
/** HF OAuth client ID. Falls back to
|
|
28
|
+
* `window.huggingface.variables.OAUTH_CLIENT_ID` then
|
|
29
|
+
* `localStorage`. */
|
|
30
|
+
clientId?: string;
|
|
31
|
+
/** Embed entry path (defaults to `/?embedded=1`). */
|
|
32
|
+
embedPath?: string;
|
|
33
|
+
/** Host display name (e.g. "Reachy Mini Hub"). */
|
|
34
|
+
hostName?: string;
|
|
35
|
+
/** Initial config payload (typically decoded from
|
|
36
|
+
* `?config=`). */
|
|
37
|
+
initialConfig?: ConfigPayload;
|
|
38
|
+
}
|
|
39
|
+
export declare function ReachyHost({ appName, appIconUrl, appEmoji, enableMicrophone, clientId, embedPath, hostName, initialConfig, }: ReachyHostProps): JSX.Element;
|
|
40
|
+
//# sourceMappingURL=ReachyHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReachyHost.d.ts","sourceRoot":"","sources":["../src/ReachyHost.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAcjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B;;sBAEkB;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;0BAEsB;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;uBACmB;IACnB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,UAAU,EACV,QAAQ,EACR,gBAAwB,EACxB,QAAQ,EACR,SAA0B,EAC1B,QAAwB,EACxB,aAAa,GACd,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAyC/B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asset imports re-exported as data URIs (Vite's
|
|
3
|
+
* `assetsInlineLimit: Infinity` inlines every SVG / image into
|
|
4
|
+
* the JS bundle, so the host package ships as a single self-
|
|
5
|
+
* contained CDN file - no per-app `public/` shipping).
|
|
6
|
+
*
|
|
7
|
+
* Consume these via `import { connectionSvg } from '@/assets'`
|
|
8
|
+
* (or `../assets`) and pass them straight to `<img src={...}>`.
|
|
9
|
+
*/
|
|
10
|
+
import connectionSvg from './connection.svg';
|
|
11
|
+
import hfLogoSvg from './hf-logo.svg';
|
|
12
|
+
import reachyBusteSvg from './reachy-buste.svg';
|
|
13
|
+
import reachyHeadSvg from './reachy-head.svg';
|
|
14
|
+
import reachyStandardSvg from './reachy-standard.svg';
|
|
15
|
+
export { connectionSvg, hfLogoSvg, reachyBusteSvg, reachyHeadSvg, reachyStandardSvg, };
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,SAAS,MAAM,eAAe,CAAC;AACtC,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,iBAAiB,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EACL,aAAa,EACb,SAAS,EACT,cAAc,EACd,aAAa,EACb,iBAAiB,GAClB,CAAC"}
|