@pollen-robotics/reachy-mini-sdk 1.7.3-main.5cd69ad
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/CHANGELOG.md +188 -0
- package/LICENSE +201 -0
- package/README.md +129 -0
- package/host/APP_AUTHOR_GUIDE.md +646 -0
- package/host/README.md +155 -0
- package/host/SPEC.md +618 -0
- package/host/dist/ReachyHost.d.ts +39 -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 +401 -0
- package/host/dist/chunks/index-CyLPysJS.js.map +1 -0
- package/host/dist/chunks/mountHost-8f-laxwI.js +48280 -0
- package/host/dist/chunks/mountHost-8f-laxwI.js.map +1 -0
- package/host/dist/chunks/reachy-mini-sdk-eBYlC77N.js +1719 -0
- package/host/dist/chunks/reachy-mini-sdk-eBYlC77N.js.map +1 -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/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 +151 -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 +7 -0
- package/host/dist/entry/auto.js.map +1 -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 +7 -0
- package/host/dist/entry/embed.js.map +1 -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 +15 -0
- package/host/dist/index.js.map +1 -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 +48 -0
- package/host/dist/lib/protocol.js.map +1 -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 +69 -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 +109 -0
- package/reachy-mini-sdk.d.ts +294 -0
- package/reachy-mini-sdk.js +2618 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface EmbedFrameProps {
|
|
2
|
+
/** Same-origin URL of the embedded app's `index.html`.
|
|
3
|
+
* Defaults to `${origin}/?embedded=1`. */
|
|
4
|
+
src: string;
|
|
5
|
+
/** Allow microphone capture inside the iframe (apps that need
|
|
6
|
+
* WebRTC mic input). Maps to the `allow="microphone; ..."`
|
|
7
|
+
* attribute. */
|
|
8
|
+
enableMicrophone: boolean;
|
|
9
|
+
/** Title attribute for a11y. */
|
|
10
|
+
title: string;
|
|
11
|
+
/** Set `visibility` so the iframe can stay mounted (and keep
|
|
12
|
+
* the SDK socket) while the ConnectingView overlay is on top. */
|
|
13
|
+
visible: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const EmbedFrame: import("react").ForwardRefExoticComponent<EmbedFrameProps & import("react").RefAttributes<HTMLIFrameElement>>;
|
|
16
|
+
//# sourceMappingURL=EmbedFrame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmbedFrame.d.ts","sourceRoot":"","sources":["../../src/components/EmbedFrame.tsx"],"names":[],"mappings":"AAgBA,MAAM,WAAW,eAAe;IAC9B;+CAC2C;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ;;qBAEiB;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd;sEACkE;IAClE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,UAAU,+GAoCtB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal error screen. Reached when:
|
|
3
|
+
* - The SDK throws on `connect()` / `startSession()`.
|
|
4
|
+
* - The embed reports `embed:error { fatal: true }`.
|
|
5
|
+
* - The host catches an uncaught render error (via the React
|
|
6
|
+
* error boundary in `ReachyHost`).
|
|
7
|
+
*
|
|
8
|
+
* Always offers a "Reload" action (full page reload) and a
|
|
9
|
+
* "Back to picker" action that resets the host phase to picking
|
|
10
|
+
* without losing the OAuth session.
|
|
11
|
+
*/
|
|
12
|
+
import type { JSX } from 'react';
|
|
13
|
+
export interface ErrorViewProps {
|
|
14
|
+
title?: string;
|
|
15
|
+
message: string;
|
|
16
|
+
detail?: unknown;
|
|
17
|
+
onReload(): void;
|
|
18
|
+
onBackToPicker(): void;
|
|
19
|
+
}
|
|
20
|
+
export declare function ErrorView({ title, message, detail, onReload, onBackToPicker, }: ErrorViewProps): JSX.Element;
|
|
21
|
+
//# sourceMappingURL=ErrorView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorView.d.ts","sourceRoot":"","sources":["../../src/components/ErrorView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAMjC,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,IAAI,IAAI,CAAC;IACjB,cAAc,IAAI,IAAI,CAAC;CACxB;AAED,wBAAgB,SAAS,CAAC,EACxB,KAA8B,EAC9B,OAAO,EACP,MAAM,EACN,QAAQ,EACR,cAAc,GACf,EAAE,cAAc,GAAG,GAAG,CAAC,OAAO,CA6D9B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transition view rendered while the host is tearing the iframe
|
|
3
|
+
* session down (user clicked "End session" / power-off).
|
|
4
|
+
*
|
|
5
|
+
* 1-to-1 port of
|
|
6
|
+
* `reachy_mini_mobile_app/src/ui/screens/session/LeavingView.tsx`
|
|
7
|
+
* — the desktop host and the mobile shell deliberately share the
|
|
8
|
+
* exact same disconnection visual so a user moving between the
|
|
9
|
+
* two clients sees a consistent "Putting Reachy to sleep…" beat.
|
|
10
|
+
*
|
|
11
|
+
* Visual posture
|
|
12
|
+
* ──────────────
|
|
13
|
+
* Mirrors `<ConnectingView>`'s anatomy (stack centred on the
|
|
14
|
+
* vertical axis, primary visual on top, title below) so the
|
|
15
|
+
* leave-screen reads as the symmetric counterpart of the join-
|
|
16
|
+
* screen. But where Connecting carries a 3-dot stepper + bold
|
|
17
|
+
* headline + a two-line caption to narrate a multi-phase
|
|
18
|
+
* bring-up, Leaving is intentionally one beat lighter:
|
|
19
|
+
*
|
|
20
|
+
* - a small, low-contrast spinner instead of the stepper
|
|
21
|
+
* (the user already decided to leave - we don't need to
|
|
22
|
+
* dramatise the wait),
|
|
23
|
+
* - a single short headline, no caption (the goto-sleep
|
|
24
|
+
* trajectory is short enough that a sub-line of explanation
|
|
25
|
+
* reads as filler by the time it lands).
|
|
26
|
+
*
|
|
27
|
+
* The trailing ellipsis on the headline is enough of a
|
|
28
|
+
* "something's still happening" cue without needing a second line
|
|
29
|
+
* of copy.
|
|
30
|
+
*/
|
|
31
|
+
import type { JSX } from 'react';
|
|
32
|
+
export declare function LeavingView(): JSX.Element;
|
|
33
|
+
//# sourceMappingURL=LeavingView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LeavingView.d.ts","sourceRoot":"","sources":["../../src/components/LeavingView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAKjC,wBAAgB,WAAW,IAAI,GAAG,CAAC,OAAO,CA2CzC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Robot picker, aligned with `reachy_mini_mobile_app/src/ui/
|
|
3
|
+
* screens/ScanScreen.tsx`.
|
|
4
|
+
*
|
|
5
|
+
* Layout (the shared TopBar - identity + sign-out - sits ABOVE
|
|
6
|
+
* this view and is owned by `ReachyHostShell`):
|
|
7
|
+
* ┌──────────────────────────────────────────┐
|
|
8
|
+
* │ (reachy-buste) │
|
|
9
|
+
* │ │
|
|
10
|
+
* │ Your Reachies │
|
|
11
|
+
* │ N online · linked to your HF account │
|
|
12
|
+
* │ │
|
|
13
|
+
* │ ┌────────────────────────────────┐ │
|
|
14
|
+
* │ │ [reachy] ● Name > │ │
|
|
15
|
+
* │ └────────────────────────────────┘ │
|
|
16
|
+
* │ ┌────────────────────────────────┐ │
|
|
17
|
+
* │ │ [reachy] ● Other 🔒 │ │ (busy)
|
|
18
|
+
* │ └────────────────────────────────┘ │
|
|
19
|
+
* │ │
|
|
20
|
+
* │ ────────────────────────────────────────│
|
|
21
|
+
* │ ↻ Refresh │ Sticky bottom
|
|
22
|
+
* └──────────────────────────────────────────┘
|
|
23
|
+
*
|
|
24
|
+
* - Hero illustration: `reachy-buste.svg`, same asset as the
|
|
25
|
+
* splash, gives the screen a brand identity beyond the cards.
|
|
26
|
+
* - Robot cards: avatar + name + hardware-id tag + trailing
|
|
27
|
+
* chevron (or lock when busy).
|
|
28
|
+
* - Sticky refresh: pinned to the bottom, out of the scrollable
|
|
29
|
+
* area, so it's always one tap away.
|
|
30
|
+
*/
|
|
31
|
+
import type { JSX } from 'react';
|
|
32
|
+
import type { RobotInfo } from '../lib/sdk-types';
|
|
33
|
+
export interface PickerViewProps {
|
|
34
|
+
robots: RobotInfo[];
|
|
35
|
+
/** `true` while the picker is fetching its first robot list or
|
|
36
|
+
* the user just clicked "Refresh" - drives the header spinner. */
|
|
37
|
+
isRefreshing: boolean;
|
|
38
|
+
/** Last error message from the central listener / REST fetch,
|
|
39
|
+
* or `null` if everything's healthy. Surfaces as an error state
|
|
40
|
+
* card when the list is empty so the user knows the screen is
|
|
41
|
+
* silent for a reason. */
|
|
42
|
+
error?: string | null;
|
|
43
|
+
preselectedRobotId: string | null;
|
|
44
|
+
onSelect(robotId: string): void;
|
|
45
|
+
/** Asks the picker source to re-fetch the robot list. Defaults
|
|
46
|
+
* to a no-op if the host has nothing to refresh; the spinner
|
|
47
|
+
* still plays for ~1 s as visual feedback. */
|
|
48
|
+
onRefresh?(): void;
|
|
49
|
+
}
|
|
50
|
+
export declare function PickerView({ robots, isRefreshing, error, preselectedRobotId, onSelect, onRefresh, }: PickerViewProps): JSX.Element;
|
|
51
|
+
//# sourceMappingURL=PickerView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PickerView.d.ts","sourceRoot":"","sources":["../../src/components/PickerView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAqBjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB;uEACmE;IACnE,YAAY,EAAE,OAAO,CAAC;IACtB;;;+BAG2B;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;mDAE+C;IAC/C,SAAS,CAAC,IAAI,IAAI,CAAC;CACpB;AAED,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,YAAY,EACZ,KAAK,EACL,kBAAkB,EAClB,QAAQ,EACR,SAAS,GACV,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAiF/B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { ReachyMiniInstance } from '../lib/sdk-types';
|
|
3
|
+
import { type ConfigPayload, type ThemeMode } from '../lib/protocol';
|
|
4
|
+
export interface ReachyHostShellProps {
|
|
5
|
+
sdk: ReachyMiniInstance | null;
|
|
6
|
+
appName: string;
|
|
7
|
+
appIconUrl?: string;
|
|
8
|
+
appEmoji?: string;
|
|
9
|
+
hostName: string;
|
|
10
|
+
theme: ThemeMode;
|
|
11
|
+
initialConfig?: ConfigPayload;
|
|
12
|
+
enableMicrophone: boolean;
|
|
13
|
+
/** Path of the embedded app entry within the same origin.
|
|
14
|
+
* Defaults to `/?embedded=1`. */
|
|
15
|
+
embedPath?: string;
|
|
16
|
+
/** Surface a dev hint on the sign-in screen when no OAuth
|
|
17
|
+
* client ID is reachable and no dev token has been seeded. */
|
|
18
|
+
isLocalDevMissingConfig?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function ReachyHostShell(props: ReachyHostShellProps): JSX.Element;
|
|
21
|
+
//# sourceMappingURL=ReachyHostShell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReachyHostShell.d.ts","sourceRoot":"","sources":["../../src/components/ReachyHostShell.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAKjC,OAAO,KAAK,EAAE,kBAAkB,EAAa,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAEL,KAAK,aAAa,EAGlB,KAAK,SAAS,EACf,MAAM,iBAAiB,CAAC;AAmBzB,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAE/B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IAEjB,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B,gBAAgB,EAAE,OAAO,CAAC;IAC1B;sCACkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;mEAC+D;IAC/D,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AA6DD,wBAAgB,eAAe,CAC7B,KAAK,EAAE,oBAAoB,GAC1B,GAAG,CAAC,OAAO,CAMb"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sign-in landing screen.
|
|
3
|
+
*
|
|
4
|
+
* Visual + copy mirror of `reachy_mini_mobile_app/src/ui/screens/
|
|
5
|
+
* RemoteSignInScreen.tsx` so a user moving between the mobile
|
|
6
|
+
* companion and a desktop browser tab lands on the same gateway.
|
|
7
|
+
*
|
|
8
|
+
* Composition:
|
|
9
|
+
* - h1 "Sign in to Hugging Face" (NOT the app name; the app
|
|
10
|
+
* name lives in the document title and the picker).
|
|
11
|
+
* - Subtitle explaining why signing in is the gate.
|
|
12
|
+
* - Single outlined CTA "Continue with Hugging Face" that
|
|
13
|
+
* morphs to "Waiting for Hugging Face…" + spinner during the
|
|
14
|
+
* OAuth redirect.
|
|
15
|
+
*
|
|
16
|
+
* Post-OAuth return is handled by the host-level
|
|
17
|
+
* `WelcomeBackOverlay`, NOT this screen, so we never need an
|
|
18
|
+
* inline "Restoring your session…" sub-state here.
|
|
19
|
+
*/
|
|
20
|
+
import type { JSX } from 'react';
|
|
21
|
+
export interface SignInViewProps {
|
|
22
|
+
/** App name (used only in subtitle copy; not the heading). */
|
|
23
|
+
appName: string;
|
|
24
|
+
/** When `true`, the page has no obvious way to obtain an OAuth
|
|
25
|
+
* client ID (no `?clientId=` prop, no `window.huggingface`
|
|
26
|
+
* injection, no cached settings). Surfaces a dev-hint alert
|
|
27
|
+
* pointing at the local `.env.local` workflow. */
|
|
28
|
+
isLocalDevMissingConfig: boolean;
|
|
29
|
+
onSignIn(): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
export declare function SignInView({ appName, isLocalDevMissingConfig, onSignIn, }: SignInViewProps): JSX.Element;
|
|
32
|
+
//# sourceMappingURL=SignInView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignInView.d.ts","sourceRoot":"","sources":["../../src/components/SignInView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,GAAG,EAAa,MAAM,OAAO,CAAC;AAgB5C,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB;;;uDAGmD;IACnD,uBAAuB,EAAE,OAAO,CAAC;IACjC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,uBAAuB,EACvB,QAAQ,GACT,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAqK/B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic horizontal steps indicator with an integrated progress
|
|
3
|
+
* bar running BEHIND the steps.
|
|
4
|
+
*
|
|
5
|
+
* ●━━━━━━━━━●━━━━━━━━━○
|
|
6
|
+
* Link Session Wake-up
|
|
7
|
+
*
|
|
8
|
+
* - Completed steps render a checkmark (`pop-in` animation) on the
|
|
9
|
+
* filled (green) bar.
|
|
10
|
+
* - The current step pulses gently and shows a tiny dot inside.
|
|
11
|
+
* - Future steps stay neutral on the unfilled track.
|
|
12
|
+
*
|
|
13
|
+
* 1-to-1 port of `reachy_mini_mobile_app/src/ui/design/
|
|
14
|
+
* StepsProgressIndicator.tsx`. Kept structurally identical so a
|
|
15
|
+
* change in the mobile app's connection animation can be ported
|
|
16
|
+
* back here verbatim - the two clients are explicitly meant to
|
|
17
|
+
* "feel built by the same hand".
|
|
18
|
+
*/
|
|
19
|
+
import type { JSX } from 'react';
|
|
20
|
+
export interface StepsProgressStep {
|
|
21
|
+
/** Stable id used as React key. */
|
|
22
|
+
id: string;
|
|
23
|
+
/** Short uppercase label rendered under the dot (≤ ~10 chars). */
|
|
24
|
+
label: string;
|
|
25
|
+
}
|
|
26
|
+
export interface StepsProgressIndicatorProps {
|
|
27
|
+
steps: StepsProgressStep[];
|
|
28
|
+
/** 0-indexed current step. Steps before this index are rendered
|
|
29
|
+
* as completed. Steps after are pending. */
|
|
30
|
+
currentStep: number;
|
|
31
|
+
/** Optional explicit progress percentage (0-100). When omitted
|
|
32
|
+
* the bar is computed from `currentStep / (steps.length - 1)`. */
|
|
33
|
+
progress?: number;
|
|
34
|
+
/** When `true` the active step uses the primary tint instead of
|
|
35
|
+
* the neutral active grey. Useful to signal "we're actively
|
|
36
|
+
* recovering" (e.g. a retry attempt) vs the standard happy
|
|
37
|
+
* path. */
|
|
38
|
+
accent?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export declare function StepsProgressIndicator({ steps, currentStep, progress: progressOverride, accent, }: StepsProgressIndicatorProps): JSX.Element;
|
|
41
|
+
//# sourceMappingURL=StepsProgressIndicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepsProgressIndicator.d.ts","sourceRoot":"","sources":["../../src/components/StepsProgressIndicator.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAMjC,MAAM,WAAW,iBAAiB;IAChC,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B;iDAC6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB;uEACmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;gBAGY;IACZ,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAuBD,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,WAAW,EACX,QAAQ,EAAE,gBAAgB,EAC1B,MAAc,GACf,EAAE,2BAA2B,GAAG,GAAG,CAAC,OAAO,CAoL3C"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent host top bar.
|
|
3
|
+
*
|
|
4
|
+
* Provides the same chrome as the pre-migration standalone host:
|
|
5
|
+
*
|
|
6
|
+
* Layout (signed in, no session):
|
|
7
|
+
*
|
|
8
|
+
* [ logo ] Telepresence [ avatar @user ▾ ]
|
|
9
|
+
*
|
|
10
|
+
* Layout (signed in, streaming):
|
|
11
|
+
*
|
|
12
|
+
* [ logo ] Telepresence [ ⏻ End session ] [ avatar @user ▾ ]
|
|
13
|
+
*
|
|
14
|
+
* UX rationale
|
|
15
|
+
* ────────────
|
|
16
|
+
* The destructive actions are visually distinct:
|
|
17
|
+
* - "End session" is a labeled red button that ONLY renders while a
|
|
18
|
+
* session is live. When there's no session it disappears, so the
|
|
19
|
+
* bar isn't cluttered with a permanent disabled glyph.
|
|
20
|
+
* - "Sign out" lives inside an account menu opened by clicking the
|
|
21
|
+
* avatar+username chip. Standard "click your face to see account
|
|
22
|
+
* actions" pattern, prevents accidental sign-out clicks.
|
|
23
|
+
*
|
|
24
|
+
* Signed-out
|
|
25
|
+
* ──────────
|
|
26
|
+
* The bar STAYS visible on the sign-in screen, with the embedded app's
|
|
27
|
+
* logo + name on the left and an empty right slot - no avatar, no
|
|
28
|
+
* End-session button, since neither makes sense before the user has
|
|
29
|
+
* authenticated. Anchors "where am I" for users landing on the host
|
|
30
|
+
* through `huggingface.co/spaces/<app>`.
|
|
31
|
+
*/
|
|
32
|
+
import { type JSX } from 'react';
|
|
33
|
+
export type HostPhase = 'signing-in' | 'picking' | 'embedded' | 'leaving' | 'error';
|
|
34
|
+
export interface TopBarProps {
|
|
35
|
+
appName: string;
|
|
36
|
+
/** Resolved app icon URL probed from `${embedUrl}/icon.svg`. Best
|
|
37
|
+
* signal: the app shipped a real icon. */
|
|
38
|
+
appIconUrl?: string | null;
|
|
39
|
+
/** Fallback emoji from the HF Spaces frontmatter (`cardData.emoji`).
|
|
40
|
+
* Used when no `appIconUrl` is available. */
|
|
41
|
+
appEmoji?: string | null;
|
|
42
|
+
hostPhase: HostPhase;
|
|
43
|
+
userName: string | null;
|
|
44
|
+
/** Resolved HF avatar URL from `/api/whoami-v2`, or `null` while in
|
|
45
|
+
* flight / failed. The chip falls back to a first-letter glyph. */
|
|
46
|
+
avatarUrl?: string | null;
|
|
47
|
+
selectedRobotName?: string | null;
|
|
48
|
+
onSignOut(): void;
|
|
49
|
+
onEndSession(): void;
|
|
50
|
+
}
|
|
51
|
+
export declare function TopBar({ appName, appIconUrl, appEmoji, hostPhase, userName, avatarUrl, selectedRobotName: _selectedRobotName, onSignOut, onEndSession, }: TopBarProps): JSX.Element;
|
|
52
|
+
//# sourceMappingURL=TopBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TopBar.d.ts","sourceRoot":"","sources":["../../src/components/TopBar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAuB,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAqBtD,MAAM,MAAM,SAAS,GACjB,YAAY,GACZ,SAAS,GACT,UAAU,GACV,SAAS,GACT,OAAO,CAAC;AAEZ,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB;+CAC2C;IAC3C,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B;kDAC8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;wEACoE;IACpE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,SAAS,IAAI,IAAI,CAAC;IAClB,YAAY,IAAI,IAAI,CAAC;CACtB;AAED,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,UAAiB,EACjB,QAAe,EACf,SAAS,EACT,QAAQ,EACR,SAAgB,EAChB,iBAAiB,EAAE,kBAAkB,EACrC,SAAS,EACT,YAAY,GACb,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAmH3B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brief celebratory transition shown after a successful HF
|
|
3
|
+
* sign-in.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors `reachy_mini_mobile_app/src/ui/screens/
|
|
6
|
+
* WelcomeBackScreen.tsx` so the desktop host and the mobile shell
|
|
7
|
+
* use the same beat between OAuth return and the picker reveal.
|
|
8
|
+
*
|
|
9
|
+
* Bridges two states the user otherwise experiences as a hard cut:
|
|
10
|
+
* - the browser OAuth flow returns focus to the tab,
|
|
11
|
+
* - the host suddenly switches from SignInView to PickerView.
|
|
12
|
+
*
|
|
13
|
+
* Without this, the user lands on a list of robots with no
|
|
14
|
+
* acknowledgment of who they are. This overlay surfaces their
|
|
15
|
+
* username for ~3.4 s with a subtle entrance animation, then
|
|
16
|
+
* fades out on top of the (already-mounted) picker.
|
|
17
|
+
*
|
|
18
|
+
* Pure presentational, no network calls. The picker behind us
|
|
19
|
+
* is already warming its data via `useRobots`, so the user
|
|
20
|
+
* lands on a populated list when the overlay clears.
|
|
21
|
+
*/
|
|
22
|
+
import type { JSX } from 'react';
|
|
23
|
+
export interface WelcomeBackOverlayProps {
|
|
24
|
+
userName: string | null;
|
|
25
|
+
onDone(): void;
|
|
26
|
+
}
|
|
27
|
+
export declare function WelcomeBackOverlay({ userName, onDone, }: WelcomeBackOverlayProps): JSX.Element;
|
|
28
|
+
//# sourceMappingURL=WelcomeBackOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WelcomeBackOverlay.d.ts","sourceRoot":"","sources":["../../src/components/WelcomeBackOverlay.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AA8BjC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,MAAM,GACP,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CA6EvC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Embedded-app client.
|
|
3
|
+
*
|
|
4
|
+
* Vanilla TypeScript helper that lives in the iframe side of the
|
|
5
|
+
* host / app split. Consumed by `src/embed.{ts,tsx}` in each app
|
|
6
|
+
* (or via the CDN entry
|
|
7
|
+
* `@pollen-robotics/reachy-mini-sdk/host/embed` script tag).
|
|
8
|
+
*
|
|
9
|
+
* import { connectToHost } from '@pollen-robotics/reachy-mini-sdk/host/embed';
|
|
10
|
+
*
|
|
11
|
+
* const handle = await connectToHost<MyAppConfig>();
|
|
12
|
+
* handle.onLeave(() => { /* clean up before unmount *\/ });
|
|
13
|
+
* handle.reachy.setHeadRpyDeg(0, 10, 0);
|
|
14
|
+
*
|
|
15
|
+
* Boot sequence (canonical reference: SPEC.md §6.4):
|
|
16
|
+
* 1. Read `#creds=<base64>` synchronously and wipe the hash
|
|
17
|
+
* with `history.replaceState`.
|
|
18
|
+
* 2. Wait for `window.ReachyMini` (8 s timeout).
|
|
19
|
+
* 3. Instantiate the SDK, seed the HF token into
|
|
20
|
+
* `sessionStorage`.
|
|
21
|
+
* 4. Send `embed:ready` to the parent.
|
|
22
|
+
* 5. Wait for `host:init` (2 s soft timeout; on hit we proceed
|
|
23
|
+
* from the hash creds alone via `liveStateFromCreds`, which
|
|
24
|
+
* carries the same fields as `liveStateFromInit`).
|
|
25
|
+
* 6. `connect()` → `startSession()` → `ensureAwake()`, emitting
|
|
26
|
+
* `embed:app-state` at each step.
|
|
27
|
+
* 7. Resolve `connectToHost()` with the live SDK handle.
|
|
28
|
+
*
|
|
29
|
+
* Strict Mode safety (SPEC §8.4): the function is idempotent
|
|
30
|
+
* across multiple awaits via a module-level promise. Calling
|
|
31
|
+
* `connectToHost()` twice returns the same in-flight promise;
|
|
32
|
+
* a single SDK instance is created, a single `embed:ready` is
|
|
33
|
+
* posted.
|
|
34
|
+
*/
|
|
35
|
+
import type { ReachyMiniInstance, ReachyMiniOptions } from '../lib/sdk-types';
|
|
36
|
+
import type { AppConnectingStep, AppPhase, ThemeMode } from '../lib/protocol';
|
|
37
|
+
/**
|
|
38
|
+
* Stable surface for the robot's WebRTC media. All accessors are
|
|
39
|
+
* synchronous and safe to read at any point after the handle is
|
|
40
|
+
* returned by `connectToHost()`. References are cached: calling
|
|
41
|
+
* `media.robotStream` repeatedly returns the same `MediaStream`
|
|
42
|
+
* instance (good for React effect deps), and the stream auto-clears
|
|
43
|
+
* on `sessionStopped`.
|
|
44
|
+
*/
|
|
45
|
+
export interface RobotMedia {
|
|
46
|
+
/**
|
|
47
|
+
* Bind the robot's video element. Internally:
|
|
48
|
+
* 1. Calls the SDK's own `attachVideo()` (which keeps the
|
|
49
|
+
* element's `muted` flag in sync with `audioMuted`, kicks
|
|
50
|
+
* off the latency monitor, and resets `srcObject` on
|
|
51
|
+
* `sessionStopped`).
|
|
52
|
+
* 2. Replays the cached `robotStream` so a late-mounting
|
|
53
|
+
* `<video>` element catches up immediately.
|
|
54
|
+
*
|
|
55
|
+
* Returns a cleanup function that detaches the SDK listeners.
|
|
56
|
+
*/
|
|
57
|
+
attachVideo(el: HTMLVideoElement): () => void;
|
|
58
|
+
/**
|
|
59
|
+
* Robot's outbound MediaStream (video + audio in a single
|
|
60
|
+
* stream, as the daemon emits it). `null` until the WebRTC
|
|
61
|
+
* tracks have arrived; cleared on `sessionStopped`.
|
|
62
|
+
*
|
|
63
|
+
* Hand it to `<video>.srcObject`, an `AudioContext`'s
|
|
64
|
+
* `createMediaStreamSource`, or any other consumer.
|
|
65
|
+
*/
|
|
66
|
+
readonly robotStream: MediaStream | null;
|
|
67
|
+
/**
|
|
68
|
+
* Local microphone MediaStream. Mirrors `reachy._micStream` so
|
|
69
|
+
* apps don't reach into underscore-prefixed SDK internals.
|
|
70
|
+
* `null` when `enableMicrophone` was `false` at construction
|
|
71
|
+
* time, when the daemon refused bidirectional audio, or when
|
|
72
|
+
* the session has stopped.
|
|
73
|
+
*/
|
|
74
|
+
readonly micStream: MediaStream | null;
|
|
75
|
+
}
|
|
76
|
+
/** Resolved state at the moment `connectToHost()` returns. */
|
|
77
|
+
export interface ConnectedHandle<TConfig = unknown> {
|
|
78
|
+
/** Live SDK instance: connected, session started, robot awake. */
|
|
79
|
+
reachy: ReachyMiniInstance;
|
|
80
|
+
/** Current theme; updated via `onThemeChange`. */
|
|
81
|
+
theme: ThemeMode;
|
|
82
|
+
/** Initial config (from URL `?config=` or mobile handoff).
|
|
83
|
+
* Updates pushed via `onConfigChange`. */
|
|
84
|
+
config: TConfig | null;
|
|
85
|
+
/** App display name as passed by the host. */
|
|
86
|
+
appName: string;
|
|
87
|
+
/** Host display name (e.g. "Reachy Mini"). */
|
|
88
|
+
hostName: string;
|
|
89
|
+
/** HF user name when known (from `host:init`). */
|
|
90
|
+
userName: string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Stable accessors for the WebRTC media streams negotiated
|
|
93
|
+
* during `startSession()`.
|
|
94
|
+
*
|
|
95
|
+
* Why apps must use these (not `reachy.attachVideo` /
|
|
96
|
+
* `reachy._pc` / `reachy._micStream`):
|
|
97
|
+
* `connectToHost()` fully completes the WebRTC handshake
|
|
98
|
+
* before the embedded app's React tree mounts. The SDK's
|
|
99
|
+
* one-shot `videoTrack` event and the underlying `pc.ontrack`
|
|
100
|
+
* event have therefore ALREADY fired by the time a
|
|
101
|
+
* freshly-mounted component subscribes - any listener
|
|
102
|
+
* registered after `connectToHost()` resolves will sit silent
|
|
103
|
+
* until the next `startSession()`, which embeds never
|
|
104
|
+
* trigger. This API replays the streams from a synchronous
|
|
105
|
+
* snapshot of the peer-connection's receivers, so
|
|
106
|
+
* late-mounting consumers see the camera + audio immediately.
|
|
107
|
+
*
|
|
108
|
+
* For the data channel, mute toggles, motor commands and state
|
|
109
|
+
* updates there is no race: the bridge only resolves once ICE
|
|
110
|
+
* AND the data channel are connected, and state events stream
|
|
111
|
+
* continuously at 50 Hz from the daemon. Apps can keep using
|
|
112
|
+
* `reachy.setHeadRpyDeg(…)`, `reachy.setMicMuted(…)`,
|
|
113
|
+
* `reachy.addEventListener('state', …)` directly.
|
|
114
|
+
*/
|
|
115
|
+
readonly media: RobotMedia;
|
|
116
|
+
/** Register a teardown callback. Fires on `host:leaving`
|
|
117
|
+
* (one-shot) or `pagehide`. Return a promise to keep the host
|
|
118
|
+
* waiting (bounded by the host's `timeoutMs`). Returns an
|
|
119
|
+
* unsubscribe function. */
|
|
120
|
+
onLeave(cb: () => void | Promise<void>): () => void;
|
|
121
|
+
/** Register a theme-change handler. */
|
|
122
|
+
onThemeChange(cb: (theme: ThemeMode) => void): () => void;
|
|
123
|
+
/** Register a config-change handler. */
|
|
124
|
+
onConfigChange(cb: (config: TConfig | null) => void): () => void;
|
|
125
|
+
/** Push an app-level state update upstream so the host can
|
|
126
|
+
* drive its ConnectingView overlay. */
|
|
127
|
+
setAppState(state: {
|
|
128
|
+
phase: AppPhase;
|
|
129
|
+
connectingStep?: AppConnectingStep | null;
|
|
130
|
+
message?: string | null;
|
|
131
|
+
}): void;
|
|
132
|
+
/** Ask the host to start the leave sequence. */
|
|
133
|
+
requestLeave(): void;
|
|
134
|
+
/** Report an error. `fatal: true` switches the host to ErrorView. */
|
|
135
|
+
reportError(message: string, opts?: {
|
|
136
|
+
fatal?: boolean;
|
|
137
|
+
detail?: unknown;
|
|
138
|
+
}): void;
|
|
139
|
+
}
|
|
140
|
+
export interface ConnectToHostOptions {
|
|
141
|
+
/** Forwarded to the SDK constructor. `appName`, `signalingUrl`,
|
|
142
|
+
* `clientId` are auto-set from the creds bundle. */
|
|
143
|
+
sdkOptions?: Partial<ReachyMiniOptions>;
|
|
144
|
+
/** Origin of the host's window. Defaults to
|
|
145
|
+
* `window.location.origin` (same-origin iframe). */
|
|
146
|
+
expectedOrigin?: string;
|
|
147
|
+
}
|
|
148
|
+
/** Boot the embedded app. Idempotent: calling twice returns the
|
|
149
|
+
* same in-flight promise. */
|
|
150
|
+
export declare function connectToHost<TConfig = unknown>(options?: ConnectToHostOptions): Promise<ConnectedHandle<TConfig>>;
|
|
151
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/embed/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAO1B,OAAO,KAAK,EACV,iBAAiB,EACjB,QAAQ,EAMR,SAAS,EACV,MAAM,iBAAiB,CAAC;AAazB;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,EAAE,gBAAgB,GAAG,MAAM,IAAI,CAAC;IAC9C;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IACzC;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;CACxC;AAED,8DAA8D;AAC9D,MAAM,WAAW,eAAe,CAAC,OAAO,GAAG,OAAO;IAChD,kEAAkE;IAClE,MAAM,EAAE,kBAAkB,CAAC;IAC3B,kDAAkD;IAClD,KAAK,EAAE,SAAS,CAAC;IACjB;+CAC2C;IAC3C,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAE3B;;;gCAG4B;IAC5B,OAAO,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,IAAI,CAAC;IACpD,uCAAuC;IACvC,aAAa,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC1D,wCAAwC;IACxC,cAAc,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAEjE;4CACwC;IACxC,WAAW,CAAC,KAAK,EAAE;QACjB,KAAK,EAAE,QAAQ,CAAC;QAChB,cAAc,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;QAC1C,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB,GAAG,IAAI,CAAC;IACT,gDAAgD;IAChD,YAAY,IAAI,IAAI,CAAC;IACrB,qEAAqE;IACrE,WAAW,CACT,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAC3C,IAAI,CAAC;CACT;AAED,MAAM,WAAW,oBAAoB;IACnC;yDACqD;IACrD,UAAU,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACxC;yDACqD;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAsCD;8BAC8B;AAC9B,wBAAsB,aAAa,CAAC,OAAO,GAAG,OAAO,EACnD,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAKnC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { mountHost } from '../mountHost';
|
|
2
|
+
import type { MountHostOptions, MountedHost } from '../mountHost';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
ReachyMiniHost?: {
|
|
6
|
+
mountHost(options: MountHostOptions): MountedHost;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export { mountHost };
|
|
11
|
+
export type { MountHostOptions, MountedHost };
|
|
12
|
+
//# sourceMappingURL=auto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto.d.ts","sourceRoot":"","sources":["../../src/entry/auto.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAElE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,cAAc,CAAC,EAAE;YACf,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,WAAW,CAAC;SACnD,CAAC;KACH;CACF;AAUD,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { R as i } from "../chunks/reachy-mini-sdk-eBYlC77N.js";
|
|
2
|
+
import { m as n } from "../chunks/mountHost-8f-laxwI.js";
|
|
3
|
+
typeof window < "u" && (window.ReachyMini || (window.ReachyMini = i, window.dispatchEvent(new Event("reachymini:ready"))), window.ReachyMiniHost = { mountHost: n });
|
|
4
|
+
export {
|
|
5
|
+
n as mountHost
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=auto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto.js","sources":["../../src/entry/auto.ts"],"sourcesContent":["/**\n * CDN \"auto\" entry: the single script tag loaded from an app's\n * `index.html` to bring up the host shell.\n *\n * <script type=\"module\"\n * src=\"https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@1/host/dist/entry/auto.js\">\n * </script>\n * <script type=\"module\" src=\"/src/dispatch.ts\"></script>\n *\n * The auto bundle exposes `mountHost` on `window.ReachyMiniHost`\n * for legacy / non-module callers. ESM consumers import it the\n * normal way.\n *\n * SDK auto-install\n * ────────────────\n * The host depends on `window.ReachyMini` for its OAuth helpers\n * (`useSdk`) and the embed client. Now that the SDK lives in the\n * same npm package, we import it directly and assign it to\n * `window.ReachyMini` here as a side effect, then dispatch the\n * `reachymini:ready` event the host's wait loops listen for.\n * Existing apps that still set `window.ReachyMini` themselves\n * (e.g. via the old jsdelivr `<script type=\"module\">` tag) are\n * untouched: we only assign when the global is unset.\n */\nimport { ReachyMini } from '../../../reachy-mini-sdk';\nimport { mountHost } from '../mountHost';\nimport type { MountHostOptions, MountedHost } from '../mountHost';\n\ndeclare global {\n interface Window {\n ReachyMiniHost?: {\n mountHost(options: MountHostOptions): MountedHost;\n };\n }\n}\n\nif (typeof window !== 'undefined') {\n if (!window.ReachyMini) {\n window.ReachyMini = ReachyMini;\n window.dispatchEvent(new Event('reachymini:ready'));\n }\n window.ReachyMiniHost = { mountHost };\n}\n\nexport { mountHost };\nexport type { MountHostOptions, MountedHost };\n"],"names":["ReachyMini","mountHost"],"mappings":";;AAoCI,OAAO,SAAW,QACf,OAAO,eACV,OAAO,aAAaA,GACpB,OAAO,cAAc,IAAI,MAAM,kBAAkB,CAAC,IAEpD,OAAO,iBAAiB,EAAE,WAAAC,EAAA;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { connectToHost } from '../embed';
|
|
2
|
+
import type { ConnectedHandle, ConnectToHostOptions } from '../embed';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
ReachyMiniHostEmbed?: {
|
|
6
|
+
connectToHost<TConfig = unknown>(opts?: ConnectToHostOptions): Promise<ConnectedHandle<TConfig>>;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export { connectToHost };
|
|
11
|
+
export type { ConnectedHandle, ConnectToHostOptions };
|
|
12
|
+
//# sourceMappingURL=embed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../src/entry/embed.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAElB,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,mBAAmB,CAAC,EAAE;YACpB,aAAa,CAAC,OAAO,GAAG,OAAO,EAC7B,IAAI,CAAC,EAAE,oBAAoB,GAC1B,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;SACtC,CAAC;KACH;CACF;AAUD,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { R as i } from "../chunks/reachy-mini-sdk-eBYlC77N.js";
|
|
2
|
+
import { c as n } from "../chunks/index-CyLPysJS.js";
|
|
3
|
+
typeof window < "u" && (window.ReachyMini || (window.ReachyMini = i, window.dispatchEvent(new Event("reachymini:ready"))), window.ReachyMiniHostEmbed = { connectToHost: n });
|
|
4
|
+
export {
|
|
5
|
+
n as connectToHost
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=embed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed.js","sources":["../../src/entry/embed.ts"],"sourcesContent":["/**\n * CDN \"embed\" entry: vanilla TS, no React / MUI, ~5 KB gz\n * (plus the SDK runtime bundled in).\n *\n * Loaded inside the embedded app's iframe:\n *\n * <script type=\"module\"\n * src=\"https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@1/host/dist/entry/embed.js\">\n * </script>\n *\n * The bundle exposes `connectToHost` on\n * `window.ReachyMiniHostEmbed` for legacy callers. ESM consumers\n * import normally.\n *\n * SDK auto-install\n * ────────────────\n * The embed client instantiates `new window.ReachyMini(...)`. Now\n * that the SDK ships in the same npm package we import it here\n * and self-assign onto `window.ReachyMini` (when unset) so apps\n * no longer need the old jsdelivr `<script type=\"module\">` tag.\n * Existing apps that set `window.ReachyMini` themselves keep\n * working — we only assign when the global is missing.\n */\nimport { ReachyMini } from '../../../reachy-mini-sdk';\nimport { connectToHost } from '../embed';\nimport type {\n ConnectedHandle,\n ConnectToHostOptions,\n} from '../embed';\n\ndeclare global {\n interface Window {\n ReachyMiniHostEmbed?: {\n connectToHost<TConfig = unknown>(\n opts?: ConnectToHostOptions,\n ): Promise<ConnectedHandle<TConfig>>;\n };\n }\n}\n\nif (typeof window !== 'undefined') {\n if (!window.ReachyMini) {\n window.ReachyMini = ReachyMini;\n window.dispatchEvent(new Event('reachymini:ready'));\n }\n window.ReachyMiniHostEmbed = { connectToHost };\n}\n\nexport { connectToHost };\nexport type { ConnectedHandle, ConnectToHostOptions };\n"],"names":["ReachyMini","connectToHost"],"mappings":";;AAwCI,OAAO,SAAW,QACf,OAAO,eACV,OAAO,aAAaA,GACpB,OAAO,cAAc,IAAI,MAAM,kBAAkB,CAAC,IAEpD,OAAO,sBAAsB,EAAE,eAAAC,EAAA;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface HfProfile {
|
|
2
|
+
username: string | null;
|
|
3
|
+
/** Fully-qualified avatar URL ready to drop into an `<img>` `src`. */
|
|
4
|
+
avatarUrl: string | null;
|
|
5
|
+
}
|
|
6
|
+
export declare function useHfProfile(token: string | null): HfProfile;
|
|
7
|
+
//# sourceMappingURL=useHfProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHfProfile.d.ts","sourceRoot":"","sources":["../../src/hooks/useHfProfile.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,sEAAsE;IACtE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAgDD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CA+B5D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AppConnectingStep, AppPhase, ConfigPayload, HostInitMsg, LeavingReason, ThemeMode } from '../lib/protocol';
|
|
2
|
+
export interface EmbedAppState {
|
|
3
|
+
phase: AppPhase;
|
|
4
|
+
connectingStep: AppConnectingStep | null;
|
|
5
|
+
message: string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface UseHostBridgeOptions {
|
|
8
|
+
/** Called once per session, when the embed posts
|
|
9
|
+
* `embed:ready`. The host MUST respond with `host:init`
|
|
10
|
+
* via `sendInit` before resolving the picker phase. */
|
|
11
|
+
onEmbedReady(): void;
|
|
12
|
+
/** Called on every `embed:app-state` envelope. */
|
|
13
|
+
onAppState(state: EmbedAppState): void;
|
|
14
|
+
/** App requests a clean leave (in-app button, etc.). Host
|
|
15
|
+
* should run the same tear-down as a user-initiated end. */
|
|
16
|
+
onRequestLeave(): void;
|
|
17
|
+
/** App reported an error. Fatal errors should switch the host
|
|
18
|
+
* to ErrorView; non-fatal can be toasted or logged. */
|
|
19
|
+
onError(payload: {
|
|
20
|
+
message: string;
|
|
21
|
+
fatal: boolean;
|
|
22
|
+
detail?: unknown;
|
|
23
|
+
}): void;
|
|
24
|
+
}
|
|
25
|
+
export interface HostBridge {
|
|
26
|
+
/** `host:init`. Sends credentials + initial state to the embed. */
|
|
27
|
+
sendInit(iframe: HTMLIFrameElement, payload: Omit<HostInitMsg, 'source' | 'type' | 'version'>): void;
|
|
28
|
+
/** `host:theme-changed`. Push a theme update without reload. */
|
|
29
|
+
sendThemeChanged(iframe: HTMLIFrameElement, theme: ThemeMode): void;
|
|
30
|
+
/** `host:config-changed`. Push a config update without reload. */
|
|
31
|
+
sendConfigChanged(iframe: HTMLIFrameElement, config: ConfigPayload): void;
|
|
32
|
+
/** `host:leaving`. Notify the embed to tear down. The host
|
|
33
|
+
* unmounts the iframe after `timeoutMs` regardless. */
|
|
34
|
+
sendLeaving(iframe: HTMLIFrameElement, reason: LeavingReason, timeoutMs: number): void;
|
|
35
|
+
}
|
|
36
|
+
export declare function useHostBridge(opts: UseHostBridgeOptions): HostBridge;
|
|
37
|
+
//# sourceMappingURL=useHostBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHostBridge.d.ts","sourceRoot":"","sources":["../../src/hooks/useHostBridge.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACV,iBAAiB,EACjB,QAAQ,EACR,aAAa,EAEb,WAAW,EACX,aAAa,EACb,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,QAAQ,CAAC;IAChB,cAAc,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACzC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC;;4DAEwD;IACxD,YAAY,IAAI,IAAI,CAAC;IACrB,kDAAkD;IAClD,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IACvC;iEAC6D;IAC7D,cAAc,IAAI,IAAI,CAAC;IACvB;4DACwD;IACxD,OAAO,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CAC/E;AAED,MAAM,WAAW,UAAU;IACzB,mEAAmE;IACnE,QAAQ,CACN,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC,GACxD,IAAI,CAAC;IACR,gEAAgE;IAChE,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IACpE,kEAAkE;IAClE,iBAAiB,CACf,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,aAAa,GACpB,IAAI,CAAC;IACR;4DACwD;IACxD,WAAW,CACT,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,MAAM,GAChB,IAAI,CAAC;CACT;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,UAAU,CA2GpE"}
|