@pollen-robotics/reachy-mini-sdk 1.7.3-main.b44388c

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-CM-WMoGJ.js +1425 -0
  16. package/host/dist/chunks/reachy-mini-sdk-CM-WMoGJ.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 +2164 -0
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Shared design tokens.
3
+ *
4
+ * Mirrors `reachy_mini_mobile_app/src/ui/design/tokens.ts` so the
5
+ * host shell, the mobile shell, and the desktop app share one
6
+ * visual vocabulary (typography scale, weight scale, radii,
7
+ * status colours, motion durations). Keep this file in lockstep
8
+ * with the mobile one - drift is what gets flagged at design
9
+ * review.
10
+ *
11
+ * Safe-area insets are NOT exposed here: the host shell ships on
12
+ * desktop browsers and HF Spaces, where notch / home-indicator
13
+ * insets are not a concern. The mobile shell keeps that layer in
14
+ * its own tokens module.
15
+ */
16
+ export declare const TYPO: {
17
+ readonly micro: "0.65rem";
18
+ readonly tiny: "0.7rem";
19
+ readonly xs: "0.75rem";
20
+ readonly sm: "0.8rem";
21
+ readonly body: "0.85rem";
22
+ readonly md: "0.9rem";
23
+ readonly lg: "1rem";
24
+ readonly xl: "1.1rem";
25
+ readonly xxl: "1.25rem";
26
+ readonly hero: "1.5rem";
27
+ readonly display: "1.625rem";
28
+ };
29
+ export declare const FONT_WEIGHT: {
30
+ readonly regular: 400;
31
+ readonly medium: 500;
32
+ readonly semibold: 600;
33
+ readonly bold: 700;
34
+ };
35
+ export declare const RADIUS: {
36
+ readonly xs: 4;
37
+ readonly sm: 6;
38
+ readonly md: 8;
39
+ readonly lg: 12;
40
+ readonly xl: 16;
41
+ readonly xxl: 20;
42
+ readonly pill: 9999;
43
+ readonly circle: "50%";
44
+ };
45
+ export declare const STATUS: {
46
+ readonly success: "#22c55e";
47
+ readonly successSoft: "#16a34a";
48
+ readonly error: "#ef4444";
49
+ readonly warning: "#f59e0b";
50
+ readonly info: "#6366f1";
51
+ };
52
+ export declare const DURATION: {
53
+ readonly fast: 150;
54
+ readonly base: 250;
55
+ readonly slow: 400;
56
+ };
57
+ export declare const LAYOUT: {
58
+ /** Max width of any centred "card-in-screen" content (sign-in,
59
+ * picker, error). Matches the mobile shell. */
60
+ readonly contentMaxWidth: 420;
61
+ readonly heroSize: 160;
62
+ readonly heroSizeSmall: 120;
63
+ };
64
+ //# sourceMappingURL=tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/lib/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;CAYP,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;CAKd,CAAC;AAEX,eAAO,MAAM,MAAM;;;;;;;;;CAST,CAAC;AAEX,eAAO,MAAM,MAAM;;;;;;CAMT,CAAC;AAEX,eAAO,MAAM,QAAQ;;;;CAIX,CAAC;AAEX,eAAO,MAAM,MAAM;IACjB;oDACgD;;;;CAIxC,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { ConfigPayload } from './lib/protocol';
2
+ export interface MountHostOptions {
3
+ /** REQUIRED. Passed to the SDK + shown in the top bar. */
4
+ appName: string;
5
+ /** Optional top-bar logo. Recommended PNG/SVG, 32×32. */
6
+ appIconUrl?: string;
7
+ /** Optional emoji fallback (used when no icon URL). */
8
+ appEmoji?: string;
9
+ /** Allow microphone capture inside the iframe. */
10
+ enableMicrophone?: boolean;
11
+ /** HF OAuth client ID override; falls back to HF Spaces
12
+ * injection then localStorage. */
13
+ clientId?: string;
14
+ /** Dev shortcut: seed a personal access token so the host
15
+ * skips the OAuth dance. Strip this before deploying. */
16
+ devToken?: {
17
+ token: string;
18
+ userName: string;
19
+ };
20
+ /** Mount target: an HTMLElement or a CSS selector. Defaults
21
+ * to `#root` (auto-created if missing). */
22
+ target?: HTMLElement | string;
23
+ /** Embed path within the same origin. Defaults to
24
+ * `/?embedded=1`. */
25
+ embedPath?: string;
26
+ /** Override the host display name in the top bar. */
27
+ hostName?: string;
28
+ /** Pre-set the initial config (mostly for tests; production
29
+ * reads `?config=` automatically). */
30
+ initialConfig?: ConfigPayload;
31
+ }
32
+ export interface MountedHost {
33
+ unmount(): void;
34
+ }
35
+ export declare function mountHost(options: MountHostOptions): MountedHost;
36
+ //# sourceMappingURL=mountHost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mountHost.d.ts","sourceRoot":"","sources":["../src/mountHost.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,WAAW,gBAAgB;IAC/B,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;uCACmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;8DAC0D;IAC1D,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C;gDAC4C;IAC5C,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAC9B;0BACsB;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;2CACuC;IACvC,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,WAAW,CA6ChE"}
package/package.json ADDED
@@ -0,0 +1,109 @@
1
+ {
2
+ "name": "@pollen-robotics/reachy-mini-sdk",
3
+ "version": "1.7.3-main.b44388c",
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
+ "type": "module",
6
+ "main": "./reachy-mini-sdk.js",
7
+ "module": "./reachy-mini-sdk.js",
8
+ "types": "./reachy-mini-sdk.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./reachy-mini-sdk.d.ts",
12
+ "import": "./reachy-mini-sdk.js",
13
+ "default": "./reachy-mini-sdk.js"
14
+ },
15
+ "./host": {
16
+ "types": "./host/dist/index.d.ts",
17
+ "import": "./host/dist/index.js"
18
+ },
19
+ "./host/auto": {
20
+ "types": "./host/dist/entry/auto.d.ts",
21
+ "import": "./host/dist/entry/auto.js"
22
+ },
23
+ "./host/embed": {
24
+ "types": "./host/dist/entry/embed.d.ts",
25
+ "import": "./host/dist/entry/embed.js"
26
+ },
27
+ "./host/protocol": {
28
+ "types": "./host/dist/lib/protocol.d.ts",
29
+ "import": "./host/dist/lib/protocol.js"
30
+ },
31
+ "./package.json": "./package.json"
32
+ },
33
+ "files": [
34
+ "reachy-mini-sdk.js",
35
+ "reachy-mini-sdk.d.ts",
36
+ "host/dist",
37
+ "host/README.md",
38
+ "host/SPEC.md",
39
+ "host/APP_AUTHOR_GUIDE.md",
40
+ "README.md",
41
+ "CHANGELOG.md",
42
+ "LICENSE"
43
+ ],
44
+ "sideEffects": false,
45
+ "scripts": {
46
+ "build": "cd host && vite build && tsc -p tsconfig.build.json",
47
+ "build:watch": "cd host && vite build --watch",
48
+ "typecheck": "cd host && tsc --noEmit",
49
+ "dev": "cd host && vite",
50
+ "clean": "rm -rf host/dist"
51
+ },
52
+ "dependencies": {
53
+ "@emotion/react": "^11.14.0",
54
+ "@emotion/styled": "^11.14.1",
55
+ "@huggingface/hub": "^0.15.2",
56
+ "@mui/icons-material": "^7.3.5",
57
+ "@mui/material": "^7.3.5"
58
+ },
59
+ "peerDependencies": {
60
+ "react": "^18.0.0 || ^19.0.0",
61
+ "react-dom": "^18.0.0 || ^19.0.0"
62
+ },
63
+ "peerDependenciesMeta": {
64
+ "react": {
65
+ "optional": true
66
+ },
67
+ "react-dom": {
68
+ "optional": true
69
+ }
70
+ },
71
+ "devDependencies": {
72
+ "@types/node": "^25.7.0",
73
+ "@types/react": "^19.2.14",
74
+ "@types/react-dom": "^19.2.3",
75
+ "@vitejs/plugin-react-swc": "^4.0.0",
76
+ "react": "^19.2.5",
77
+ "react-dom": "^19.2.5",
78
+ "typescript": "^5.7.3",
79
+ "vite": "^7.2.1"
80
+ },
81
+ "keywords": [
82
+ "reachy",
83
+ "reachy-mini",
84
+ "pollen-robotics",
85
+ "robot",
86
+ "robotics",
87
+ "webrtc",
88
+ "sdk",
89
+ "browser",
90
+ "huggingface-spaces",
91
+ "host",
92
+ "iframe",
93
+ "shell"
94
+ ],
95
+ "author": "Pollen Robotics",
96
+ "license": "Apache-2.0",
97
+ "homepage": "https://github.com/pollen-robotics/reachy_mini#readme",
98
+ "bugs": {
99
+ "url": "https://github.com/pollen-robotics/reachy_mini/issues"
100
+ },
101
+ "repository": {
102
+ "type": "git",
103
+ "url": "git+https://github.com/pollen-robotics/reachy_mini.git",
104
+ "directory": "js"
105
+ },
106
+ "publishConfig": {
107
+ "access": "public"
108
+ }
109
+ }
@@ -0,0 +1,285 @@
1
+ /**
2
+ * Type declarations for the ReachyMini browser SDK. These are the
3
+ * canonical types shipped with the npm package — the host shell
4
+ * (`./host` subpath) re-exports them via `host/src/lib/sdk-types.ts`
5
+ * so React components, hooks, and the embed client all see exactly
6
+ * the same surface.
7
+ *
8
+ * The runtime lives in `reachy-mini-sdk.js`; this `.d.ts` only
9
+ * declares the public types. We hand-maintain it (rather than
10
+ * generating from the JSDoc) so consumers get rich types without an
11
+ * extra build step on our side.
12
+ *
13
+ * Legacy CDN consumers can still expose the constructor on
14
+ * `window.ReachyMini` themselves; the global declaration at the
15
+ * bottom keeps that shape typed.
16
+ */
17
+
18
+ /** Robot summary returned by the central via `robots`/`robotsChanged`. */
19
+ export interface RobotInfo {
20
+ id: string;
21
+ meta?: { name?: string };
22
+ /**
23
+ * `true` when the central reports an active session held by
24
+ * another consumer. Older centrals omit it; default `false`.
25
+ */
26
+ busy?: boolean;
27
+ /**
28
+ * Friendly name of the app currently holding the session, when
29
+ * the busy consumer advertised one. Pure UX hint, never trust
30
+ * for security decisions. `null` / undefined when the robot is
31
+ * free.
32
+ */
33
+ activeApp?: string | null;
34
+ /**
35
+ * Network transport reported by the daemon (`wifi` / `usb` /
36
+ * arbitrary string). Surfaced as a chip on the discovery card.
37
+ * Older centrals or non-conformant daemons may omit it.
38
+ */
39
+ transport?: string | null;
40
+ /**
41
+ * Hardware id reported by the daemon (e.g. serial number).
42
+ * When present, the picker shows it in place of the (longer,
43
+ * less human-friendly) peer id. Optional.
44
+ */
45
+ hardwareId?: string | null;
46
+ }
47
+
48
+ /** Latest robot telemetry mirrored on `robot.robotState` (wire shape). */
49
+ export interface RobotState {
50
+ /** Flat row-major 4×4 head pose (16 numbers). */
51
+ head?: number[];
52
+ /** [rightRad, leftRad]. */
53
+ antennas?: number[];
54
+ /** Radians. */
55
+ body_yaw?: number;
56
+ motor_mode?: 'enabled' | 'disabled' | 'gravity_compensation';
57
+ is_move_running?: boolean;
58
+ }
59
+
60
+ /** SDK constructor options. */
61
+ export interface ReachyMiniOptions {
62
+ signalingUrl?: string;
63
+ enableMicrophone?: boolean;
64
+ clientId?: string;
65
+ appName?: string;
66
+ /**
67
+ * Hint to the receiver's WebRTC jitter buffer (ms). 0 = "render
68
+ * ASAP", appropriate for teleop. Spec range [0, 4000]. Browsers
69
+ * that don't implement `RTCRtpReceiver.jitterBufferTarget` fall
70
+ * back to default buffering (~150-200 ms).
71
+ */
72
+ videoJitterBufferTargetMs?: number;
73
+ /**
74
+ * When true AND the URL carries a `robot_peer_id` hint, the SDK
75
+ * auto-calls `startSession(preselectedRobotId)` once that robot
76
+ * appears in the central's list after `connect()` resolves. One-shot
77
+ * per page load; the host iframe relies on this to skip the picker.
78
+ */
79
+ autoStartFromUrl?: boolean;
80
+ }
81
+
82
+ /** Options accepted by `autoConnect()`. */
83
+ export interface AutoConnectOptions {
84
+ /** Skip `authenticate()`; use this raw HF token. */
85
+ token?: string;
86
+ /**
87
+ * Called in the standalone, multi-robot case to let the consumer
88
+ * pick a robot from the live list. Return the robot id, or `null`
89
+ * to cancel.
90
+ */
91
+ pickRobot?: (robots: AutoConnectRobotChoice[]) => Promise<string | null>;
92
+ /** Skip `pickRobot` when exactly one robot is free. Default `true`. */
93
+ autoPickIfSingle?: boolean;
94
+ /** Hide busy robots from the picker. Default `true`. */
95
+ filterBusy?: boolean;
96
+ /** Call `ensureAwake()` after `startSession()`. Default `true`. */
97
+ wakeOnConnect?: boolean;
98
+ }
99
+
100
+ /** Robot row passed to `pickRobot` callback (richer than `RobotInfo`). */
101
+ export interface AutoConnectRobotChoice {
102
+ id: string;
103
+ name: string | null;
104
+ busy: boolean;
105
+ activeApp: string | null;
106
+ meta: Record<string, unknown>;
107
+ lastSeenAgeSeconds: number | null;
108
+ }
109
+
110
+ /** Resolution payload of `autoConnect()`. */
111
+ export interface AutoConnectResult {
112
+ robotId: string;
113
+ robotName: string | null;
114
+ isEmbedded: boolean;
115
+ /** Set when `autoConnect()` short-circuited on an already-streaming session. */
116
+ alreadyStreaming?: boolean;
117
+ }
118
+
119
+ /** Options for the awaitable motion helpers (`wakeUp`, `gotoSleep`). */
120
+ export interface MotionAwaitOptions {
121
+ /**
122
+ * Hard upper bound for the trajectory completion response from the
123
+ * daemon. Defaults to 8000 ms (typical wake_up is ~1-3 s, but
124
+ * deeply offset poses can take longer). The returned promise
125
+ * rejects with a `${command} timed out after ${timeoutMs}ms` error
126
+ * if the daemon goes silent.
127
+ */
128
+ timeoutMs?: number;
129
+ }
130
+
131
+ /** `subscribeLogs()` argument. */
132
+ export interface SubscribeLogsOptions {
133
+ onLine: (entry: { timestamp: string; line: string }) => void;
134
+ onError?: (error: string) => void;
135
+ }
136
+
137
+ /** Public surface of a ReachyMini SDK instance. */
138
+ export interface ReachyMiniInstance extends EventTarget {
139
+ readonly state: 'disconnected' | 'connected' | 'streaming';
140
+ readonly robots: RobotInfo[];
141
+ /**
142
+ * Mirror of the latest "state" event detail. Fields appear only once
143
+ * the daemon has sent the corresponding source field.
144
+ */
145
+ readonly robotState: RobotState;
146
+ readonly username: string | null;
147
+ readonly isAuthenticated: boolean;
148
+ readonly micSupported: boolean;
149
+ readonly micMuted: boolean;
150
+ readonly audioMuted: boolean;
151
+ /** Set by the SDK from `?robot_peer_id=` / `#robot_peer_id=`. */
152
+ readonly preselectedRobotId: string | null;
153
+ /** `true` iff `preselectedRobotId !== null`. UX branching helper. */
154
+ readonly isEmbedded: boolean;
155
+
156
+ /** Underlying RTCPeerConnection. Apps can read it to inspect
157
+ * audio / video transceivers. */
158
+ _pc: RTCPeerConnection | null;
159
+ /** Local microphone MediaStream acquired by the SDK on
160
+ * `startSession()` when `enableMicrophone` is `true`. */
161
+ _micStream: MediaStream | null;
162
+
163
+ authenticate(): Promise<boolean>;
164
+ login(): Promise<void>;
165
+ logout(): void;
166
+
167
+ connect(token?: string): Promise<void>;
168
+ /**
169
+ * One-shot bring-up: auth → SSE connect → robot selection → session →
170
+ * wake up. The all-in-one entry point that captures the common
171
+ * "embed *or* standalone, just get me streaming" flow.
172
+ */
173
+ autoConnect(options?: AutoConnectOptions): Promise<AutoConnectResult>;
174
+ disconnect(): void;
175
+
176
+ startSession(robotId: string): Promise<void>;
177
+ stopSession(): Promise<void>;
178
+
179
+ attachVideo(el: HTMLVideoElement): () => void;
180
+
181
+ setHeadRpyDeg(roll: number, pitch: number, yaw: number): boolean;
182
+ setAntennasDeg(right: number, left: number): boolean;
183
+ setBodyYawDeg(yawDeg: number): boolean;
184
+ /**
185
+ * Streaming variant for the trajectory player: sets the full
186
+ * target frame at 50-100 Hz. Unspecified joints keep their
187
+ * previous target. Returns `false` if the data channel is not
188
+ * open.
189
+ */
190
+ setTarget(args: {
191
+ head?: number[];
192
+ antennas?: number[];
193
+ body_yaw?: number;
194
+ }): boolean;
195
+ /**
196
+ * Smooth daemon-side interpolation to a target pose over `duration`
197
+ * seconds. Mirrors `setTarget`'s wire shape and adds a required
198
+ * `duration` field. Throws `TypeError` on invalid input.
199
+ */
200
+ gotoTarget(args: {
201
+ head?: number[];
202
+ antennas?: number[];
203
+ body_yaw?: number;
204
+ duration: number;
205
+ }): boolean;
206
+ /** Send an arbitrary JSON message on the data channel. */
207
+ sendRaw(data: unknown): boolean;
208
+ /** Play a sound file on the robot's speakers (basename). */
209
+ playSound(file: string): boolean;
210
+
211
+ setAudioMuted(muted: boolean): void;
212
+ setMicMuted(muted: boolean): void;
213
+
214
+ getVolume(): Promise<number | null>;
215
+ setVolume(volume: number): Promise<number | null>;
216
+ getMicrophoneVolume(): Promise<number | null>;
217
+ setMicrophoneVolume(volume: number): Promise<number | null>;
218
+
219
+ /** Daemon version string, or `null` when unavailable. */
220
+ getVersion(): Promise<string | null>;
221
+ /** Hardware ID (USB serial), or `null` on developer machines. */
222
+ getHardwareId(): Promise<string | null>;
223
+ /** Force a `state` event right now (background poll runs at 500 ms). */
224
+ requestState(): boolean;
225
+ /** Subscribe to daemon `journalctl` logs over the data channel. */
226
+ subscribeLogs(options: SubscribeLogsOptions): () => void;
227
+
228
+ /**
229
+ * Motor torque mode: `enabled` (position control), `disabled`
230
+ * (limp), `gravity_compensation` (float-by-hand). Returns
231
+ * `false` if the data channel is not open.
232
+ */
233
+ setMotorMode(
234
+ mode: 'enabled' | 'disabled' | 'gravity_compensation',
235
+ ): boolean;
236
+ /**
237
+ * Per-motor torque toggle. When `ids` is omitted, applies globally
238
+ * (equivalent to `setMotorMode("enabled" | "disabled")`).
239
+ */
240
+ setMotorTorque(on: boolean, ids?: string[] | null): boolean;
241
+ /**
242
+ * Play the wake-up trajectory (enables motors first). Resolves on
243
+ * the daemon's `{command: "wake_up", completed: true}` response,
244
+ * rejects on `timeoutMs` elapsed or on session teardown.
245
+ */
246
+ wakeUp(options?: MotionAwaitOptions): Promise<void>;
247
+ /**
248
+ * Play the goto-sleep trajectory. Resolves when the daemon reports
249
+ * completion. Does NOT touch motor mode; caller manages it.
250
+ */
251
+ gotoSleep(options?: MotionAwaitOptions): Promise<void>;
252
+ /** Read the awake state from the cached `motor_mode`. */
253
+ isAwake(): boolean;
254
+ /**
255
+ * Idempotent wakeUp: noop when already awake. Resolves with
256
+ * the post-call awake state. Does NOT await the trajectory.
257
+ */
258
+ ensureAwake(timeoutMs?: number): Promise<boolean>;
259
+ }
260
+
261
+ export type ReachyMiniConstructor = new (
262
+ options?: ReachyMiniOptions,
263
+ ) => ReachyMiniInstance;
264
+
265
+ /** SDK constructor. */
266
+ export const ReachyMini: ReachyMiniConstructor;
267
+
268
+ /** Degrees → radians. */
269
+ export function degToRad(deg: number): number;
270
+ /** Radians → degrees. */
271
+ export function radToDeg(rad: number): number;
272
+ /** Roll/pitch/yaw (degrees) → 4×4 rotation matrix (ZYX convention). */
273
+ export function rpyToMatrix(
274
+ rollDeg: number,
275
+ pitchDeg: number,
276
+ yawDeg: number,
277
+ ): number[][];
278
+ /** Rotation matrix (3×3 or 4×4) → `{ roll, pitch, yaw }` in degrees. */
279
+ export function matrixToRpy(m: number[][]): {
280
+ roll: number;
281
+ pitch: number;
282
+ yaw: number;
283
+ };
284
+
285
+ export default ReachyMini;