@pollen-robotics/reachy-mini-sdk 1.9.0 → 1.10.0-dev.0.main.50ba239
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 +98 -0
- package/dist/lib/central-listener.d.ts +71 -0
- package/dist/lib/central-listener.d.ts.map +1 -0
- package/dist/lib/central-listener.js +277 -0
- package/dist/lib/central-listener.js.map +1 -0
- package/dist/lib/central-listener.test.d.ts +2 -0
- package/dist/lib/central-listener.test.d.ts.map +1 -0
- package/dist/lib/central-listener.test.js +378 -0
- package/dist/lib/central-listener.test.js.map +1 -0
- package/dist/lib/dc-watchdog.test.d.ts +2 -0
- package/dist/lib/dc-watchdog.test.d.ts.map +1 -0
- package/dist/lib/dc-watchdog.test.js +154 -0
- package/dist/lib/dc-watchdog.test.js.map +1 -0
- package/dist/lib/ensure-awake.test.d.ts +2 -0
- package/dist/lib/ensure-awake.test.d.ts.map +1 -0
- package/dist/lib/ensure-awake.test.js +117 -0
- package/dist/lib/ensure-awake.test.js.map +1 -0
- package/dist/lib/ice-grace.test.d.ts +2 -0
- package/dist/lib/ice-grace.test.d.ts.map +1 -0
- package/dist/lib/ice-grace.test.js +211 -0
- package/dist/lib/ice-grace.test.js.map +1 -0
- package/dist/lib/imu.test.d.ts +2 -0
- package/dist/lib/imu.test.d.ts.map +1 -0
- package/dist/lib/imu.test.js +78 -0
- package/dist/lib/imu.test.js.map +1 -0
- package/dist/lib/logger.d.ts +38 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +81 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/pending-replies.d.ts +127 -0
- package/dist/lib/pending-replies.d.ts.map +1 -0
- package/dist/lib/pending-replies.js +255 -0
- package/dist/lib/pending-replies.js.map +1 -0
- package/dist/lib/pending-replies.test.d.ts +2 -0
- package/dist/lib/pending-replies.test.d.ts.map +1 -0
- package/dist/lib/pending-replies.test.js +217 -0
- package/dist/lib/pending-replies.test.js.map +1 -0
- package/dist/lib/reachy-mini.d.ts +177 -88
- package/dist/lib/reachy-mini.d.ts.map +1 -1
- package/dist/lib/reachy-mini.js +603 -566
- package/dist/lib/reachy-mini.js.map +1 -1
- package/dist/lib/redial.test.d.ts +2 -0
- package/dist/lib/redial.test.d.ts.map +1 -0
- package/dist/lib/redial.test.js +206 -0
- package/dist/lib/redial.test.js.map +1 -0
- package/dist/lib/request.test.d.ts +2 -0
- package/dist/lib/request.test.d.ts.map +1 -0
- package/dist/lib/request.test.js +90 -0
- package/dist/lib/request.test.js.map +1 -0
- package/dist/lib/session-supervisor.d.ts +201 -0
- package/dist/lib/session-supervisor.d.ts.map +1 -0
- package/dist/lib/session-supervisor.js +520 -0
- package/dist/lib/session-supervisor.js.map +1 -0
- package/dist/lib/token-store.d.ts +50 -0
- package/dist/lib/token-store.d.ts.map +1 -0
- package/dist/lib/token-store.js +120 -0
- package/dist/lib/token-store.js.map +1 -0
- package/dist/lib/token-store.test.d.ts +2 -0
- package/dist/lib/token-store.test.d.ts.map +1 -0
- package/dist/lib/token-store.test.js +82 -0
- package/dist/lib/token-store.test.js.map +1 -0
- package/dist/lib/types.d.ts +237 -6
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/url-helpers.d.ts.map +1 -1
- package/dist/lib/url-helpers.js +3 -1
- package/dist/lib/url-helpers.js.map +1 -1
- package/dist/lib/version.d.ts +2 -0
- package/dist/lib/version.d.ts.map +1 -0
- package/dist/lib/version.js +5 -0
- package/dist/lib/version.js.map +1 -0
- package/dist/reachy-mini-sdk.d.ts +15 -1
- package/dist/reachy-mini-sdk.d.ts.map +1 -1
- package/dist/reachy-mini-sdk.js +12 -0
- package/dist/reachy-mini-sdk.js.map +1 -1
- package/host/dist/ReachyHost.d.ts.map +1 -1
- package/host/dist/chunks/centralRest-CCkHVzTj.js +2209 -0
- package/host/dist/chunks/index-CS_PVKrS.js +703 -0
- package/host/dist/chunks/{mountHost-DjE5zE9R.js → mountHost-L2vGsxTL.js} +24995 -27491
- package/host/dist/components/ConnectingView.d.ts.map +1 -1
- package/host/dist/components/DaemonUpdateGate.d.ts +65 -0
- package/host/dist/components/DaemonUpdateGate.d.ts.map +1 -0
- package/host/dist/components/ErrorView.d.ts.map +1 -1
- package/host/dist/components/HostErrorBoundary.d.ts +30 -0
- package/host/dist/components/HostErrorBoundary.d.ts.map +1 -0
- package/host/dist/components/LeavingView.d.ts.map +1 -1
- package/host/dist/components/PickerView.d.ts +16 -14
- package/host/dist/components/PickerView.d.ts.map +1 -1
- package/host/dist/components/PostOAuthSplash.d.ts +14 -9
- package/host/dist/components/PostOAuthSplash.d.ts.map +1 -1
- package/host/dist/components/ReachyHostShell.d.ts.map +1 -1
- package/host/dist/components/SignInView.d.ts.map +1 -1
- package/host/dist/components/TopBar.d.ts +5 -6
- package/host/dist/components/TopBar.d.ts.map +1 -1
- package/host/dist/components/WelcomeBackOverlay.d.ts.map +1 -1
- package/host/dist/embed/index.d.ts +63 -2
- package/host/dist/embed/index.d.ts.map +1 -1
- package/host/dist/entry/auto.js +2 -2
- package/host/dist/entry/embed.d.ts +5 -4
- package/host/dist/entry/embed.d.ts.map +1 -1
- package/host/dist/entry/embed.js +5 -4
- package/host/dist/hooks/useHostBridge.d.ts +35 -1
- package/host/dist/hooks/useHostBridge.d.ts.map +1 -1
- package/host/dist/hooks/useLatestDaemonVersion.d.ts +7 -0
- package/host/dist/hooks/useLatestDaemonVersion.d.ts.map +1 -0
- package/host/dist/hooks/useOAuth.d.ts +18 -0
- package/host/dist/hooks/useOAuth.d.ts.map +1 -1
- package/host/dist/hooks/useRobots.d.ts +0 -2
- package/host/dist/hooks/useRobots.d.ts.map +1 -1
- package/host/dist/index.d.ts +2 -2
- package/host/dist/index.d.ts.map +1 -1
- package/host/dist/index.js +11 -10
- package/host/dist/lib/daemonRelease.d.ts +84 -0
- package/host/dist/lib/daemonRelease.d.ts.map +1 -0
- package/host/dist/lib/protocol.d.ts +141 -7
- package/host/dist/lib/protocol.d.ts.map +1 -1
- package/host/dist/lib/rebootWatch.d.ts +51 -0
- package/host/dist/lib/rebootWatch.d.ts.map +1 -0
- package/host/dist/lib/sdk-types.d.ts +1 -1
- package/host/dist/lib/sdk-types.d.ts.map +1 -1
- package/host/dist/lib/settings.d.ts +16 -5
- package/host/dist/lib/settings.d.ts.map +1 -1
- package/package.json +11 -4
- package/host/dist/chunks/index-lMs2sCXG.js +0 -439
- package/host/dist/chunks/reachy-mini-CdsdQLIU.js +0 -1523
- package/host/dist/lib/centralListener.d.ts +0 -73
- package/host/dist/lib/centralListener.d.ts.map +0 -1
|
@@ -3,16 +3,8 @@
|
|
|
3
3
|
* See `../reachy-mini-sdk.ts` for the package's barrel and the README for
|
|
4
4
|
* a quick-start guide.
|
|
5
5
|
*/
|
|
6
|
-
import type { ApplyAudioConfigOptions, AudioConfigEntry, AutoConnectOptions, AutoConnectResult, FaceTarget, MotionAwaitOptions, MoveData, PlayMoveOptions, PlayMoveResult, PlayUploadedAudioOptions, ReachyMiniInstance, ReachyMiniOptions, RobotInfo, RobotState, SubscribeLogsOptions, UploadAudioOptions } from './types.js';
|
|
7
|
-
|
|
8
|
-
export interface UpdateProgressEvent {
|
|
9
|
-
status: 'in_progress' | 'done' | 'failed';
|
|
10
|
-
/** A log line of the underlying update job (when `in_progress`). */
|
|
11
|
-
line?: string;
|
|
12
|
-
/** Set when `status === 'failed'`. */
|
|
13
|
-
error?: string;
|
|
14
|
-
}
|
|
15
|
-
type UpdateProgressCallback = (event: UpdateProgressEvent) => void;
|
|
6
|
+
import type { ApplyAudioConfigOptions, AudioConfigEntry, AutoConnectOptions, AutoConnectResult, FaceTarget, ImuData, LoginOptions, MotionAwaitOptions, MoveData, PlayMoveOptions, PlayMoveResult, PlayUploadedAudioOptions, ReachyMiniInstance, ReachyMiniOptions, RequestOptions, RobotInfo, RobotState, StartDaemonUpdateOptions, SubscribeLogsOptions, UpdateProgressEvent, UploadAudioOptions } from './types.js';
|
|
7
|
+
export type { UpdateProgressEvent };
|
|
16
8
|
export declare class ReachyMini extends EventTarget implements ReachyMiniInstance {
|
|
17
9
|
private readonly _signalingUrl;
|
|
18
10
|
private readonly _clientId;
|
|
@@ -23,6 +15,9 @@ export declare class ReachyMini extends EventTarget implements ReachyMiniInstanc
|
|
|
23
15
|
private _state;
|
|
24
16
|
private _robots;
|
|
25
17
|
private _robotState;
|
|
18
|
+
private _lastPoseSeq;
|
|
19
|
+
private _lastPoseFrameAt;
|
|
20
|
+
private _poseSubRefs;
|
|
26
21
|
private readonly _preselectedRobotId;
|
|
27
22
|
private _token;
|
|
28
23
|
private _username;
|
|
@@ -39,29 +34,17 @@ export declare class ReachyMini extends EventTarget implements ReachyMiniInstanc
|
|
|
39
34
|
private _micSupported;
|
|
40
35
|
private _latencyMonitorId;
|
|
41
36
|
private _stateRefreshInterval;
|
|
42
|
-
private
|
|
43
|
-
private _hardwareIdResolve;
|
|
44
|
-
private _volumeResolve;
|
|
45
|
-
private _micVolumeResolve;
|
|
46
|
-
private _trackedFaceResolve;
|
|
47
|
-
private _applyAudioConfigResolve;
|
|
48
|
-
private _readAudioParameterResolve;
|
|
37
|
+
private readonly _pending;
|
|
49
38
|
private readonly _logSubscribers;
|
|
50
39
|
private readonly _updateProgressSubscribers;
|
|
51
|
-
private
|
|
40
|
+
private readonly _rpcListeners;
|
|
52
41
|
private _activeMoveUploadId;
|
|
53
42
|
private _activeAudioUploadId;
|
|
54
43
|
private _sessionResolve;
|
|
55
44
|
private _sessionReject;
|
|
56
45
|
private _iceConnected;
|
|
57
46
|
private _dcOpen;
|
|
58
|
-
private
|
|
59
|
-
private _iceGraceReason;
|
|
60
|
-
private _pendingVisibilityHandler;
|
|
61
|
-
private _onlineHandler;
|
|
62
|
-
private _offlineHandler;
|
|
63
|
-
private _connectionChangeHandler;
|
|
64
|
-
private readonly _pendingMotionCompletions;
|
|
47
|
+
private readonly _supervisor;
|
|
65
48
|
private _videoElement;
|
|
66
49
|
constructor(options?: ReachyMiniOptions);
|
|
67
50
|
get state(): 'disconnected' | 'connected' | 'streaming';
|
|
@@ -74,6 +57,24 @@ export declare class ReachyMini extends EventTarget implements ReachyMiniInstanc
|
|
|
74
57
|
get audioMuted(): boolean;
|
|
75
58
|
get preselectedRobotId(): string | null;
|
|
76
59
|
get isEmbedded(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Live RTCPeerConnection, or `null` between sessions. Read-only escape
|
|
62
|
+
* hatch for stats sampling (`getStats()`); mutating it is unsupported.
|
|
63
|
+
* Auto-reconnect re-dials REPLACE this object, so re-read it on every
|
|
64
|
+
* use — never capture it across ticks.
|
|
65
|
+
*/
|
|
66
|
+
get peerConnection(): RTCPeerConnection | null;
|
|
67
|
+
/**
|
|
68
|
+
* Build version of this SDK (npm package `version`), injected from
|
|
69
|
+
* package.json at build time. This is the JS SDK's OWN version and is
|
|
70
|
+
* distinct from `getVersion()`, which asks the DAEMON its version over
|
|
71
|
+
* the data channel. `0.0.0-managed-by-ci` means an unreleased/branch
|
|
72
|
+
* build (npm releases carry a real semver).
|
|
73
|
+
*/
|
|
74
|
+
get sdkVersion(): string;
|
|
75
|
+
/** Same value as the instance `sdkVersion`, reachable without an
|
|
76
|
+
* instance: `ReachyMini.version`. */
|
|
77
|
+
static get version(): string;
|
|
77
78
|
/**
|
|
78
79
|
* Internal: try to honour the `autoStartFromUrl` constructor
|
|
79
80
|
* option. Called from the signaling-message handler after every
|
|
@@ -82,65 +83,55 @@ export declare class ReachyMini extends EventTarget implements ReachyMiniInstanc
|
|
|
82
83
|
*/
|
|
83
84
|
_maybeAutoStart(): void;
|
|
84
85
|
authenticate(): Promise<boolean>;
|
|
85
|
-
login(): Promise<void>;
|
|
86
|
+
login(options?: LoginOptions): Promise<void>;
|
|
86
87
|
logout(): void;
|
|
87
88
|
connect(token?: string): Promise<void>;
|
|
88
89
|
autoConnect(options?: AutoConnectOptions): Promise<AutoConnectResult>;
|
|
89
90
|
private _fetchOwnedRobots;
|
|
90
91
|
private _waitForRobotInList;
|
|
91
92
|
startSession(robotId: string): Promise<void>;
|
|
93
|
+
private _startSessionInternal;
|
|
94
|
+
/**
|
|
95
|
+
* Common transport teardown shared by every session-ending path
|
|
96
|
+
* (stopSession, disconnect, the auto-redial, a session rejection):
|
|
97
|
+
* settle the pending-reply ledger and the startSession() resolvers
|
|
98
|
+
* with `settleErr`, stand the resilience plumbing down, stop the
|
|
99
|
+
* session-scoped timers, release the mic placeholder and close the
|
|
100
|
+
* pc/dc. Returns the session id (already cleared on the instance)
|
|
101
|
+
* so each caller decides whether and how to send `endSession`.
|
|
102
|
+
* What else differs — events, subscriber wipes, where `_state`
|
|
103
|
+
* lands — stays with the callers.
|
|
104
|
+
*/
|
|
105
|
+
private _closeTransport;
|
|
92
106
|
private _failSessionRejected;
|
|
93
107
|
stopSession(): Promise<void>;
|
|
94
108
|
disconnect(): void;
|
|
95
109
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* - If we're still in the originally-observed bad state (or
|
|
108
|
-
* worse), surface the error and reject any pending session
|
|
109
|
-
* promise. The original code path is preserved verbatim so
|
|
110
|
-
* downstream consumers see the same `error` payload shape.
|
|
111
|
-
*/
|
|
112
|
-
private _scheduleIceGrace;
|
|
113
|
-
/**
|
|
114
|
-
* `disconnected` while the tab is hidden. JS timers are throttled
|
|
115
|
-
* in background tabs (Chrome clamps to ~1 Hz, Safari can pause
|
|
116
|
-
* altogether), so a foreground grace timer would either miss the
|
|
117
|
-
* window or fire long after the connection healed. Wait for the
|
|
118
|
-
* tab to come back, then re-evaluate.
|
|
110
|
+
* Enable/disable the automatic session re-dial at runtime.
|
|
111
|
+
* Disabling also aborts any re-dial already in flight. Used by
|
|
112
|
+
* flows that EXPECT the transport to die — e.g. the daemon
|
|
113
|
+
* self-update, whose `systemctl restart` teardown must surface as
|
|
114
|
+
* `sessionStopped` immediately (it's the "install done, rebooting"
|
|
115
|
+
* signal), not get absorbed by ~22 s of doomed reconnect attempts
|
|
116
|
+
* against a robot that is rebooting anyway.
|
|
117
|
+
*
|
|
118
|
+
* Sharp edge: cancelling an in-flight re-dial leaves the session
|
|
119
|
+
* torn down without emitting `sessionStopped` or `error` — the
|
|
120
|
+
* caller owns the terminal event (see `ReachyMiniInstance`).
|
|
119
121
|
*/
|
|
120
|
-
|
|
122
|
+
setAutoReconnect(enabled: boolean): void;
|
|
121
123
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* symmetrically.
|
|
132
|
-
*
|
|
133
|
-
* `connection.change` (NetworkInformation API, Chrome / Android
|
|
134
|
-
* WebView only) is semantically about the TRANSPORT: it fires
|
|
135
|
-
* on Wi-Fi → 4G swaps, AP roams, etc. without necessarily going
|
|
136
|
-
* through `offline`. We forward it as its own `networkChange`
|
|
137
|
-
* event rather than aliasing it onto `networkOnline`, so
|
|
138
|
-
* consumers don't have to guess whether they're seeing a real
|
|
139
|
-
* connectivity recovery or a silent transport swap.
|
|
124
|
+
* Transport-only teardown: everything stopSession() does EXCEPT the
|
|
125
|
+
* user-facing state flip (`sessionStopped` is not emitted, `_state`
|
|
126
|
+
* falls back to 'connected' so the re-dial can start a session).
|
|
127
|
+
* Pending promises that ride the dead channel are settled just like
|
|
128
|
+
* stopSession() settles them — callers see the same failure shape a
|
|
129
|
+
* manual stop would produce; that includes a timed-out dial
|
|
130
|
+
* attempt's own startSession() promise (its resolvers were left
|
|
131
|
+
* armed, and a late signaling reply could otherwise settle them
|
|
132
|
+
* against a closed pc).
|
|
140
133
|
*/
|
|
141
|
-
private
|
|
142
|
-
/** Counterpart to `_installNetworkListeners`. */
|
|
143
|
-
private _uninstallNetworkListeners;
|
|
134
|
+
private _teardownForRedial;
|
|
144
135
|
/**
|
|
145
136
|
* Atomic raw-units pose update over the data channel. Channels you
|
|
146
137
|
* omit are held at their last commanded value (per-axis, independent).
|
|
@@ -217,44 +208,122 @@ export declare class ReachyMini extends EventTarget implements ReachyMiniInstanc
|
|
|
217
208
|
*
|
|
218
209
|
* Returns `false` if the data channel isn't open.
|
|
219
210
|
*/
|
|
220
|
-
startDaemonUpdate({ preRelease, onProgress }?:
|
|
221
|
-
preRelease?: boolean;
|
|
222
|
-
onProgress?: UpdateProgressCallback;
|
|
223
|
-
}): boolean;
|
|
211
|
+
startDaemonUpdate({ preRelease, onProgress }?: StartDaemonUpdateOptions): boolean;
|
|
224
212
|
setMotorMode(mode: 'enabled' | 'disabled' | 'gravity_compensation'): boolean;
|
|
225
213
|
setMotorTorque(on: boolean, ids?: string[] | null): boolean;
|
|
226
214
|
wakeUp({ timeoutMs }?: MotionAwaitOptions): Promise<void>;
|
|
227
215
|
gotoSleep({ timeoutMs }?: MotionAwaitOptions): Promise<void>;
|
|
228
216
|
private _sendCommandAwaitCompletion;
|
|
229
|
-
private _rejectPendingMotionCompletions;
|
|
230
217
|
isAwake(): boolean;
|
|
231
218
|
ensureAwake(timeoutMs?: number): Promise<boolean>;
|
|
219
|
+
/**
|
|
220
|
+
* Query the daemon version. Resolves `null` when the daemon predates
|
|
221
|
+
* `get_version` (fail-open on the shared slot timeout) or the reply is
|
|
222
|
+
* superseded by session teardown.
|
|
223
|
+
*/
|
|
232
224
|
getVersion(): Promise<string | null>;
|
|
233
225
|
getHardwareId(): Promise<string | null>;
|
|
226
|
+
/**
|
|
227
|
+
* One-shot IMU reading (BMI088, wireless version only). Resolves `null`
|
|
228
|
+
* when the robot has no IMU (Lite, simulation) or the daemon predates
|
|
229
|
+
* the `get_imu` command (fail-open on the shared slot timeout).
|
|
230
|
+
*/
|
|
231
|
+
getImu(): Promise<ImuData | null>;
|
|
234
232
|
getVolume(): Promise<number | null>;
|
|
235
233
|
setVolume(volume: number): Promise<number | null>;
|
|
236
234
|
getMicrophoneVolume(): Promise<number | null>;
|
|
237
235
|
setMicrophoneVolume(volume: number): Promise<number | null>;
|
|
236
|
+
/**
|
|
237
|
+
* Query whether the first wake-up setup wizard has been completed.
|
|
238
|
+
* Robot-wide, persisted on the robot. Resolves `false` when pending,
|
|
239
|
+
* `true` when done, or `null` when the channel isn't open / the daemon
|
|
240
|
+
* predates the `get_first_wake_up` command (callers should fail-open
|
|
241
|
+
* and skip the wizard on `null`).
|
|
242
|
+
*/
|
|
243
|
+
getFirstWakeUp(): Promise<boolean | null>;
|
|
244
|
+
/**
|
|
245
|
+
* Persist the first wake-up wizard completion flag on the robot.
|
|
246
|
+
* Resolves with the stored value (or `null` on channel-closed).
|
|
247
|
+
*/
|
|
248
|
+
setFirstWakeUp(isCompleted: boolean): Promise<boolean | null>;
|
|
249
|
+
/**
|
|
250
|
+
* Query the persisted robot display name. Resolves the stored name,
|
|
251
|
+
* `null` when none is set / the channel isn't open / the daemon predates
|
|
252
|
+
* the `get_robot_name` command.
|
|
253
|
+
*/
|
|
254
|
+
getRobotName(): Promise<string | null>;
|
|
255
|
+
/**
|
|
256
|
+
* Set and persist the robot display name on the robot. Resolves with the
|
|
257
|
+
* stored (trimmed) name, or `null` on error / channel-closed. Applied live
|
|
258
|
+
* by the daemon (status + central relay + mDNS), so it takes effect right
|
|
259
|
+
* away without a restart; the persisted name also overrides --robot-name
|
|
260
|
+
* on the next start.
|
|
261
|
+
*/
|
|
262
|
+
setRobotName(name: string): Promise<string | null>;
|
|
263
|
+
/**
|
|
264
|
+
* Sign this robot out of Hugging Face: asks the daemon to delete its
|
|
265
|
+
* stored HF token, which de-registers the robot from the central
|
|
266
|
+
* signaling relay (it disappears from its owner's robot list until it
|
|
267
|
+
* is set up again). Works over the WebRTC data channel, so it reaches
|
|
268
|
+
* the robot remotely (no LAN HTTP path required).
|
|
269
|
+
*
|
|
270
|
+
* Resolves `true` when the daemon acked success, `false` on a daemon
|
|
271
|
+
* error, or `null` when no ack arrives before the timeout (e.g. a
|
|
272
|
+
* daemon that predates the `delete_hf_token` command silently drops
|
|
273
|
+
* it). Rejects if the data channel isn't open. Note the sign-out
|
|
274
|
+
* drops the central relay, so the session may tear down right after
|
|
275
|
+
* the ack - callers should treat a post-call session drop as expected,
|
|
276
|
+
* and a successful sign-out may surface as `null` if teardown races
|
|
277
|
+
* ahead of the ack.
|
|
278
|
+
*/
|
|
279
|
+
signOut(): Promise<boolean | null>;
|
|
238
280
|
applyAudioConfig(config: AudioConfigEntry[], { verify }?: ApplyAudioConfigOptions): Promise<boolean>;
|
|
239
281
|
readAudioParameter(name: string): Promise<number[] | null>;
|
|
240
282
|
/**
|
|
241
283
|
* Internal: send a command and await the matching daemon response in a
|
|
242
|
-
* named single-resolver slot
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
* sufficient. If a previous request on the same slot is still
|
|
246
|
-
* pending when a new one comes in, the older promise is resolved to
|
|
247
|
-
* `null` so its caller doesn't hang forever.
|
|
248
|
-
*
|
|
249
|
-
* Slot access is passed in as getter/setter closures rather than a
|
|
250
|
-
* key into `this`: that keeps the helper fully generic-checked (T is
|
|
251
|
-
* inferred from the slot's resolver type at each call site) with no
|
|
252
|
-
* indexed-property casts.
|
|
284
|
+
* named single-resolver slot (see `PendingReplies.slotRoundtrip`).
|
|
285
|
+
* Every caller has a strict request/response shape where a single
|
|
286
|
+
* in-flight call per slot is sufficient.
|
|
253
287
|
*/
|
|
254
288
|
private _slotRoundtrip;
|
|
255
289
|
sendRaw(data: unknown): boolean;
|
|
290
|
+
/**
|
|
291
|
+
* Generic command round-trip for daemon commands the SDK has no typed
|
|
292
|
+
* wrapper for (yet). Escape hatch so an app can use a newer daemon
|
|
293
|
+
* feature without waiting for an SDK release: sends `command` and
|
|
294
|
+
* resolves with the first robot message whose `command` field equals
|
|
295
|
+
* the sent `type` - the daemon's reply convention - or with `null` on
|
|
296
|
+
* the fail-open timeout (daemon predates the command, or the command
|
|
297
|
+
* is fire-and-forget and never replies).
|
|
298
|
+
*
|
|
299
|
+
* Rejects when the data channel isn't open or the session tears down
|
|
300
|
+
* mid-flight, mirroring the typed wrappers.
|
|
301
|
+
*
|
|
302
|
+
* Replies the SDK already consumes internally (`get_imu`,
|
|
303
|
+
* `get_volume`, ...) are swallowed by their own handlers and never
|
|
304
|
+
* reach this matcher - use the typed wrappers for those. Pass `match`
|
|
305
|
+
* for replies that don't follow the `command` echo convention.
|
|
306
|
+
*/
|
|
307
|
+
request(command: {
|
|
308
|
+
type: string;
|
|
309
|
+
} & Record<string, unknown>, { timeoutMs, match }?: RequestOptions): Promise<Record<string, unknown> | null>;
|
|
256
310
|
subscribeLogs({ onLine, onError }: SubscribeLogsOptions): () => void;
|
|
257
311
|
requestState(): boolean;
|
|
312
|
+
/**
|
|
313
|
+
* Ask the daemon to *push* the robot state (~30 Hz) over the dedicated
|
|
314
|
+
* unreliable/unordered `pose` data channel instead of polling get_state.
|
|
315
|
+
* Fires `state` events as frames arrive. No-op against an older daemon (no
|
|
316
|
+
* pose channel) - fall back to `requestState()` polling there.
|
|
317
|
+
*
|
|
318
|
+
* Refcounted: pair every `subscribePose()` with exactly one
|
|
319
|
+
* `unsubscribePose()`. Multiple consumers share a single daemon-side
|
|
320
|
+
* subscription; the daemon only stops pushing once the last one releases.
|
|
321
|
+
* If the channel isn't open yet (or the session later reconnects), the
|
|
322
|
+
* subscription is (re-)asserted from `_checkSessionReady`.
|
|
323
|
+
*/
|
|
324
|
+
subscribePose(): boolean;
|
|
325
|
+
/** Release one pose-stream consumer; sends `unsubscribe_pose` on the last. */
|
|
326
|
+
unsubscribePose(): boolean;
|
|
258
327
|
setAudioMuted(muted: boolean): void;
|
|
259
328
|
setMicMuted(muted: boolean): void;
|
|
260
329
|
attachVideo(videoElement: HTMLVideoElement): () => void;
|
|
@@ -270,13 +339,33 @@ export declare class ReachyMini extends EventTarget implements ReachyMiniInstanc
|
|
|
270
339
|
private _awaitDataChannelDrain;
|
|
271
340
|
private _sendToServer;
|
|
272
341
|
private _sendCommand;
|
|
342
|
+
/**
|
|
343
|
+
* Call a JSON-RPC method on the robot/app over the DataChannel and await
|
|
344
|
+
* its result. This is the one way to drive an on-robot app (start/stop it
|
|
345
|
+
* via `apps.*`, or drive a running app via its own namespace, e.g.
|
|
346
|
+
* `conversation.say`). Rejects on the JSON-RPC error, a closed channel, or
|
|
347
|
+
* timeout.
|
|
348
|
+
*/
|
|
349
|
+
rpcCall<T = unknown>(method: string, params?: Record<string, unknown>, opts?: {
|
|
350
|
+
timeoutMs?: number;
|
|
351
|
+
}): Promise<T>;
|
|
352
|
+
/**
|
|
353
|
+
* Subscribe to a JSON-RPC notification (one-way event) pushed by the
|
|
354
|
+
* robot/app, e.g. `conversation.turn`. Returns an unsubscribe function.
|
|
355
|
+
*/
|
|
356
|
+
onNotification(method: string, cb: (params: Record<string, unknown>) => void): () => void;
|
|
357
|
+
private _handleRpcMessage;
|
|
273
358
|
private _checkSessionReady;
|
|
274
359
|
private _handleSignalingMessage;
|
|
275
360
|
private _handleEndSession;
|
|
276
361
|
private _handlePeerMessage;
|
|
362
|
+
/**
|
|
363
|
+
* @param fromPoseStream Frame came from the pushed `pose` channel rather
|
|
364
|
+
* than the reliable control channel. Only those may refresh the state
|
|
365
|
+
* mirror while the stream is live (see the `data.state` branch).
|
|
366
|
+
*/
|
|
277
367
|
private _handleRobotMessage;
|
|
278
368
|
/** Snap video playback to live edge if buffered lag exceeds 0.5 s. */
|
|
279
369
|
private _startLatencyMonitor;
|
|
280
370
|
}
|
|
281
|
-
export {};
|
|
282
371
|
//# sourceMappingURL=reachy-mini.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reachy-mini.d.ts","sourceRoot":"","sources":["../../lib/reachy-mini.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"reachy-mini.d.ts","sourceRoot":"","sources":["../../lib/reachy-mini.ts"],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