chore: bump host to 0.3.6 (welcome anim fixes + mobile-parity picker)
Browse filesRefresh vendored @reachy-mini/host:
- welcome-back animation triggers only on user-initiated sign-in
(no more spurious play on first load / page reload)
- one-shot latch prevents the overlay from re-firing in a loop
when isPostOauthReturn stays sticky
- picker robot card mirrors the mobile app exactly: ListItemButton,
antenna-peeking RobotAvatar, Wi-Fi/USB TransportChip, lock 20px
+ text.disabled, "In use Β· {app}" tooltip placement left
Also fix `devToken: { username }` -> `userName` to match the
host's MountHostOptions contract.
Co-authored-by: Cursor <cursoragent@cursor.com>
This view is limited to 50 files because it contains too many changes. Β See raw diff
- src/dispatch.ts +1 -1
- vendor/reachy-mini-host/dist/ReachyHost.d.ts +35 -22
- vendor/reachy-mini-host/dist/ReachyHost.d.ts.map +1 -1
- vendor/reachy-mini-host/dist/chunks/index-BLeHwvaH.js +348 -0
- vendor/reachy-mini-host/dist/chunks/index-BLeHwvaH.js.map +1 -0
- vendor/reachy-mini-host/dist/chunks/mountHost-9Zrr6zPn.js +0 -0
- vendor/reachy-mini-host/dist/chunks/mountHost-9Zrr6zPn.js.map +0 -0
- vendor/reachy-mini-host/dist/chunks/{protocol-BHyPqHVt.js β protocol-5pluLXHg.js} +28 -11
- vendor/reachy-mini-host/dist/chunks/protocol-5pluLXHg.js.map +1 -0
- vendor/reachy-mini-host/dist/chunks/protocol-BHyPqHVt.js.map +0 -1
- vendor/reachy-mini-host/dist/components/AppFrame.d.ts +0 -51
- vendor/reachy-mini-host/dist/components/AppFrame.d.ts.map +0 -1
- vendor/reachy-mini-host/dist/components/CenteredViewport.d.ts +0 -63
- vendor/reachy-mini-host/dist/components/CenteredViewport.d.ts.map +0 -1
- vendor/reachy-mini-host/dist/components/ConnectingView.d.ts +10 -28
- vendor/reachy-mini-host/dist/components/ConnectingView.d.ts.map +1 -1
- vendor/reachy-mini-host/dist/components/EmbedFrame.d.ts +16 -0
- vendor/reachy-mini-host/dist/components/EmbedFrame.d.ts.map +1 -0
- vendor/reachy-mini-host/dist/components/ErrorView.d.ts +19 -13
- vendor/reachy-mini-host/dist/components/ErrorView.d.ts.map +1 -1
- vendor/reachy-mini-host/dist/components/LeavingView.d.ts +32 -1
- vendor/reachy-mini-host/dist/components/LeavingView.d.ts.map +1 -1
- vendor/reachy-mini-host/dist/components/PickerView.d.ts +51 -0
- vendor/reachy-mini-host/dist/components/PickerView.d.ts.map +1 -0
- vendor/reachy-mini-host/dist/components/ReachyHostShell.d.ts +21 -0
- vendor/reachy-mini-host/dist/components/ReachyHostShell.d.ts.map +1 -0
- vendor/reachy-mini-host/dist/components/RobotPickerView.d.ts +0 -18
- vendor/reachy-mini-host/dist/components/RobotPickerView.d.ts.map +0 -1
- vendor/reachy-mini-host/dist/components/SignInView.d.ts +30 -19
- vendor/reachy-mini-host/dist/components/SignInView.d.ts.map +1 -1
- vendor/reachy-mini-host/dist/components/StepsProgressIndicator.d.ts +24 -4
- vendor/reachy-mini-host/dist/components/StepsProgressIndicator.d.ts.map +1 -1
- vendor/reachy-mini-host/dist/components/TopBar.d.ts +49 -50
- vendor/reachy-mini-host/dist/components/TopBar.d.ts.map +1 -1
- vendor/reachy-mini-host/dist/components/WelcomeBackOverlay.d.ts +28 -0
- vendor/reachy-mini-host/dist/components/WelcomeBackOverlay.d.ts.map +1 -0
- vendor/reachy-mini-host/dist/components/WelcomeBackView.d.ts +0 -7
- vendor/reachy-mini-host/dist/components/WelcomeBackView.d.ts.map +0 -1
- vendor/reachy-mini-host/dist/embed/index.d.ts +43 -70
- vendor/reachy-mini-host/dist/embed/index.d.ts.map +1 -1
- vendor/reachy-mini-host/dist/entry/auto.d.ts +20 -16
- vendor/reachy-mini-host/dist/entry/auto.d.ts.map +1 -1
- vendor/reachy-mini-host/dist/entry/auto.js +0 -0
- vendor/reachy-mini-host/dist/entry/auto.js.map +0 -0
- vendor/reachy-mini-host/dist/entry/embed.d.ts +21 -7
- vendor/reachy-mini-host/dist/entry/embed.d.ts.map +1 -1
- vendor/reachy-mini-host/dist/entry/embed.js +3 -258
- vendor/reachy-mini-host/dist/entry/embed.js.map +1 -1
- vendor/reachy-mini-host/dist/hooks/useHfProfile.d.ts +2 -11
- vendor/reachy-mini-host/dist/hooks/useHfProfile.d.ts.map +1 -1
src/dispatch.ts
CHANGED
|
@@ -49,7 +49,7 @@ if (isEmbed) {
|
|
| 49 |
import.meta.env.VITE_HF_TOKEN && import.meta.env.VITE_HF_USERNAME
|
| 50 |
? {
|
| 51 |
token: import.meta.env.VITE_HF_TOKEN as string,
|
| 52 |
-
|
| 53 |
}
|
| 54 |
: undefined,
|
| 55 |
clientId: import.meta.env.VITE_HF_OAUTH_CLIENT_ID as string | undefined,
|
|
|
|
| 49 |
import.meta.env.VITE_HF_TOKEN && import.meta.env.VITE_HF_USERNAME
|
| 50 |
? {
|
| 51 |
token: import.meta.env.VITE_HF_TOKEN as string,
|
| 52 |
+
userName: import.meta.env.VITE_HF_USERNAME as string,
|
| 53 |
}
|
| 54 |
: undefined,
|
| 55 |
clientId: import.meta.env.VITE_HF_OAUTH_CLIENT_ID as string | undefined,
|
vendor/reachy-mini-host/dist/ReachyHost.d.ts
CHANGED
|
@@ -1,26 +1,39 @@
|
|
| 1 |
-
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
import type { ConfigPayload } from './lib/protocol';
|
| 4 |
-
export interface ReachyHostProps
|
| 5 |
-
/**
|
| 6 |
-
*
|
| 7 |
-
*
|
| 8 |
-
|
| 9 |
-
/**
|
| 10 |
-
appIconUrl?: string
|
| 11 |
-
/**
|
| 12 |
-
appEmoji?: string
|
| 13 |
-
/**
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
/**
|
| 22 |
-
|
|
|
|
|
|
|
| 23 |
initialConfig?: ConfigPayload;
|
| 24 |
}
|
| 25 |
-
export
|
| 26 |
//# sourceMappingURL=ReachyHost.d.ts.map
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Public React component for the host shell.
|
| 3 |
+
*
|
| 4 |
+
* Wraps `ReachyHostShell` with the bundled MUI theme provider,
|
| 5 |
+
* CssBaseline, and the React-friendly hooks. App authors who
|
| 6 |
+
* want a single `<ReachyHost />` JSX node import this; everyone
|
| 7 |
+
* else uses `mountHost()`.
|
| 8 |
+
*
|
| 9 |
+
* Strict Mode safety: the underlying `useSdk` hook stores its
|
| 10 |
+
* SDK instance at module scope, so a double-mount in dev does
|
| 11 |
+
* NOT create two SDK instances. See SPEC Β§8.1 / Β§8.4.
|
| 12 |
+
*/
|
| 13 |
+
import type { JSX } from 'react';
|
| 14 |
import type { ConfigPayload } from './lib/protocol';
|
| 15 |
+
export interface ReachyHostProps {
|
| 16 |
+
/** App's display name. Required - shown in top bar, passed to
|
| 17 |
+
* the SDK, and surfaced to other apps that may collide on a
|
| 18 |
+
* busy robot. */
|
| 19 |
+
appName: string;
|
| 20 |
+
/** Top-bar icon. Recommended size 32Γ32. */
|
| 21 |
+
appIconUrl?: string;
|
| 22 |
+
/** Emoji fallback if no icon. */
|
| 23 |
+
appEmoji?: string;
|
| 24 |
+
/** Allow microphone capture inside the iframe. */
|
| 25 |
+
enableMicrophone?: boolean;
|
| 26 |
+
/** HF OAuth client ID. Falls back to
|
| 27 |
+
* `window.huggingface.variables.OAUTH_CLIENT_ID` then
|
| 28 |
+
* `localStorage`. */
|
| 29 |
+
clientId?: string;
|
| 30 |
+
/** Embed entry path (defaults to `/?embed=1`). */
|
| 31 |
+
embedPath?: string;
|
| 32 |
+
/** Host display name (e.g. "Reachy Mini Hub"). */
|
| 33 |
+
hostName?: string;
|
| 34 |
+
/** Initial config payload (typically decoded from
|
| 35 |
+
* `?config=`). */
|
| 36 |
initialConfig?: ConfigPayload;
|
| 37 |
}
|
| 38 |
+
export declare function ReachyHost({ appName, appIconUrl, appEmoji, enableMicrophone, clientId, embedPath, hostName, initialConfig, }: ReachyHostProps): JSX.Element;
|
| 39 |
//# sourceMappingURL=ReachyHost.d.ts.map
|
vendor/reachy-mini-host/dist/ReachyHost.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"ReachyHost.d.ts","sourceRoot":"","sources":["../src/ReachyHost.tsx"],"names":[],"mappings":"
|
|
|
|
| 1 |
+
{"version":3,"file":"ReachyHost.d.ts","sourceRoot":"","sources":["../src/ReachyHost.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAcjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B;;sBAEkB;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;0BAEsB;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;uBACmB;IACnB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,UAAU,EACV,QAAQ,EACR,gBAAwB,EACxB,QAAQ,EACR,SAAuB,EACvB,QAAwB,EACxB,aAAa,GACd,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAyC/B"}
|
vendor/reachy-mini-host/dist/chunks/index-BLeHwvaH.js
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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g.js";
|
| 2 |
+
const N = 8e3, O = 8e3, P = 900 * 1e3;
|
| 3 |
+
let I = null;
|
| 4 |
+
async function F(t = {}) {
|
| 5 |
+
return I || (I = M(t)), await I;
|
| 6 |
+
}
|
| 7 |
+
async function M(t) {
|
| 8 |
+
const r = t.expectedOrigin ?? window.location.origin, s = L(window.location.hash);
|
| 9 |
+
if (C(), !s)
|
| 10 |
+
throw new Error(
|
| 11 |
+
"[@reachy-mini/host/embed] no creds bundle found in URL hash. Was the embed mounted directly without ?embed=1#creds=...?"
|
| 12 |
+
);
|
| 13 |
+
if (!await D(N))
|
| 14 |
+
throw new Error(
|
| 15 |
+
`[@reachy-mini/host/embed] window.ReachyMini did not become available within ${N}ms - check the SDK CDN tag.`
|
| 16 |
+
);
|
| 17 |
+
s.hfToken && s.userName && H(s.hfToken, s.userName);
|
| 18 |
+
const e = new window.ReachyMini({
|
| 19 |
+
appName: s.appName,
|
| 20 |
+
signalingUrl: s.signalingUrl,
|
| 21 |
+
...t.sdkOptions
|
| 22 |
+
}), c = R(r);
|
| 23 |
+
b({
|
| 24 |
+
source: y,
|
| 25 |
+
type: "embed:ready",
|
| 26 |
+
version: m
|
| 27 |
+
}), c.start();
|
| 28 |
+
const d = await c.awaitHostInit(O, s);
|
| 29 |
+
g("connecting", "link"), l("boot:link:start", { robotPeerId: d.robotPeerId }), await e.authenticate(), l("boot:authenticate:ok", { state: e.state }), await e.connect(), l("boot:connect:ok", {
|
| 30 |
+
state: e.state,
|
| 31 |
+
robots: (e.robots ?? []).length
|
| 32 |
+
}), g("connecting", "session"), l("boot:session:start", { robotPeerId: d.robotPeerId }), A(e);
|
| 33 |
+
try {
|
| 34 |
+
await e.startSession(d.robotPeerId), l("boot:session:ok");
|
| 35 |
+
} catch (u) {
|
| 36 |
+
throw l("boot:session:error", {
|
| 37 |
+
message: u?.message ?? String(u)
|
| 38 |
+
}), u;
|
| 39 |
+
}
|
| 40 |
+
return g("connecting", "wake"), l("boot:wake:start"), await e.ensureAwake(), l("boot:wake:ok"), c.attachPageHide(e), g("live", null), c.buildHandle(e, d);
|
| 41 |
+
}
|
| 42 |
+
function T(t) {
|
| 43 |
+
return {
|
| 44 |
+
theme: t.theme,
|
| 45 |
+
config: t.config,
|
| 46 |
+
appName: t.appName,
|
| 47 |
+
hostName: t.hostName,
|
| 48 |
+
userName: t.userName ?? null,
|
| 49 |
+
robotPeerId: t.robotPeerId
|
| 50 |
+
};
|
| 51 |
+
}
|
| 52 |
+
function _(t) {
|
| 53 |
+
return {
|
| 54 |
+
theme: t.theme,
|
| 55 |
+
config: t.config,
|
| 56 |
+
appName: t.appName,
|
| 57 |
+
hostName: t.hostName,
|
| 58 |
+
userName: t.userName ?? null,
|
| 59 |
+
robotPeerId: t.robotPeerId
|
| 60 |
+
};
|
| 61 |
+
}
|
| 62 |
+
function R(t) {
|
| 63 |
+
const r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set();
|
| 64 |
+
let e = null, c = !1, d = !1, u = null;
|
| 65 |
+
function w(n) {
|
| 66 |
+
switch (n.type) {
|
| 67 |
+
case "host:init": {
|
| 68 |
+
e = _(n), s.forEach((o) => o(e.theme)), h.forEach((o) => o(e.config));
|
| 69 |
+
break;
|
| 70 |
+
}
|
| 71 |
+
case "host:theme-changed": {
|
| 72 |
+
e && (e.theme = n.theme), s.forEach((o) => o(n.theme));
|
| 73 |
+
break;
|
| 74 |
+
}
|
| 75 |
+
case "host:config-changed": {
|
| 76 |
+
e && (e.config = n.config), h.forEach((o) => o(n.config));
|
| 77 |
+
break;
|
| 78 |
+
}
|
| 79 |
+
case "host:leaving": {
|
| 80 |
+
i();
|
| 81 |
+
break;
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
function i() {
|
| 86 |
+
c || (c = !0, r.forEach((n) => {
|
| 87 |
+
try {
|
| 88 |
+
n();
|
| 89 |
+
} catch (o) {
|
| 90 |
+
console.warn("[@reachy-mini/host/embed] onLeave threw", o);
|
| 91 |
+
}
|
| 92 |
+
}));
|
| 93 |
+
}
|
| 94 |
+
return {
|
| 95 |
+
start() {
|
| 96 |
+
d || (d = !0, u = (n) => {
|
| 97 |
+
n.origin === t && v(n.data) && w(n.data);
|
| 98 |
+
}, window.addEventListener("message", u));
|
| 99 |
+
},
|
| 100 |
+
async awaitHostInit(n, o) {
|
| 101 |
+
return window.parent !== window ? e || new Promise((f) => {
|
| 102 |
+
const p = (S) => {
|
| 103 |
+
if (S.origin !== t || !v(S.data)) return;
|
| 104 |
+
const k = S.data;
|
| 105 |
+
k.type === "host:init" && (window.removeEventListener("message", p), window.clearTimeout(E), e = _(k), f(e));
|
| 106 |
+
}, E = window.setTimeout(() => {
|
| 107 |
+
window.removeEventListener("message", p), e || (e = T(o)), f(e);
|
| 108 |
+
}, n);
|
| 109 |
+
window.addEventListener("message", p);
|
| 110 |
+
}) : (e = T(o), e);
|
| 111 |
+
},
|
| 112 |
+
attachPageHide(n) {
|
| 113 |
+
const o = () => {
|
| 114 |
+
i();
|
| 115 |
+
try {
|
| 116 |
+
n.stopSession();
|
| 117 |
+
} catch {
|
| 118 |
+
}
|
| 119 |
+
};
|
| 120 |
+
window.addEventListener("pagehide", o, { once: !0 });
|
| 121 |
+
},
|
| 122 |
+
buildHandle(n, o) {
|
| 123 |
+
return e = o, {
|
| 124 |
+
reachy: n,
|
| 125 |
+
get theme() {
|
| 126 |
+
return e.theme;
|
| 127 |
+
},
|
| 128 |
+
get config() {
|
| 129 |
+
return e.config;
|
| 130 |
+
},
|
| 131 |
+
get appName() {
|
| 132 |
+
return e.appName;
|
| 133 |
+
},
|
| 134 |
+
get hostName() {
|
| 135 |
+
return e.hostName;
|
| 136 |
+
},
|
| 137 |
+
get userName() {
|
| 138 |
+
return e.userName;
|
| 139 |
+
},
|
| 140 |
+
onLeave(a) {
|
| 141 |
+
return r.add(a), () => r.delete(a);
|
| 142 |
+
},
|
| 143 |
+
onThemeChange(a) {
|
| 144 |
+
return s.add(a), () => s.delete(a);
|
| 145 |
+
},
|
| 146 |
+
onConfigChange(a) {
|
| 147 |
+
const f = (p) => a(p);
|
| 148 |
+
return h.add(f), () => h.delete(f);
|
| 149 |
+
},
|
| 150 |
+
setAppState(a) {
|
| 151 |
+
g(
|
| 152 |
+
a.phase,
|
| 153 |
+
a.connectingStep ?? null,
|
| 154 |
+
a.message ?? null
|
| 155 |
+
);
|
| 156 |
+
},
|
| 157 |
+
requestLeave() {
|
| 158 |
+
b({
|
| 159 |
+
source: y,
|
| 160 |
+
type: "embed:request-leave",
|
| 161 |
+
version: m
|
| 162 |
+
});
|
| 163 |
+
},
|
| 164 |
+
reportError(a, f) {
|
| 165 |
+
b({
|
| 166 |
+
source: y,
|
| 167 |
+
type: "embed:error",
|
| 168 |
+
version: m,
|
| 169 |
+
message: a,
|
| 170 |
+
fatal: f?.fatal === !0,
|
| 171 |
+
detail: f?.detail
|
| 172 |
+
});
|
| 173 |
+
}
|
| 174 |
+
};
|
| 175 |
+
}
|
| 176 |
+
};
|
| 177 |
+
}
|
| 178 |
+
function C() {
|
| 179 |
+
try {
|
| 180 |
+
const t = window.location.pathname + window.location.search;
|
| 181 |
+
history.replaceState(history.state, document.title, t);
|
| 182 |
+
} catch {
|
| 183 |
+
}
|
| 184 |
+
}
|
| 185 |
+
function H(t, r) {
|
| 186 |
+
try {
|
| 187 |
+
sessionStorage.setItem("hf_token", t), sessionStorage.setItem("hf_username", r), sessionStorage.setItem(
|
| 188 |
+
"hf_token_expires",
|
| 189 |
+
new Date(Date.now() + P).toISOString()
|
| 190 |
+
);
|
| 191 |
+
} catch {
|
| 192 |
+
}
|
| 193 |
+
}
|
| 194 |
+
function D(t) {
|
| 195 |
+
return new Promise((r) => {
|
| 196 |
+
if (typeof window > "u") {
|
| 197 |
+
r(!1);
|
| 198 |
+
return;
|
| 199 |
+
}
|
| 200 |
+
if (window.ReachyMini) {
|
| 201 |
+
r(!0);
|
| 202 |
+
return;
|
| 203 |
+
}
|
| 204 |
+
let s = !1;
|
| 205 |
+
const h = () => {
|
| 206 |
+
s || (s = !0, window.removeEventListener("reachymini:ready", h), window.clearTimeout(e), r(!!window.ReachyMini));
|
| 207 |
+
}, e = window.setTimeout(() => {
|
| 208 |
+
s || (s = !0, window.removeEventListener("reachymini:ready", h), r(!1));
|
| 209 |
+
}, t);
|
| 210 |
+
window.addEventListener("reachymini:ready", h);
|
| 211 |
+
});
|
| 212 |
+
}
|
| 213 |
+
function b(t) {
|
| 214 |
+
if (!(typeof window > "u"))
|
| 215 |
+
try {
|
| 216 |
+
window.parent.postMessage(t, window.location.origin);
|
| 217 |
+
} catch (r) {
|
| 218 |
+
console.warn("[@reachy-mini/host/embed] postMessage to host failed", r);
|
| 219 |
+
}
|
| 220 |
+
}
|
| 221 |
+
function g(t, r, s = null) {
|
| 222 |
+
b({
|
| 223 |
+
source: y,
|
| 224 |
+
type: "embed:app-state",
|
| 225 |
+
version: m,
|
| 226 |
+
phase: t,
|
| 227 |
+
connectingStep: r,
|
| 228 |
+
message: s
|
| 229 |
+
});
|
| 230 |
+
}
|
| 231 |
+
function l(t, r = {}) {
|
| 232 |
+
if (!(typeof window > "u")) {
|
| 233 |
+
try {
|
| 234 |
+
window.parent.postMessage(
|
| 235 |
+
{
|
| 236 |
+
source: y,
|
| 237 |
+
type: "embed:debug",
|
| 238 |
+
version: m,
|
| 239 |
+
tag: t,
|
| 240 |
+
payload: r
|
| 241 |
+
},
|
| 242 |
+
window.location.origin
|
| 243 |
+
);
|
| 244 |
+
} catch {
|
| 245 |
+
}
|
| 246 |
+
try {
|
| 247 |
+
let s = "";
|
| 248 |
+
try {
|
| 249 |
+
s = JSON.stringify(r);
|
| 250 |
+
} catch {
|
| 251 |
+
s = "<unserializable>";
|
| 252 |
+
}
|
| 253 |
+
console.info(`[embed-debug] ${t} ${s}`);
|
| 254 |
+
} catch {
|
| 255 |
+
}
|
| 256 |
+
}
|
| 257 |
+
}
|
| 258 |
+
function A(t) {
|
| 259 |
+
const r = [
|
| 260 |
+
"connected",
|
| 261 |
+
"disconnected",
|
| 262 |
+
"streaming",
|
| 263 |
+
"sessionStopped",
|
| 264 |
+
"sessionRejected",
|
| 265 |
+
"robotsChanged",
|
| 266 |
+
"error",
|
| 267 |
+
"state",
|
| 268 |
+
"log",
|
| 269 |
+
"message"
|
| 270 |
+
];
|
| 271 |
+
for (const e of r)
|
| 272 |
+
try {
|
| 273 |
+
t.addEventListener(e, (c) => {
|
| 274 |
+
let d = {};
|
| 275 |
+
const u = c;
|
| 276 |
+
if (u && typeof u == "object" && "detail" in u)
|
| 277 |
+
try {
|
| 278 |
+
d = JSON.parse(JSON.stringify(u.detail ?? null));
|
| 279 |
+
} catch {
|
| 280 |
+
d = { _unserializable: !0 };
|
| 281 |
+
}
|
| 282 |
+
l(`sdk:${e}`, d);
|
| 283 |
+
});
|
| 284 |
+
} catch {
|
| 285 |
+
}
|
| 286 |
+
try {
|
| 287 |
+
const e = t, c = e._handleSignalingMessage;
|
| 288 |
+
if (typeof c == "function") {
|
| 289 |
+
const d = e._sendToServer;
|
| 290 |
+
typeof d == "function" && (e._sendToServer = async function(w) {
|
| 291 |
+
const i = w, n = { type: i?.type ?? "?" };
|
| 292 |
+
if (i && "peerId" in i && (n.peerId = String(i.peerId)), i && "sessionId" in i && (n.sessionId = String(i.sessionId)), i && "sdp" in i) {
|
| 293 |
+
const o = i.sdp;
|
| 294 |
+
n.sdpType = o?.type ?? "?", n.sdpLen = o?.sdp?.length ?? 0;
|
| 295 |
+
}
|
| 296 |
+
if (i && "ice" in i) {
|
| 297 |
+
const o = i.ice;
|
| 298 |
+
n.iceCand = (o?.candidate ?? "").slice(0, 60) || "<end-of-candidates>";
|
| 299 |
+
}
|
| 300 |
+
l("sdk:send", n);
|
| 301 |
+
try {
|
| 302 |
+
const o = await d.call(this, w), a = o;
|
| 303 |
+
return l("sdk:send:res", {
|
| 304 |
+
inFor: n.type,
|
| 305 |
+
resType: a?.type ?? null,
|
| 306 |
+
keys: a ? Object.keys(a) : []
|
| 307 |
+
}), o;
|
| 308 |
+
} catch (o) {
|
| 309 |
+
throw l("sdk:send:err", {
|
| 310 |
+
inFor: n.type,
|
| 311 |
+
msg: o?.message ?? String(o)
|
| 312 |
+
}), o;
|
| 313 |
+
}
|
| 314 |
+
}), e._handleSignalingMessage = function(w) {
|
| 315 |
+
const i = w, n = { type: i?.type ?? "?" };
|
| 316 |
+
if ("sessionId" in i && (n.sessionId = String(i.sessionId)), "peerId" in i && (n.peerId = String(i.peerId)), "sdp" in i) {
|
| 317 |
+
const o = i.sdp;
|
| 318 |
+
n.sdpType = o?.type ?? "?", n.sdpLen = o?.sdp?.length ?? 0;
|
| 319 |
+
}
|
| 320 |
+
if ("ice" in i) {
|
| 321 |
+
const o = i.ice;
|
| 322 |
+
n.iceCand = (o?.candidate ?? "").slice(0, 60) || "<end-of-candidates>";
|
| 323 |
+
}
|
| 324 |
+
return "reason" in i && (n.reason = String(i.reason)), l("sdk:sse", n), c.call(this, w);
|
| 325 |
+
};
|
| 326 |
+
}
|
| 327 |
+
} catch {
|
| 328 |
+
}
|
| 329 |
+
const s = Date.now(), h = window.setInterval(() => {
|
| 330 |
+
const e = t, c = e._pc, d = e._dc;
|
| 331 |
+
l("sdk:probe", {
|
| 332 |
+
elapsedMs: Date.now() - s,
|
| 333 |
+
myPeerId: e._peerId ?? null,
|
| 334 |
+
state: e._state ?? null,
|
| 335 |
+
sseAborted: e._sseAbortController?.signal?.aborted ?? null,
|
| 336 |
+
pcState: c?.connectionState ?? null,
|
| 337 |
+
iceState: c?.iceConnectionState ?? null,
|
| 338 |
+
iceGather: c?.iceGatheringState ?? null,
|
| 339 |
+
signalingState: c?.signalingState ?? null,
|
| 340 |
+
dcState: d?.readyState ?? null,
|
| 341 |
+
sessionId: e._sessionId ?? null
|
| 342 |
+
}), Date.now() - s > 3e4 && window.clearInterval(h);
|
| 343 |
+
}, 1500);
|
| 344 |
+
}
|
| 345 |
+
export {
|
| 346 |
+
F as c
|
| 347 |
+
};
|
| 348 |
+
//# sourceMappingURL=index-BLeHwvaH.js.map
|
vendor/reachy-mini-host/dist/chunks/index-BLeHwvaH.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"index-BLeHwvaH.js","sources":["../../src/embed/index.ts"],"sourcesContent":["/**\n * Embedded-app client.\n *\n * Vanilla TypeScript helper that lives in the iframe side of the\n * host / app split. Consumed by `src/embed.{ts,tsx}` in each app\n * (or via the CDN entry `@reachy-mini/host/embed` script tag).\n *\n * import { connectToHost } from '@reachy-mini/host/embed';\n *\n * const handle = await connectToHost<MyAppConfig>();\n * handle.onLeave(() => { /* clean up before unmount *\\/ });\n * handle.reachy.setHeadRpyDeg(0, 10, 0);\n *\n * Boot sequence (canonical reference: SPEC.md Β§6.4):\n * 1. Read `#creds=<base64>` synchronously and wipe the hash\n * with `history.replaceState`.\n * 2. Wait for `window.ReachyMini` (8 s timeout).\n * 3. Instantiate the SDK, seed the HF token into\n * `sessionStorage`.\n * 4. Send `embed:ready` to the parent.\n * 5. Wait for `host:init` (8 s timeout; Mode B proceeds from\n * hash alone when this never arrives).\n * 6. `connect()` β `startSession()` β `ensureAwake()`, emitting\n * `embed:app-state` at each step.\n * 7. Resolve `connectToHost()` with the live SDK handle.\n *\n * Strict Mode safety (SPEC Β§8.4): the function is idempotent\n * across multiple awaits via a module-level promise. Calling\n * `connectToHost()` twice returns the same in-flight promise;\n * a single SDK instance is created, a single `embed:ready` is\n * posted.\n */\nimport type {\n ReachyMiniInstance,\n ReachyMiniOptions,\n} from '../lib/sdk-types';\nimport {\n PROTOCOL_SOURCE,\n PROTOCOL_VERSION,\n decodeCredsFromHash,\n isProtocolMessage,\n} from '../lib/protocol';\nimport type {\n AppConnectingStep,\n AppPhase,\n ConfigPayload,\n CredsBundle,\n EmbedToHostMsg,\n HostInitMsg,\n HostToEmbedMsg,\n ThemeMode,\n} from '../lib/protocol';\n\nconst SDK_READY_TIMEOUT_MS = 8000;\nconst HOST_INIT_TIMEOUT_MS = 8000;\nconst TOKEN_TTL_MS = 15 * 60 * 1000;\n\n/** Resolved state at the moment `connectToHost()` returns. */\nexport interface ConnectedHandle<TConfig = unknown> {\n /** Live SDK instance: connected, session started, robot awake. */\n reachy: ReachyMiniInstance;\n /** Current theme; updated via `onThemeChange`. */\n theme: ThemeMode;\n /** Initial config (from URL `?config=` or mobile handoff).\n * Updates pushed via `onConfigChange`. */\n config: TConfig | null;\n /** App display name as passed by the host. */\n appName: string;\n /** Host display name (e.g. \"Reachy Mini\"). */\n hostName: string;\n /** HF user name when known (from `host:init`). */\n userName: string | null;\n\n /** Register a teardown callback. Fires on `host:leaving`\n * (one-shot) or `pagehide`. Return a promise to keep the host\n * waiting (bounded by the host's `timeoutMs`). Returns an\n * unsubscribe function. */\n onLeave(cb: () => void | Promise<void>): () => void;\n /** Register a theme-change handler. */\n onThemeChange(cb: (theme: ThemeMode) => void): () => void;\n /** Register a config-change handler. */\n onConfigChange(cb: (config: TConfig | null) => void): () => void;\n\n /** Push an app-level state update upstream so the host can\n * drive its ConnectingView overlay. */\n setAppState(state: {\n phase: AppPhase;\n connectingStep?: AppConnectingStep | null;\n message?: string | null;\n }): void;\n /** Ask the host to start the leave sequence. */\n requestLeave(): void;\n /** Report an error. `fatal: true` switches the host to ErrorView. */\n reportError(\n message: string,\n opts?: { fatal?: boolean; detail?: unknown },\n ): void;\n}\n\nexport interface ConnectToHostOptions {\n /** Forwarded to the SDK constructor. `appName`, `signalingUrl`,\n * `clientId` are auto-set from the creds bundle. */\n sdkOptions?: Partial<ReachyMiniOptions>;\n /** Origin of the host's window. Defaults to\n * `window.location.origin` (same-origin iframe). */\n expectedOrigin?: string;\n}\n\n/* βββββββββββββββββββ Module-level idempotency βββββββββββββββββββ */\n\nlet bootPromise: Promise<ConnectedHandle<unknown>> | null = null;\n\n/** Boot the embedded app. Idempotent: calling twice returns the\n * same in-flight promise. */\nexport async function connectToHost<TConfig = unknown>(\n options: ConnectToHostOptions = {},\n): Promise<ConnectedHandle<TConfig>> {\n if (!bootPromise) {\n bootPromise = bootOnce(options) as Promise<ConnectedHandle<unknown>>;\n }\n return (await bootPromise) as ConnectedHandle<TConfig>;\n}\n\n/* βββββββββββββββββββ Boot pipeline βββββββββββββββββββ */\n\nasync function bootOnce(\n options: ConnectToHostOptions,\n): Promise<ConnectedHandle<unknown>> {\n const expectedOrigin = options.expectedOrigin ?? window.location.origin;\n\n // 1. Parse creds from the URL hash and wipe it synchronously.\n const creds = decodeCredsFromHash(window.location.hash);\n wipeUrlHash();\n\n if (!creds) {\n throw new Error(\n '[@reachy-mini/host/embed] no creds bundle found in URL hash. ' +\n 'Was the embed mounted directly without ?embed=1#creds=...?',\n );\n }\n\n // 2. Wait for the SDK script to finish loading.\n const sdkReady = await waitForSdkReady(SDK_READY_TIMEOUT_MS);\n if (!sdkReady) {\n throw new Error(\n '[@reachy-mini/host/embed] window.ReachyMini did not become ' +\n `available within ${SDK_READY_TIMEOUT_MS}ms - check the SDK CDN tag.`,\n );\n }\n\n // 3. Seed the HF token before SDK construction so authenticate()\n // resolves without a redirect.\n if (creds.hfToken && creds.userName) {\n seedSessionToken(creds.hfToken, creds.userName);\n }\n\n // 4. Build the SDK with the bundled signaling URL + appName.\n const sdk: ReachyMiniInstance = new window.ReachyMini({\n appName: creds.appName,\n signalingUrl: creds.signalingUrl,\n ...options.sdkOptions,\n });\n\n // 5. Build the bridge (subscriber registry) + post ready.\n const bridge = createBridge(expectedOrigin);\n postToHost({\n source: PROTOCOL_SOURCE,\n type: 'embed:ready',\n version: PROTOCOL_VERSION,\n });\n bridge.start();\n\n // 6. Optional host:init wait. In Mode B (mobile) the parent\n // never sends this and we proceed with the hash bundle alone.\n const live = await bridge.awaitHostInit(HOST_INIT_TIMEOUT_MS, creds);\n\n // 7. Sequence: connect β startSession β ensureAwake.\n pushAppState('connecting', 'link');\n postDebug('boot:link:start', { robotPeerId: live.robotPeerId });\n await sdk.authenticate();\n postDebug('boot:authenticate:ok', { state: (sdk as { state?: string }).state });\n await sdk.connect();\n postDebug('boot:connect:ok', {\n state: (sdk as { state?: string }).state,\n robots: ((sdk as { robots?: unknown[] }).robots ?? []).length,\n });\n\n pushAppState('connecting', 'session');\n postDebug('boot:session:start', { robotPeerId: live.robotPeerId });\n installSdkProbe(sdk);\n try {\n await sdk.startSession(live.robotPeerId);\n postDebug('boot:session:ok');\n } catch (err) {\n postDebug('boot:session:error', {\n message: (err as Error)?.message ?? String(err),\n });\n throw err;\n }\n\n pushAppState('connecting', 'wake');\n postDebug('boot:wake:start');\n await sdk.ensureAwake();\n postDebug('boot:wake:ok');\n\n // 8. We're live. Wire pagehide cleanup so the SDK releases the\n // robot if the browser kills the tab.\n bridge.attachPageHide(sdk);\n pushAppState('live', null);\n\n return bridge.buildHandle<unknown>(sdk, live);\n}\n\n/* βββββββββββββββββββ Bridge state βββββββββββββββββββ */\n\ninterface LiveState {\n theme: ThemeMode;\n config: ConfigPayload;\n appName: string;\n hostName: string;\n userName: string | null;\n robotPeerId: string;\n}\n\nfunction liveStateFromCreds(creds: CredsBundle): LiveState {\n return {\n theme: creds.theme,\n config: creds.config,\n appName: creds.appName,\n hostName: creds.hostName,\n userName: creds.userName ?? null,\n robotPeerId: creds.robotPeerId,\n };\n}\n\nfunction liveStateFromInit(msg: HostInitMsg): LiveState {\n return {\n theme: msg.theme,\n config: msg.config,\n appName: msg.appName,\n hostName: msg.hostName,\n userName: msg.userName ?? null,\n robotPeerId: msg.robotPeerId,\n };\n}\n\nfunction createBridge(expectedOrigin: string) {\n type LeaveCb = () => void | Promise<void>;\n type ThemeCb = (t: ThemeMode) => void;\n type ConfigCb = (c: unknown) => void;\n\n const leaveListeners = new Set<LeaveCb>();\n const themeListeners = new Set<ThemeCb>();\n const configListeners = new Set<ConfigCb>();\n\n let current: LiveState | null = null;\n let leaveTriggered = false;\n\n // Listener installed lazily so `embed:ready` is the only\n // outgoing event before the host has time to respond.\n let started = false;\n let onMessage: ((event: MessageEvent) => void) | null = null;\n\n function dispatchMessage(msg: HostToEmbedMsg): void {\n switch (msg.type) {\n case 'host:init': {\n current = liveStateFromInit(msg);\n // Re-notify subscribers in case the init arrives after\n // they registered (shouldn't happen with the current\n // boot order but cheap defensive code).\n themeListeners.forEach((cb) => cb(current!.theme));\n configListeners.forEach((cb) => cb(current!.config));\n break;\n }\n case 'host:theme-changed': {\n if (current) current.theme = msg.theme;\n themeListeners.forEach((cb) => cb(msg.theme));\n break;\n }\n case 'host:config-changed': {\n if (current) current.config = msg.config;\n configListeners.forEach((cb) => cb(msg.config));\n break;\n }\n case 'host:leaving': {\n runLeaveOnce();\n break;\n }\n }\n }\n\n function runLeaveOnce(): void {\n if (leaveTriggered) return;\n leaveTriggered = true;\n // Fire and forget; the host doesn't wait for an ack, it just\n // unmounts the iframe after `timeoutMs`.\n leaveListeners.forEach((cb) => {\n try {\n void cb();\n } catch (err) {\n console.warn('[@reachy-mini/host/embed] onLeave threw', err);\n }\n });\n }\n\n return {\n start(): void {\n if (started) return;\n started = true;\n onMessage = (event: MessageEvent) => {\n if (event.origin !== expectedOrigin) return;\n if (!isProtocolMessage(event.data)) return;\n dispatchMessage(event.data as HostToEmbedMsg);\n };\n window.addEventListener('message', onMessage);\n },\n\n async awaitHostInit(\n timeoutMs: number,\n fallbackCreds: CredsBundle,\n ): Promise<LiveState> {\n // Mode A path: we expect a host:init. Mode B path: parent\n // is `window` (no iframe), so no one will reply - fall\n // back to creds after the timeout.\n const isInIframe = window.parent !== window;\n if (!isInIframe) {\n current = liveStateFromCreds(fallbackCreds);\n return current;\n }\n\n // If host:init already arrived (race), use it.\n if (current) return current;\n\n return new Promise((resolve) => {\n const initListener = (event: MessageEvent): void => {\n if (event.origin !== expectedOrigin) return;\n if (!isProtocolMessage(event.data)) return;\n const data = event.data as HostToEmbedMsg;\n if (data.type !== 'host:init') return;\n window.removeEventListener('message', initListener);\n window.clearTimeout(timer);\n current = liveStateFromInit(data);\n resolve(current);\n };\n const timer = window.setTimeout(() => {\n window.removeEventListener('message', initListener);\n // Timeout: fall back to creds. Useful when the parent\n // never sends init (older host versions, manual\n // testing).\n if (!current) current = liveStateFromCreds(fallbackCreds);\n resolve(current);\n }, timeoutMs);\n window.addEventListener('message', initListener);\n });\n },\n\n attachPageHide(sdk: ReachyMiniInstance): void {\n const onPageHide = (): void => {\n runLeaveOnce();\n try {\n void sdk.stopSession();\n } catch {\n /* ignore - tab is going away anyway */\n }\n };\n window.addEventListener('pagehide', onPageHide, { once: true });\n },\n\n buildHandle<TConfig>(\n sdk: ReachyMiniInstance,\n live: LiveState,\n ): ConnectedHandle<TConfig> {\n current = live;\n return {\n reachy: sdk,\n get theme(): ThemeMode {\n return current!.theme;\n },\n get config(): TConfig | null {\n return current!.config as TConfig | null;\n },\n get appName(): string {\n return current!.appName;\n },\n get hostName(): string {\n return current!.hostName;\n },\n get userName(): string | null {\n return current!.userName;\n },\n onLeave(cb) {\n leaveListeners.add(cb);\n return () => leaveListeners.delete(cb);\n },\n onThemeChange(cb) {\n themeListeners.add(cb);\n return () => themeListeners.delete(cb);\n },\n onConfigChange(cb) {\n const wrapped = (c: unknown) => cb(c as TConfig | null);\n configListeners.add(wrapped);\n return () => configListeners.delete(wrapped);\n },\n setAppState(state) {\n pushAppState(\n state.phase,\n state.connectingStep ?? null,\n state.message ?? null,\n );\n },\n requestLeave() {\n postToHost({\n source: PROTOCOL_SOURCE,\n type: 'embed:request-leave',\n version: PROTOCOL_VERSION,\n });\n },\n reportError(message, opts) {\n postToHost({\n source: PROTOCOL_SOURCE,\n type: 'embed:error',\n version: PROTOCOL_VERSION,\n message,\n fatal: opts?.fatal === true,\n detail: opts?.detail,\n });\n },\n };\n },\n };\n}\n\n/* βββββββββββββββββββ Helpers βββββββββββββββββββ */\n\nfunction wipeUrlHash(): void {\n // Best-effort: replaceState fails on `file://` and a few exotic\n // schemes. We don't want to throw in the embed for that.\n try {\n const cleanUrl =\n window.location.pathname + window.location.search;\n history.replaceState(history.state, document.title, cleanUrl);\n } catch {\n /* ignore */\n }\n}\n\nfunction seedSessionToken(token: string, userName: string): void {\n try {\n sessionStorage.setItem('hf_token', token);\n sessionStorage.setItem('hf_username', userName);\n sessionStorage.setItem(\n 'hf_token_expires',\n new Date(Date.now() + TOKEN_TTL_MS).toISOString(),\n );\n } catch {\n /* ignore - private browsing / quota */\n }\n}\n\nfunction waitForSdkReady(timeoutMs: number): Promise<boolean> {\n return new Promise((resolve) => {\n if (typeof window === 'undefined') {\n resolve(false);\n return;\n }\n if (window.ReachyMini) {\n resolve(true);\n return;\n }\n let settled = false;\n const onReady = (): void => {\n if (settled) return;\n settled = true;\n window.removeEventListener('reachymini:ready', onReady);\n window.clearTimeout(timer);\n resolve(Boolean(window.ReachyMini));\n };\n const timer = window.setTimeout(() => {\n if (settled) return;\n settled = true;\n window.removeEventListener('reachymini:ready', onReady);\n resolve(false);\n }, timeoutMs);\n window.addEventListener('reachymini:ready', onReady);\n });\n}\n\nfunction postToHost(msg: EmbedToHostMsg): void {\n if (typeof window === 'undefined') return;\n // In Mode B (mobile, no iframe), `window.parent === window`,\n // so this is a self-message that nobody listens to. That's\n // fine - the call is a noop on Mode B.\n try {\n window.parent.postMessage(msg, window.location.origin);\n } catch (err) {\n console.warn('[@reachy-mini/host/embed] postMessage to host failed', err);\n }\n}\n\nfunction pushAppState(\n phase: AppPhase,\n connectingStep: AppConnectingStep | null,\n message: string | null = null,\n): void {\n postToHost({\n source: PROTOCOL_SOURCE,\n type: 'embed:app-state',\n version: PROTOCOL_VERSION,\n phase,\n connectingStep,\n message,\n });\n}\n\n/**\n * Dev-only diagnostic channel. Forwards a tag + payload to the host\n * so the parent's console (visible to devtools and the Cursor MCP\n * browser) shows the embed's boot progression. The host's\n * `ReachyHostShell` listens for `embed:debug` and `console.info`s\n * the payload.\n */\nfunction postDebug(tag: string, payload: Record<string, unknown> = {}): void {\n if (typeof window === 'undefined') return;\n try {\n window.parent.postMessage(\n {\n source: PROTOCOL_SOURCE,\n type: 'embed:debug',\n version: PROTOCOL_VERSION,\n tag,\n payload,\n },\n window.location.origin,\n );\n } catch {\n /* ignore */\n }\n try {\n let asJson = '';\n try {\n asJson = JSON.stringify(payload);\n } catch {\n asJson = '<unserializable>';\n }\n console.info(`[embed-debug] ${tag} ${asJson}`);\n } catch {\n /* ignore */\n }\n}\n\n/**\n * One-shot SDK probe used while we hunt the \"stuck at session\" bug.\n * Subscribes to every internal event the SDK is known to emit and\n * forwards them to the host via `embed:debug`. No-op in production\n * once the bug is fixed.\n */\nfunction installSdkProbe(sdk: ReachyMiniInstance): void {\n const events = [\n 'connected',\n 'disconnected',\n 'streaming',\n 'sessionStopped',\n 'sessionRejected',\n 'robotsChanged',\n 'error',\n 'state',\n 'log',\n 'message',\n ];\n for (const ev of events) {\n try {\n (sdk as unknown as {\n addEventListener: (n: string, cb: (e: unknown) => void) => void;\n }).addEventListener(ev, (e: unknown) => {\n let detail: Record<string, unknown> = {};\n const evObj = e as { detail?: unknown };\n if (evObj && typeof evObj === 'object' && 'detail' in evObj) {\n try {\n detail = JSON.parse(JSON.stringify(evObj.detail ?? null));\n } catch {\n detail = { _unserializable: true };\n }\n }\n postDebug(`sdk:${ev}`, detail);\n });\n } catch {\n /* ignore */\n }\n }\n // Wrap _handleSignalingMessage so we see every payload central\n // delivers via SSE (peer offers, ICE candidates, sessionRejected,\n // etc.). If we never see a `peer` message of kind `sdp/offer`\n // here, central is dropping the offer or routing it to a stale\n // peer.\n try {\n const sdkAny = sdk as unknown as {\n _handleSignalingMessage?: (msg: unknown) => unknown;\n };\n const orig = sdkAny._handleSignalingMessage;\n if (typeof orig === 'function') {\n const sendOrig = (sdkAny as Record<string, unknown>)._sendToServer as\n | ((this: unknown, payload: unknown) => Promise<unknown>)\n | undefined;\n if (typeof sendOrig === 'function') {\n (sdkAny as Record<string, unknown>)._sendToServer =\n async function patchedSend(this: unknown, payload: unknown) {\n const p = payload as Record<string, unknown>;\n const dbg: Record<string, unknown> = { type: p?.type ?? '?' };\n if (p && 'peerId' in p) dbg.peerId = String(p.peerId);\n if (p && 'sessionId' in p) dbg.sessionId = String(p.sessionId);\n if (p && 'sdp' in p) {\n const sdp = p.sdp as { type?: string; sdp?: string } | undefined;\n dbg.sdpType = sdp?.type ?? '?';\n dbg.sdpLen = sdp?.sdp?.length ?? 0;\n }\n if (p && 'ice' in p) {\n const ice = p.ice as { candidate?: string } | undefined;\n dbg.iceCand =\n (ice?.candidate ?? '').slice(0, 60) || '<end-of-candidates>';\n }\n postDebug('sdk:send', dbg);\n try {\n const res = await sendOrig.call(this, payload);\n const rj = res as Record<string, unknown> | undefined;\n postDebug('sdk:send:res', {\n inFor: dbg.type,\n resType: rj?.type ?? null,\n keys: rj ? Object.keys(rj) : [],\n });\n return res;\n } catch (err) {\n postDebug('sdk:send:err', {\n inFor: dbg.type,\n msg: (err as Error)?.message ?? String(err),\n });\n throw err;\n }\n };\n }\n sdkAny._handleSignalingMessage = function patched(msg: unknown) {\n const m = msg as Record<string, unknown>;\n const payload: Record<string, unknown> = { type: m?.type ?? '?' };\n if ('sessionId' in m) payload.sessionId = String(m.sessionId);\n if ('peerId' in m) payload.peerId = String(m.peerId);\n if ('sdp' in m) {\n const sdp = m.sdp as { type?: string; sdp?: string } | undefined;\n payload.sdpType = sdp?.type ?? '?';\n payload.sdpLen = sdp?.sdp?.length ?? 0;\n }\n if ('ice' in m) {\n const ice = m.ice as { candidate?: string } | undefined;\n payload.iceCand =\n (ice?.candidate ?? '').slice(0, 60) || '<end-of-candidates>';\n }\n if ('reason' in m) payload.reason = String(m.reason);\n postDebug('sdk:sse', payload);\n return orig.call(this, msg);\n };\n }\n } catch {\n /* ignore */\n }\n const probeStart = Date.now();\n const interval = window.setInterval(() => {\n const sdkAny = sdk as unknown as {\n _pc?: RTCPeerConnection;\n _dc?: RTCDataChannel;\n _sessionId?: string;\n _peerId?: string;\n _state?: string;\n _sseAbortController?: { signal?: { aborted?: boolean } };\n };\n const pc = sdkAny._pc;\n const dc = sdkAny._dc;\n postDebug('sdk:probe', {\n elapsedMs: Date.now() - probeStart,\n myPeerId: sdkAny._peerId ?? null,\n state: sdkAny._state ?? null,\n sseAborted: sdkAny._sseAbortController?.signal?.aborted ?? null,\n pcState: pc?.connectionState ?? null,\n iceState: pc?.iceConnectionState ?? null,\n iceGather: pc?.iceGatheringState ?? null,\n signalingState: pc?.signalingState ?? null,\n dcState: dc?.readyState ?? null,\n sessionId: sdkAny._sessionId ?? null,\n });\n if (Date.now() - probeStart > 30_000) window.clearInterval(interval);\n }, 1500);\n}\n"],"names":["SDK_READY_TIMEOUT_MS","HOST_INIT_TIMEOUT_MS","TOKEN_TTL_MS","bootPromise","connectToHost","options","bootOnce","expectedOrigin","creds","decodeCredsFromHash","wipeUrlHash","waitForSdkReady","seedSessionToken","sdk","bridge","createBridge","postToHost","PROTOCOL_SOURCE","PROTOCOL_VERSION","live","pushAppState","postDebug","installSdkProbe","err","liveStateFromCreds","liveStateFromInit","msg","leaveListeners","themeListeners","configListeners","current","leaveTriggered","started","onMessage","dispatchMessage","cb","runLeaveOnce","event","isProtocolMessage","timeoutMs","fallbackCreds","resolve","initListener","data","timer","onPageHide","wrapped","c","state","message","opts","cleanUrl","token","userName","settled","onReady","phase","connectingStep","tag","payload","asJson","events","ev","e","detail","evObj","sdkAny","orig","sendOrig","p","dbg","sdp","ice","res","rj","m","probeStart","interval","pc","dc"],"mappings":";AAqDA,MAAMA,IAAuB,KACvBC,IAAuB,KACvBC,IAAe,MAAU;AAuD/B,IAAIC,IAAwD;AAI5D,eAAsBC,EACpBC,IAAgC,IACG;AACnC,SAAKF,MACHA,IAAcG,EAASD,CAAO,IAExB,MAAMF;AAChB;AAIA,eAAeG,EACbD,GACmC;AACnC,QAAME,IAAiBF,EAAQ,kBAAkB,OAAO,SAAS,QAG3DG,IAAQC,EAAoB,OAAO,SAAS,IAAI;AAGtD,MAFAC,EAAA,GAEI,CAACF;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAOJ,MAAI,CADa,MAA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ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
vendor/reachy-mini-host/dist/chunks/mountHost-9Zrr6zPn.js.map
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
vendor/reachy-mini-host/dist/chunks/{protocol-BHyPqHVt.js β protocol-5pluLXHg.js}
RENAMED
|
@@ -1,31 +1,48 @@
|
|
| 1 |
-
const
|
| 2 |
-
function
|
| 3 |
if (!e || typeof e != "object") return !1;
|
| 4 |
const n = e;
|
| 5 |
return n.source === s && typeof n.type == "string" && n.version === 1;
|
| 6 |
}
|
| 7 |
-
function
|
| 8 |
-
const n = JSON.stringify(e), o =
|
| 9 |
return `creds=${encodeURIComponent(o)}`;
|
| 10 |
}
|
| 11 |
-
function
|
| 12 |
if (!e) return null;
|
| 13 |
const n = e.startsWith("#") ? e.slice(1) : e;
|
| 14 |
for (const o of n.split("&"))
|
| 15 |
if (o.startsWith("creds="))
|
| 16 |
try {
|
| 17 |
-
const t = decodeURIComponent(o.slice(6)), r =
|
| 18 |
return JSON.parse(r);
|
| 19 |
} catch (t) {
|
| 20 |
return console.warn("[@reachy-mini/host] failed to decode creds hash", t), null;
|
| 21 |
}
|
| 22 |
return null;
|
| 23 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
export {
|
| 25 |
s as P,
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
i
|
| 30 |
};
|
| 31 |
-
//# sourceMappingURL=protocol-
|
|
|
|
| 1 |
+
const f = 1, s = "reachy-mini";
|
| 2 |
+
function d(e) {
|
| 3 |
if (!e || typeof e != "object") return !1;
|
| 4 |
const n = e;
|
| 5 |
return n.source === s && typeof n.type == "string" && n.version === 1;
|
| 6 |
}
|
| 7 |
+
function a(e) {
|
| 8 |
+
const n = JSON.stringify(e), o = c(n);
|
| 9 |
return `creds=${encodeURIComponent(o)}`;
|
| 10 |
}
|
| 11 |
+
function u(e) {
|
| 12 |
if (!e) return null;
|
| 13 |
const n = e.startsWith("#") ? e.slice(1) : e;
|
| 14 |
for (const o of n.split("&"))
|
| 15 |
if (o.startsWith("creds="))
|
| 16 |
try {
|
| 17 |
+
const t = decodeURIComponent(o.slice(6)), r = i(t);
|
| 18 |
return JSON.parse(r);
|
| 19 |
} catch (t) {
|
| 20 |
return console.warn("[@reachy-mini/host] failed to decode creds hash", t), null;
|
| 21 |
}
|
| 22 |
return null;
|
| 23 |
}
|
| 24 |
+
function c(e) {
|
| 25 |
+
if (typeof window < "u" && typeof window.btoa == "function") {
|
| 26 |
+
const n = new TextEncoder().encode(e);
|
| 27 |
+
let o = "";
|
| 28 |
+
for (const t of n) o += String.fromCharCode(t);
|
| 29 |
+
return window.btoa(o);
|
| 30 |
+
}
|
| 31 |
+
return Buffer.from(e, "utf8").toString("base64");
|
| 32 |
+
}
|
| 33 |
+
function i(e) {
|
| 34 |
+
if (typeof window < "u" && typeof window.atob == "function") {
|
| 35 |
+
const n = window.atob(e), o = new Uint8Array(n.length);
|
| 36 |
+
for (let t = 0; t < n.length; t++) o[t] = n.charCodeAt(t);
|
| 37 |
+
return new TextDecoder().decode(o);
|
| 38 |
+
}
|
| 39 |
+
return Buffer.from(e, "base64").toString("utf8");
|
| 40 |
+
}
|
| 41 |
export {
|
| 42 |
s as P,
|
| 43 |
+
f as a,
|
| 44 |
+
u as d,
|
| 45 |
+
a as e,
|
| 46 |
+
d as i
|
| 47 |
};
|
| 48 |
+
//# sourceMappingURL=protocol-5pluLXHg.js.map
|
vendor/reachy-mini-host/dist/chunks/protocol-5pluLXHg.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"protocol-5pluLXHg.js","sources":["../../src/lib/protocol.ts"],"sourcesContent":["/**\n * postMessage protocol v1 between `@reachy-mini/host` (parent\n * window) and an embedded Reachy Mini app (iframe).\n *\n * Canonical reference: SPEC.md Β§6.\n *\n * Contract identity\n * βββββββββββββββββ\n * - Every message carries `version: 1`. Bumping that integer is\n * the ONLY way to introduce a breaking change to the wire\n * protocol. Additive changes (new optional fields, new typed\n * messages) ship without a version bump.\n * - Every message carries `source: 'reachy-mini'`. Lets receivers\n * distinguish our envelopes from unrelated `postMessage` traffic\n * (DevTools, MUI portals, browser extensions, ...).\n * - Both sides validate `event.origin` against the expected origin\n * before trusting the payload. In our deployment (same-origin\n * iframe within an HF Space) the expected origin is\n * `event.origin === window.location.origin`.\n *\n * Message families\n * ββββββββββββββββ\n * 1. Lifecycle: boot / ready / leaving. Drive the visible state\n * of the host shell.\n * 2. State: `embed:app-state` lets the host render accurate\n * connection / wake-up overlays.\n * 3. Config & theme: opaque `config` payload + theme push.\n * 4. Error: `embed:error` for tear-down on app failure.\n *\n * Intentionally NOT in v1 (see SPEC Β§6 and Β§11):\n * - No `host:custom` / `embed:custom` free-form channel.\n * - No `embed:request-config-update` (apps don't push config).\n * - No heartbeat / ping-pong (backlog).\n */\n\n/** Protocol version. Bump on breaking changes. */\nexport const PROTOCOL_VERSION = 1;\n\n/** Source tag attached to every envelope. */\nexport const PROTOCOL_SOURCE = 'reachy-mini' as const;\n\n/** Theme mode the host applies to the embedded app. */\nexport type ThemeMode = 'dark' | 'light';\n\n/**\n * Connection lifecycle, as observed by the embedded app. Drives\n * the host's `ConnectingView` stepper and visibility of the\n * iframe.\n *\n * boot : app loaded, no SDK action yet\n * connecting : ReachyMini.connect() / startSession() in flight\n * live : session up, motors awake, app interactive\n * leaving : `host:leaving` received, app tearing down\n * error : non-recoverable failure\n */\nexport type AppPhase = 'boot' | 'connecting' | 'live' | 'leaving' | 'error';\n\n/**\n * Fine-grained step inside `connecting`. Maps to the 3 dots in\n * `StepsProgressIndicator`:\n * - `link` : waiting for `host:init` / `connect()` in flight\n * - `session` : `startSession()` in flight\n * - `wake` : `ensureAwake()` in flight\n *\n * Apps that don't differentiate can omit this field; the host\n * treats it as `link`.\n */\nexport type AppConnectingStep = 'link' | 'session' | 'wake';\n\n/** Opaque app-specific payload routed through the host. */\nexport type ConfigPayload = unknown;\n\n/** Reason supplied with `host:leaving` for logging. */\nexport type LeavingReason =\n | 'user-action'\n | 'session-stopped'\n | 'error'\n | 'pagehide';\n\n/* βββββββββββββββββββ HOST β EMBED βββββββββββββββββββ */\n\n/**\n * First message sent by the host once the iframe has shouted\n * `embed:ready`. Carries the credentials + initial state the app\n * needs to bring a session up.\n *\n * Same-origin iframe: the SDK CDN script is imported with a\n * relative URL from `index.html`. We still pass `signalingUrl`\n * here so the host can swap centrals (staging / self-hosted)\n * without a rebuild of the app.\n */\nexport interface HostInitMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'host:init';\n version: 1;\n theme: ThemeMode;\n signalingUrl: string;\n /** HF OAuth bearer token. Optional for apps that don't need to\n * authenticate (rare). */\n hfToken?: string;\n /** HF account user name, when known. */\n userName?: string | null;\n /** Robot ID selected by the host's picker. */\n robotPeerId: string;\n /** Optional opaque payload from `?config=<base64>` or from the\n * mobile-app handoff. App is responsible for parsing /\n * validating. */\n config: ConfigPayload;\n /** Host display name (e.g. \"Reachy Mini\") - useful for the\n * embed if it wants to surface \"Connected via β¦\" copy. */\n hostName: string;\n /** Embedded app's display name (passed by the dispatcher). */\n appName: string;\n}\n\n/** Theme changed live (user toggled OS palette, host UI switched). */\nexport interface HostThemeChangedMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'host:theme-changed';\n version: 1;\n theme: ThemeMode;\n}\n\n/** Config updated live without an iframe reload. */\nexport interface HostConfigChangedMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'host:config-changed';\n version: 1;\n config: ConfigPayload;\n}\n\n/**\n * Host is asking the app to wind down cleanly. The app SHOULD:\n * 1. Stop emitting motion commands.\n * 2. Disconnect any non-SDK resources (timers, listeners).\n * 3. Resolve every registered `onLeave` callback before the\n * `timeoutMs` deadline; otherwise the host force-unmounts\n * the iframe.\n *\n * The host does NOT expect an explicit `leave-ack`; resolving\n * `onLeave` callbacks within the deadline is sufficient.\n */\nexport interface HostLeavingMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'host:leaving';\n version: 1;\n reason: LeavingReason;\n /** Soft deadline in ms. After this the host unmounts the iframe\n * regardless. */\n timeoutMs: number;\n}\n\nexport type HostToEmbedMsg =\n | HostInitMsg\n | HostThemeChangedMsg\n | HostConfigChangedMsg\n | HostLeavingMsg;\n\n/* βββββββββββββββββββ EMBED β HOST βββββββββββββββββββ */\n\n/**\n * Emitted by the app as early as possible (synchronous tick of\n * the embed entry, before the SDK is touched). Tells the host\n * the iframe is alive and ready to receive `host:init`. The host\n * MUST NOT send `host:init` before seeing this.\n */\nexport interface EmbedReadyMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'embed:ready';\n version: 1;\n}\n\n/**\n * App-level connection state. The host renders its\n * `ConnectingView` overlay over the (still-mounted) iframe until\n * it sees `phase === 'live'`. Apps SHOULD emit this on every\n * transition; the host caches the last value and won't re-render\n * unless something changes.\n */\nexport interface EmbedAppStateMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'embed:app-state';\n version: 1;\n phase: AppPhase;\n /** Sub-step inside `connecting`. Ignored for other phases. */\n connectingStep?: AppConnectingStep | null;\n /** Optional human-readable hint shown in the overlay caption. */\n message?: string | null;\n}\n\n/** App requests to leave (user clicked an in-app exit, error,\n * ...). The host runs the same tear-down as a top-bar\n * \"End session\". */\nexport interface EmbedRequestLeaveMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'embed:request-leave';\n version: 1;\n}\n\n/** App-level error report. `fatal: true` switches the host to\n * ErrorView; `fatal: false` is logged and may surface a toast. */\nexport interface EmbedErrorMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'embed:error';\n version: 1;\n message: string;\n fatal: boolean;\n detail?: unknown;\n}\n\nexport type EmbedToHostMsg =\n | EmbedReadyMsg\n | EmbedAppStateMsg\n | EmbedRequestLeaveMsg\n | EmbedErrorMsg;\n\n/* βββββββββββββββββββ CREDS BUNDLE βββββββββββββββββββ */\n\n/**\n * Serialised credentials passed from the host (Mode A) or the\n * mobile app (Mode B) to the embed via the URL hash fragment.\n *\n * Hash-only (never URL search): browsers don't send the hash to\n * any server, so the HF token never appears in access logs,\n * referer headers, or HF Spaces frontend logs.\n *\n * The embed wipes the hash with `history.replaceState` on its\n * first synchronous tick, before any `await`, then proceeds with\n * the rest of the boot using the in-memory bundle.\n */\nexport interface CredsBundle {\n hfToken?: string | null;\n userName?: string | null;\n robotPeerId: string;\n signalingUrl: string;\n theme: ThemeMode;\n config: ConfigPayload;\n hostName: string;\n appName: string;\n}\n\n/* βββββββββββββββββββ HELPERS βββββββββββββββββββ */\n\n/**\n * Cheap discriminator: does this `unknown` look like a v1\n * envelope from our protocol? Receivers call this before\n * narrowing on `type`. Conservative on the version: an unknown\n * version is treated as \"not our protocol\" so the receiver\n * silently ignores it (forward-compat for a future v2 peer).\n */\nexport function isProtocolMessage(\n value: unknown,\n): value is { source: typeof PROTOCOL_SOURCE; type: string; version: number } {\n if (!value || typeof value !== 'object') return false;\n const record = value as Record<string, unknown>;\n return (\n record.source === PROTOCOL_SOURCE &&\n typeof record.type === 'string' &&\n record.version === PROTOCOL_VERSION\n );\n}\n\n/**\n * Encode a creds bundle to the URL hash fragment.\n * URL-safe base64 wrapper around JSON to avoid percent-encoding\n * noise.\n */\nexport function encodeCredsToHash(bundle: CredsBundle): string {\n const json = JSON.stringify(bundle);\n const b64 = encodeBase64Utf8(json);\n return `creds=${encodeURIComponent(b64)}`;\n}\n\n/**\n * Decode the creds bundle from a URL hash fragment. Returns\n * `null` if no `creds=` segment is present or if the payload is\n * malformed (caller handles the error by rendering ErrorView).\n */\nexport function decodeCredsFromHash(hash: string | null): CredsBundle | null {\n if (!hash) return null;\n const raw = hash.startsWith('#') ? hash.slice(1) : hash;\n for (const segment of raw.split('&')) {\n if (!segment.startsWith('creds=')) continue;\n try {\n const b64 = decodeURIComponent(segment.slice('creds='.length));\n const json = decodeBase64Utf8(b64);\n return JSON.parse(json) as CredsBundle;\n } catch (err) {\n console.warn('[@reachy-mini/host] failed to decode creds hash', err);\n return null;\n }\n }\n return null;\n}\n\n/* UTF-8 safe base64 helpers (btoa / atob choke on non-Latin\n * characters in `config` payloads). Works in browsers and Node\n * (for unit tests). */\n\nfunction encodeBase64Utf8(input: string): string {\n if (typeof window !== 'undefined' && typeof window.btoa === 'function') {\n const bytes = new TextEncoder().encode(input);\n let bin = '';\n for (const b of bytes) bin += String.fromCharCode(b);\n return window.btoa(bin);\n }\n // Node fallback (tests / SSR).\n return Buffer.from(input, 'utf8').toString('base64');\n}\n\nfunction decodeBase64Utf8(input: string): string {\n if (typeof window !== 'undefined' && typeof window.atob === 'function') {\n const bin = window.atob(input);\n const bytes = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);\n return new TextDecoder().decode(bytes);\n }\n return Buffer.from(input, 'base64').toString('utf8');\n}\n"],"names":["PROTOCOL_VERSION","PROTOCOL_SOURCE","isProtocolMessage","value","record","encodeCredsToHash","bundle","json","b64","encodeBase64Utf8","decodeCredsFromHash","hash","raw","segment","decodeBase64Utf8","err","input","bytes","bin","b","i"],"mappings":"AAoCO,MAAMA,IAAmB,GAGnBC,IAAkB;AAmNxB,SAASC,EACdC,GAC4E;AAC5E,MAAI,CAACA,KAAS,OAAOA,KAAU,SAAU,QAAO;AAChD,QAAMC,IAASD;AACf,SACEC,EAAO,WAAWH,KAClB,OAAOG,EAAO,QAAS,YACvBA,EAAO,YAAY;AAEvB;AAOO,SAASC,EAAkBC,GAA6B;AAC7D,QAAMC,IAAO,KAAK,UAAUD,CAAM,GAC5BE,IAAMC,EAAiBF,CAAI;AACjC,SAAO,SAAS,mBAAmBC,CAAG,CAAC;AACzC;AAOO,SAASE,EAAoBC,GAAyC;AAC3E,MAAI,CAACA,EAAM,QAAO;AAClB,QAAMC,IAAMD,EAAK,WAAW,GAAG,IAAIA,EAAK,MAAM,CAAC,IAAIA;AACnD,aAAWE,KAAWD,EAAI,MAAM,GAAG;AACjC,QAAKC,EAAQ,WAAW,QAAQ;AAChC,UAAI;AACF,cAAML,IAAM,mBAAmBK,EAAQ,MAAM,CAAe,CAAC,GACvDN,IAAOO,EAAiBN,CAAG;AACjC,eAAO,KAAK,MAAMD,CAAI;AAAA,MACxB,SAASQ,GAAK;AACZ,uBAAQ,KAAK,mDAAmDA,CAAG,GAC5D;AAAA,MACT;AAEF,SAAO;AACT;AAMA,SAASN,EAAiBO,GAAuB;AAC/C,MAAI,OAAO,SAAW,OAAe,OAAO,OAAO,QAAS,YAAY;AACtE,UAAMC,IAAQ,IAAI,cAAc,OAAOD,CAAK;AAC5C,QAAIE,IAAM;AACV,eAAWC,KAAKF,EAAO,CAAAC,KAAO,OAAO,aAAaC,CAAC;AACnD,WAAO,OAAO,KAAKD,CAAG;AAAA,EACxB;AAEA,SAAO,OAAO,KAAKF,GAAO,MAAM,EAAE,SAAS,QAAQ;AACrD;AAEA,SAASF,EAAiBE,GAAuB;AAC/C,MAAI,OAAO,SAAW,OAAe,OAAO,OAAO,QAAS,YAAY;AACtE,UAAME,IAAM,OAAO,KAAKF,CAAK,GACvBC,IAAQ,IAAI,WAAWC,EAAI,MAAM;AACvC,aAASE,IAAI,GAAGA,IAAIF,EAAI,QAAQE,IAAK,CAAAH,EAAMG,CAAC,IAAIF,EAAI,WAAWE,CAAC;AAChE,WAAO,IAAI,YAAA,EAAc,OAAOH,CAAK;AAAA,EACvC;AACA,SAAO,OAAO,KAAKD,GAAO,QAAQ,EAAE,SAAS,MAAM;AACrD;"}
|
vendor/reachy-mini-host/dist/chunks/protocol-BHyPqHVt.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"version":3,"file":"protocol-BHyPqHVt.js","sources":["../../src/lib/protocol.ts"],"sourcesContent":["/**\n * postMessage protocol v1 between `@reachy-mini/host` (parent window)\n * and an embedded Reachy Mini app (iframe).\n *\n * Contract identity\n * βββββββββββββββββ\n * - Every message carries `version: 1`. Bumping that integer is the\n * ONLY way to introduce a breaking change to the protocol.\n * - Every message carries `source: 'reachy-mini'`. Lets receivers\n * distinguish our envelopes from random other `postMessage`\n * traffic (devtools extensions, MUI portals, ...).\n * - Both sides validate `event.origin` against the expected origin\n * before trusting the payload. In our deployment (same-origin\n * iframe within an HF Space), the expected origin is\n * `event.origin === window.location.origin`.\n *\n * Three message families\n * ββββββββββββββββββββββ\n * 1. **Lifecycle** - boot / ready / leaving / unmount. Drive the\n * visible state of the host shell.\n * 2. **State** - `app:state` from the app, lets the host render\n * accurate connection / wake-up overlays.\n * 3. **Config & custom** - opaque enveloppe `unknown` carried\n * by `host:init` and `host:config-changed`, plus a free-form\n * `embed:custom` / `host:custom` channel for app-specific\n * bidi communication that doesn't deserve its own message.\n *\n * Config envelope\n * βββββββββββββββ\n * The `config` field is intentionally `unknown`. The host never\n * inspects it - it just relays the JSON it parsed from\n * `?config=<base64>` (or got from a `host:config-changed`) verbatim.\n *\n * Apps type their own config locally via `connectToHost<T>()`. Apps\n * MUST defensive-validate at the boundary; an attacker controlling\n * the URL can shape the config however they want.\n *\n * No payload size cap is enforced. We assume cooperative apps; if\n * abuse becomes a concern, a few KB ceiling on the parsed JSON\n * would be the natural defence.\n */\n\n/** Protocol version. Bump on breaking changes. */\nexport const PROTOCOL_VERSION = 1;\n\n/** Source tag attached to every envelope. */\nexport const PROTOCOL_SOURCE = 'reachy-mini' as const;\n\n/** Theme mode the host applies to the embedded app. */\nexport type ThemeMode = 'dark' | 'light';\n\n/**\n * Connection lifecycle, as observed by the embedded app. Drives the\n * host's `ConnectingView` stepper and visibility of the iframe.\n *\n * boot : app code loaded but no SDK action yet (window paint).\n * connecting : ReachyMini.connect() / startSession() in flight.\n * live : session is up, motors awake, app is interactive.\n * leaving : `host:leaving` received; app is tearing down.\n * error : non-recoverable failure; UX surfaces ErrorView.\n */\nexport type AppPhase = 'boot' | 'connecting' | 'live' | 'leaving' | 'error';\n\n/**\n * Fine-grained step inside `connecting`. Maps 1:1 to the 3 dots in\n * `StepsProgressIndicator`. Apps SHOULD emit `link` first (waiting\n * for `host:init`), `session` while `startSession()` is in flight,\n * and `wake` while motors are coming up. Apps that don't\n * differentiate can omit this field; the host treats it as `link`.\n */\nexport type AppConnectingStep = 'link' | 'session' | 'wake';\n\n/** Opaque app-specific payload routed through the host. */\nexport type ConfigPayload = unknown;\n\n/* βββββββββββββββββββ HOST β EMBED βββββββββββββββββββ */\n\n/**\n * First message sent by the host once the iframe has shouted\n * `embed:ready`. Carries the credentials + initial state the app\n * needs to bring a session up.\n *\n * Same-origin iframe β the SDK CDN script can be imported with a\n * relative URL from `index.html`. We still pass `signalingUrl`\n * here so the host can swap centrals (staging / self-hosted)\n * without a rebuild of the app.\n */\nexport interface HostInitMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'host:init';\n version: 1;\n /** Visual theme the host expects the app to render with. */\n theme: ThemeMode;\n /** Pollen central WebRTC signaling URL. */\n signalingUrl: string;\n /** HF OAuth bearer token (sessionStorage handoff). Optional\n * for apps that don't need to authenticate (e.g. they will\n * hit a daemon directly without going through the central). */\n hfToken?: string;\n /** HF account username, when known. Lets the embed show a\n * greeting without a separate whoami call. */\n username?: string | null;\n /** Robot ID selected by the host's picker. The embed's SDK\n * call goes straight to this robot - no further selection\n * prompt in the app. */\n robotPeerId: string;\n /** Optional opaque payload from `?config=<base64>` or from the\n * mobile-app handoff. App is responsible for parsing /\n * validating. */\n config: ConfigPayload;\n /** Host display name (e.g. \"Reachy Mini\") - useful for the embed\n * if it wants to surface \"Connected via οΏ½οΏ½οΏ½\" copy. */\n hostName: string;\n /** Embedded app's display name (passed by the index.html\n * dispatcher). Avoids the app having to know its own\n * identity at runtime. */\n appName: string;\n}\n\n/** Theme changed live (user toggled OS palette, host UI switched). */\nexport interface HostThemeChangedMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'host:theme-changed';\n version: 1;\n theme: ThemeMode;\n}\n\n/** Config updated live without an iframe reload. */\nexport interface HostConfigChangedMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'host:config-changed';\n version: 1;\n config: ConfigPayload;\n}\n\n/**\n * Host is asking the app to wind down cleanly. The app SHOULD:\n * 1. Stop emitting motion commands.\n * 2. Disconnect any non-SDK resources (timers, listeners).\n * 3. Send `embed:custom { channel: 'leave-ack' }` when done\n * (optional, host will unmount the iframe after `timeoutMs`\n * anyway).\n */\nexport interface HostLeavingMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'host:leaving';\n version: 1;\n /** Reason for the teardown, for logging. */\n reason: 'user-action' | 'session-stopped' | 'error' | 'pagehide';\n /** Soft deadline; after this the host will unmount the iframe\n * regardless of `leave-ack`. */\n timeoutMs: number;\n}\n\n/**\n * Free-form bidirectional channel. Use for app-specific commands\n * that don't deserve their own message type (e.g. \"mobile wants\n * the app to navigate to deep-link X\").\n */\nexport interface HostCustomMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'host:custom';\n version: 1;\n /** Logical channel name, e.g. 'mobile.deep-link'. */\n channel: string;\n payload: unknown;\n}\n\nexport type HostToEmbedMsg =\n | HostInitMsg\n | HostThemeChangedMsg\n | HostConfigChangedMsg\n | HostLeavingMsg\n | HostCustomMsg;\n\n/* βββββββββββββββββββ EMBED β HOST βββββββββββββββββββ */\n\n/**\n * Emitted by the app as early as possible (DOMContentLoaded, before\n * the SDK is touched). Tells the host the iframe is alive and ready\n * to receive `host:init`. The host MUST NOT send `host:init` before\n * seeing this.\n */\nexport interface EmbedReadyMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'embed:ready';\n version: 1;\n}\n\n/**\n * App-level connection state. The host renders its `ConnectingView`\n * overlay over the (still-mounted) iframe until it sees `phase ===\n * 'live'`, then fades the overlay out. Apps SHOULD emit this on\n * every transition; the host caches the last value and won't\n * re-render unless something changes.\n */\nexport interface EmbedAppStateMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'embed:app-state';\n version: 1;\n phase: AppPhase;\n /** Sub-step inside `connecting`. Ignored for other phases. */\n connectingStep?: AppConnectingStep | null;\n /** Optional human-readable hint (e.g. \"Reconnect attempt 2/3\").\n * Shown verbatim in the overlay caption when present. */\n message?: string | null;\n}\n\n/** App requests to leave (user clicked an in-app exit). The host\n * starts the same teardown sequence as a top-bar \"End session\". */\nexport interface EmbedRequestLeaveMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'embed:request-leave';\n version: 1;\n}\n\n/**\n * App pushes a config patch upstream. Useful when the user\n * customised something in-app and we want the next launch\n * (deep-link / mobile shortcut) to reflect it. The host forwards\n * this to whatever surface is interested (mobile bridge,\n * sessionStorage, ...). No round-trip ack.\n */\nexport interface EmbedRequestConfigUpdateMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'embed:request-config-update';\n version: 1;\n /** Merge-patch semantics: the host shallow-merges this onto its\n * cached config. Pass `null` to clear the config entirely. */\n config: ConfigPayload;\n}\n\n/** Fatal or recoverable error. Phase 'error' means fatal; phase\n * 'connecting' or 'live' means transient. The host logs and may\n * render a notice. */\nexport interface EmbedErrorMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'embed:error';\n version: 1;\n message: string;\n fatal: boolean;\n /** Free-form additional context. */\n detail?: unknown;\n}\n\n/** Free-form bidi channel (see HostCustomMsg). */\nexport interface EmbedCustomMsg {\n source: typeof PROTOCOL_SOURCE;\n type: 'embed:custom';\n version: 1;\n channel: string;\n payload: unknown;\n}\n\nexport type EmbedToHostMsg =\n | EmbedReadyMsg\n | EmbedAppStateMsg\n | EmbedRequestLeaveMsg\n | EmbedRequestConfigUpdateMsg\n | EmbedErrorMsg\n | EmbedCustomMsg;\n\n/* βββββββββββββββββββ HELPERS βββββββββββββββββββ */\n\n/**\n * Cheap discriminator: does this `unknown` look like a v1 envelope\n * from our protocol? Both ends call this before narrowing on\n * `type`.\n */\nexport function isProtocolMessage(value: unknown): value is { source: typeof PROTOCOL_SOURCE; type: string; version: number } {\n if (!value || typeof value !== 'object') return false;\n const record = value as Record<string, unknown>;\n return record.source === PROTOCOL_SOURCE && typeof record.type === 'string' && record.version === PROTOCOL_VERSION;\n}\n\n/**\n * Encode an arbitrary credentials/config blob into the URL hash\n * fragment so the iframe can read it synchronously (before the\n * postMessage handshake completes). URL-safe base64 to avoid\n * percent-encoding noise.\n *\n * NOTE: the hash is never sent to the server by the browser, so\n * this is fine for short-lived bearer tokens. For multi-page apps\n * we'd switch to a real session cookie.\n */\nexport interface CredsBundle {\n hfToken?: string | null;\n username?: string | null;\n robotPeerId: string;\n signalingUrl: string;\n theme: ThemeMode;\n config: ConfigPayload;\n hostName: string;\n appName: string;\n}\n\nexport function encodeCredsToHash(bundle: CredsBundle): string {\n const json = JSON.stringify(bundle);\n const b64 = typeof window !== 'undefined'\n ? window.btoa(unescape(encodeURIComponent(json)))\n : Buffer.from(json, 'utf8').toString('base64');\n return `creds=${encodeURIComponent(b64)}`;\n}\n\nexport function decodeCredsFromHash(hash: string | null): CredsBundle | null {\n if (!hash) return null;\n const raw = hash.startsWith('#') ? hash.slice(1) : hash;\n for (const segment of raw.split('&')) {\n if (!segment.startsWith('creds=')) continue;\n try {\n const b64 = decodeURIComponent(segment.slice('creds='.length));\n const json = typeof window !== 'undefined'\n ? decodeURIComponent(escape(window.atob(b64)))\n : Buffer.from(b64, 'base64').toString('utf8');\n return JSON.parse(json) as CredsBundle;\n } catch (err) {\n console.warn('[@reachy-mini/host] failed to decode creds hash', err);\n return null;\n }\n }\n return null;\n}\n"],"names":["PROTOCOL_VERSION","PROTOCOL_SOURCE","isProtocolMessage","value","record","encodeCredsToHash","bundle","json","b64","decodeCredsFromHash","hash","raw","segment","err"],"mappings":"AA2CO,MAAMA,IAAmB,GAGnBC,IAAkB;AA+NxB,SAASC,EAAkBC,GAA4F;AAC5H,MAAI,CAACA,KAAS,OAAOA,KAAU,SAAU,QAAO;AAChD,QAAMC,IAASD;AACf,SAAOC,EAAO,WAAWH,KAAmB,OAAOG,EAAO,QAAS,YAAYA,EAAO,YAAY;AACpG;AAuBO,SAASC,EAAkBC,GAA6B;AAC7D,QAAMC,IAAO,KAAK,UAAUD,CAAM,GAC5BE,IAAM,OAAO,SAAW,MAC1B,OAAO,KAAK,SAAS,mBAAmBD,CAAI,CAAC,CAAC,IAC9C,OAAO,KAAKA,GAAM,MAAM,EAAE,SAAS,QAAQ;AAC/C,SAAO,SAAS,mBAAmBC,CAAG,CAAC;AACzC;AAEO,SAASC,EAAoBC,GAAyC;AAC3E,MAAI,CAACA,EAAM,QAAO;AAClB,QAAMC,IAAMD,EAAK,WAAW,GAAG,IAAIA,EAAK,MAAM,CAAC,IAAIA;AACnD,aAAWE,KAAWD,EAAI,MAAM,GAAG;AACjC,QAAKC,EAAQ,WAAW,QAAQ;AAChC,UAAI;AACF,cAAMJ,IAAM,mBAAmBI,EAAQ,MAAM,CAAe,CAAC,GACvDL,IAAO,OAAO,SAAW,MAC3B,mBAAmB,OAAO,OAAO,KAAKC,CAAG,CAAC,CAAC,IAC3C,OAAO,KAAKA,GAAK,QAAQ,EAAE,SAAS,MAAM;AAC9C,eAAO,KAAK,MAAMD,CAAI;AAAA,MACxB,SAASM,GAAK;AACZ,uBAAQ,KAAK,mDAAmDA,CAAG,GAC5D;AAAA,MACT;AAEF,SAAO;AACT;"}
|
|
|
|
|
|
vendor/reachy-mini-host/dist/components/AppFrame.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
| 1 |
-
import { type AppConnectingStep, type AppPhase, type ConfigPayload, type ThemeMode } from '../lib/protocol';
|
| 2 |
-
export interface AppFrameProps {
|
| 3 |
-
/** Base URL of the embedded app's HTML (typically
|
| 4 |
-
* `window.location.origin + window.location.pathname`). The
|
| 5 |
-
* bridge appends `?embed=1` + the creds hash. */
|
| 6 |
-
appUrl: string;
|
| 7 |
-
/** App display name - threaded through `host:init` and shown
|
| 8 |
-
* while the overlay is up. */
|
| 9 |
-
appName: string;
|
| 10 |
-
/** Host display name - threaded through `host:init`. */
|
| 11 |
-
hostName: string;
|
| 12 |
-
hfToken?: string | null;
|
| 13 |
-
username?: string | null;
|
| 14 |
-
robotPeerId: string;
|
| 15 |
-
signalingUrl: string;
|
| 16 |
-
theme: ThemeMode;
|
| 17 |
-
config: ConfigPayload;
|
| 18 |
-
/** Forwarded to ConnectingView when the embed hasn't yet
|
| 19 |
-
* reported its own phase. */
|
| 20 |
-
fallbackPhase?: AppPhase | null;
|
| 21 |
-
/** Forwarded to ConnectingView when the embed hasn't yet
|
| 22 |
-
* reported its own connecting sub-step. */
|
| 23 |
-
fallbackConnectingStep?: AppConnectingStep | null;
|
| 24 |
-
/** Called when the embed asks to leave (e.g. an in-app exit
|
| 25 |
-
* button posted `embed:request-leave`). The host shell wires
|
| 26 |
-
* this to its own `endSession()` flow. */
|
| 27 |
-
onRequestLeave?(): void;
|
| 28 |
-
/** Called when the embed reports an error. */
|
| 29 |
-
onEmbedError?(message: string, fatal: boolean, detail?: unknown): void;
|
| 30 |
-
/** Called when the embed pushes a config patch upstream. */
|
| 31 |
-
onConfigPatch?(patch: ConfigPayload): void;
|
| 32 |
-
/** Mirror of the embed's `phase === 'live'` flag. Bumped each
|
| 33 |
-
* time `embed:app-state` arrives. */
|
| 34 |
-
onEmbedLive?(live: boolean): void;
|
| 35 |
-
/** Mirror of the embed's awake flag (TODO: requires the embed to
|
| 36 |
-
* surface `motorStateChanged` through a dedicated custom channel;
|
| 37 |
-
* for now this is best-effort and may stay false). */
|
| 38 |
-
onEmbedAwake?(awake: boolean): void;
|
| 39 |
-
/** Called for any `embed:custom` channel - the host shell can
|
| 40 |
-
* forward to its surrounding environment (e.g. the mobile
|
| 41 |
-
* WebView's JS bridge). */
|
| 42 |
-
onCustom?(channel: string, payload: unknown): void;
|
| 43 |
-
/** Imperative ref the parent can use to push `host:leaving`
|
| 44 |
-
* or arbitrary `host:custom` messages. */
|
| 45 |
-
bridgeApiRef?: React.MutableRefObject<{
|
| 46 |
-
sendLeaving(reason: 'user-action' | 'session-stopped' | 'error' | 'pagehide', timeoutMs?: number): Promise<void>;
|
| 47 |
-
sendCustom(channel: string, payload: unknown): void;
|
| 48 |
-
} | null>;
|
| 49 |
-
}
|
| 50 |
-
export default function AppFrame({ appUrl, appName, hostName, hfToken, username, robotPeerId, signalingUrl, theme, config, fallbackPhase, fallbackConnectingStep, onRequestLeave, onEmbedError, onConfigPatch, onCustom, onEmbedLive, onEmbedAwake, bridgeApiRef, }: AppFrameProps): import("react/jsx-runtime").JSX.Element;
|
| 51 |
-
//# sourceMappingURL=AppFrame.d.ts.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/reachy-mini-host/dist/components/AppFrame.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"version":3,"file":"AppFrame.d.ts","sourceRoot":"","sources":["../../src/components/AppFrame.tsx"],"names":[],"mappings":"AAqBA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,SAAS,EAEf,MAAM,iBAAiB,CAAC;AAIzB,MAAM,WAAW,aAAa;IAC5B;;sDAEkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf;mCAC+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,W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B,EACpB,sBAA6B,EAC7B,cAAc,EACd,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,YAAY,GACb,EAAE,aAAa,2CA4Hf"}
|
|
|
|
|
|
vendor/reachy-mini-host/dist/components/CenteredViewport.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
| 1 |
-
/**
|
| 2 |
-
* Centered viewport shell.
|
| 3 |
-
*
|
| 4 |
-
* Standard layout used by every pre-session / one-shot screen in
|
| 5 |
-
* this app (sign-in, robot picker, error, boot, ...). It fills the
|
| 6 |
-
* available height under the `<TopBar>` and centers its children
|
| 7 |
-
* both axes within a max-width column.
|
| 8 |
-
*
|
| 9 |
-
* ββββββββββββββββββββββββββ
|
| 10 |
-
* β TopBar β
|
| 11 |
-
* ββββββββββββββββββββββββββ€
|
| 12 |
-
* β β
|
| 13 |
-
* β β margin: auto top
|
| 14 |
-
* β ββββββββββββββββ β
|
| 15 |
-
* β β β β
|
| 16 |
-
* β β <content> β β max-width column
|
| 17 |
-
* β β β β
|
| 18 |
-
* β ββββββββββββββββ β
|
| 19 |
-
* β β margin: auto bottom
|
| 20 |
-
* β β
|
| 21 |
-
* ββββββββββββββββββββββββββ
|
| 22 |
-
*
|
| 23 |
-
* Why `margin: auto` instead of `align-items: center`
|
| 24 |
-
* ββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 25 |
-
* `align-items: center` on a flex container centers the child
|
| 26 |
-
* vertically when the child is smaller than the parent, BUT when
|
| 27 |
-
* the child is taller, the centering pushes its TOP edge *above*
|
| 28 |
-
* the scroll viewport, making it unreachable. `margin: auto` on
|
| 29 |
-
* the child has the same centering effect when there's free
|
| 30 |
-
* space, and naturally collapses to a top-aligned scroll when
|
| 31 |
-
* the content exceeds the parent's height. That's the right
|
| 32 |
-
* fallback for short phones where the local-dev setup card or a
|
| 33 |
-
* long error message would otherwise become inaccessible.
|
| 34 |
-
*
|
| 35 |
-
* Composition contract
|
| 36 |
-
* ββββββββββββββββββββ
|
| 37 |
-
* - The component is layout-only: it does NOT impose alignment,
|
| 38 |
-
* spacing, or text-align on the children. Wrap them in a
|
| 39 |
-
* `<Stack>` / `<Box textAlign="center">` if you want a centered
|
| 40 |
-
* single-column form (sign-in style), or in a plain `<Stack>`
|
| 41 |
-
* if you want stretched cards (robot picker style).
|
| 42 |
-
* - `maxWidth` defaults to 420 px (single-touch-target form
|
| 43 |
-
* column). Bump it for grids or wider lists at the call site.
|
| 44 |
-
* - The parent should be a flex column with `flex: 1 / minHeight:
|
| 45 |
-
* 0` (e.g. the `<main>` slot in `App.tsx`) so this component
|
| 46 |
-
* can stretch to fill the remaining height under the TopBar.
|
| 47 |
-
*/
|
| 48 |
-
import type { ReactNode } from 'react';
|
| 49 |
-
import type { BoxProps } from '@mui/material';
|
| 50 |
-
export interface CenteredViewportProps {
|
| 51 |
-
children: ReactNode;
|
| 52 |
-
/** Maximum width of the content column. Defaults to 420 px to
|
| 53 |
-
* match a single-touch-target form column. */
|
| 54 |
-
maxWidth?: number;
|
| 55 |
-
/**
|
| 56 |
-
* Optional `sx` overrides forwarded to the inner content box -
|
| 57 |
-
* use this to add padding tweaks or per-screen background
|
| 58 |
-
* accents without subclassing the component.
|
| 59 |
-
*/
|
| 60 |
-
contentSx?: BoxProps['sx'];
|
| 61 |
-
}
|
| 62 |
-
export default function CenteredViewport({ children, maxWidth, contentSx, }: CenteredViewportProps): import("react/jsx-runtime").JSX.Element;
|
| 63 |
-
//# sourceMappingURL=CenteredViewport.d.ts.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/reachy-mini-host/dist/components/CenteredViewport.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"version":3,"file":"CenteredViewport.d.ts","sourceRoot":"","sources":["../../src/components/CenteredViewport.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB;mDAC+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,QAAQ,EACR,QAAc,EACd,SAAS,GACV,EAAE,qBAAqB,2CA2CvB"}
|
|
|
|
|
|
vendor/reachy-mini-host/dist/components/ConnectingView.d.ts
CHANGED
|
@@ -1,31 +1,13 @@
|
|
| 1 |
-
import type {
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
*
|
| 8 |
-
*
|
| 9 |
-
* `null` means we haven't received any state yet (the iframe
|
| 10 |
-
* is still loading); we render the indicator at step 0 so the
|
| 11 |
-
* UI doesn't pop in late.
|
| 12 |
-
*/
|
| 13 |
-
phase: AppPhase | null;
|
| 14 |
-
/**
|
| 15 |
-
* Fine-grained sub-step inside `connecting`. Optional - apps
|
| 16 |
-
* that don't differentiate fall back to `link`. When the app
|
| 17 |
-
* reaches `live` but is still finishing its wake trajectory it
|
| 18 |
-
* MAY keep posting `wake` here; we treat that as "step 2,
|
| 19 |
-
* active" instead of "all done".
|
| 20 |
-
*/
|
| 21 |
-
connectingStep: AppConnectingStep | null;
|
| 22 |
-
/** Name of the app being loaded - shown when no useful state has
|
| 23 |
-
* arrived yet (the loading is dominated by the iframe boot). */
|
| 24 |
-
appName: string;
|
| 25 |
-
/** Optional human-readable hint from the app (e.g. retry attempt
|
| 26 |
-
* copy). Wins over the default caption when set. */
|
| 27 |
message?: string | null;
|
| 28 |
}
|
| 29 |
-
export
|
| 30 |
-
export
|
| 31 |
//# sourceMappingURL=ConnectingView.d.ts.map
|
|
|
|
| 1 |
+
import type { JSX } from 'react';
|
| 2 |
+
import type { AppConnectingStep } from '../lib/protocol';
|
| 3 |
+
export interface ConnectingViewProps {
|
| 4 |
+
/** Sub-step inside `connecting`. Maps to the 3-dot stepper. */
|
| 5 |
+
step: AppConnectingStep | null;
|
| 6 |
+
/** Optional caption override (apps can send one via
|
| 7 |
+
* `embed:app-state.message`). When provided it wins over the
|
| 8 |
+
* default per-step caption. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
message?: string | null;
|
| 10 |
}
|
| 11 |
+
export declare function ConnectingView({ step, message, }: ConnectingViewProps): JSX.Element;
|
| 12 |
+
export declare const CONNECTING_STEP_ORDER: AppConnectingStep[];
|
| 13 |
//# sourceMappingURL=ConnectingView.d.ts.map
|
vendor/reachy-mini-host/dist/components/ConnectingView.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"ConnectingView.d.ts","sourceRoot":"","sources":["../../src/components/ConnectingView.tsx"],"names":[],"mappings":"
|
|
|
|
| 1 |
+
{"version":3,"file":"ConnectingView.d.ts","sourceRoot":"","sources":["../../src/components/ConnectingView.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAIjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIzD,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC/B;;oCAEgC;IAChC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAiBD,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,OAAO,GACR,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CA6FnC;AAkED,eAAO,MAAM,qBAAqB,qBAAa,CAAC"}
|
vendor/reachy-mini-host/dist/components/EmbedFrame.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export interface EmbedFrameProps {
|
| 2 |
+
/** Same-origin URL of the embedded app's `index.html`.
|
| 3 |
+
* Defaults to `${origin}/?embed=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
|
vendor/reachy-mini-host/dist/components/EmbedFrame.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":3,"file":"EmbedFrame.d.ts","sourceRoot":"","sources":["../../src/components/EmbedFrame.tsx"],"names":[],"mappings":"AAgBA,MAAM,WAAW,eAAe;IAC9B;4CACwC;IACxC,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"}
|
vendor/reachy-mini-host/dist/components/ErrorView.d.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
}
|
| 13 |
-
export
|
| 14 |
-
export {};
|
| 15 |
//# sourceMappingURL=ErrorView.d.ts.map
|
|
|
|
| 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
|
vendor/reachy-mini-host/dist/components/ErrorView.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"ErrorView.d.ts","sourceRoot":"","sources":["../../src/components/ErrorView.tsx"],"names":[],"mappings":"
|
|
|
|
| 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"}
|
vendor/reachy-mini-host/dist/components/LeavingView.d.ts
CHANGED
|
@@ -1,2 +1,33 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
//# sourceMappingURL=LeavingView.d.ts.map
|
|
|
|
| 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
|
vendor/reachy-mini-host/dist/components/LeavingView.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"LeavingView.d.ts","sourceRoot":"","sources":["../../src/components/LeavingView.tsx"],"names":[],"mappings":"
|
|
|
|
| 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"}
|
vendor/reachy-mini-host/dist/components/PickerView.d.ts
ADDED
|
@@ -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
|
vendor/reachy-mini-host/dist/components/PickerView.d.ts.map
ADDED
|
@@ -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"}
|
vendor/reachy-mini-host/dist/components/ReachyHostShell.d.ts
ADDED
|
@@ -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 `/?embed=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
|
vendor/reachy-mini-host/dist/components/ReachyHostShell.d.ts.map
ADDED
|
@@ -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;mCAC+B;IAC/B,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"}
|
vendor/reachy-mini-host/dist/components/RobotPickerView.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
import type { RobotInfo } from '../lib/sdk-types';
|
| 2 |
-
interface RobotPickerViewProps {
|
| 3 |
-
robots: RobotInfo[];
|
| 4 |
-
isStarting: boolean;
|
| 5 |
-
/**
|
| 6 |
-
* `true` while the SDK is still reaching out to central (FSM
|
| 7 |
-
* phases `authenticated` / `connecting`). Used to pick the
|
| 8 |
-
* right empty-state copy: "Looking for your Reachiesβ¦" during
|
| 9 |
-
* discovery vs. "No robot online" once we know the answer.
|
| 10 |
-
* Mirrors the mobile shell's `ScanScreen` which keeps the user
|
| 11 |
-
* on the same surface through the whole discovery flow.
|
| 12 |
-
*/
|
| 13 |
-
isDiscovering?: boolean;
|
| 14 |
-
onPick(robotId: string): void;
|
| 15 |
-
}
|
| 16 |
-
export default function RobotPickerView({ robots, isStarting, isDiscovering, onPick, }: RobotPickerViewProps): import("react/jsx-runtime").JSX.Element;
|
| 17 |
-
export {};
|
| 18 |
-
//# sourceMappingURL=RobotPickerView.d.ts.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/reachy-mini-host/dist/components/RobotPickerView.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"version":3,"file":"RobotPickerView.d.ts","sourceRoot":"","sources":["../../src/components/RobotPickerView.tsx"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIlD,UAAU,oBAAoB;IAC5B,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,MAAM,EACN,UAAU,EACV,aAAqB,EACrB,MAAM,GACP,EAAE,oBAAoB,2CA4FtB"}
|
|
|
|
|
|
vendor/reachy-mini-host/dist/components/SignInView.d.ts
CHANGED
|
@@ -1,21 +1,32 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
}
|
| 19 |
-
export
|
| 20 |
-
export {};
|
| 21 |
//# sourceMappingURL=SignInView.d.ts.map
|
|
|
|
| 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
|
vendor/reachy-mini-host/dist/components/SignInView.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"SignInView.d.ts","sourceRoot":"","sources":["../../src/components/SignInView.tsx"],"names":[],"mappings":"
|
|
|
|
| 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,CA4K/B"}
|
vendor/reachy-mini-host/dist/components/StepsProgressIndicator.d.ts
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
export interface StepsProgressStep {
|
| 2 |
/** Stable id used as React key. */
|
| 3 |
id: string;
|
|
@@ -6,16 +25,17 @@ export interface StepsProgressStep {
|
|
| 6 |
}
|
| 7 |
export interface StepsProgressIndicatorProps {
|
| 8 |
steps: StepsProgressStep[];
|
| 9 |
-
/** 0-indexed current step. Steps before this index
|
| 10 |
-
* completed. Steps after are pending. */
|
| 11 |
currentStep: number;
|
| 12 |
/** Optional explicit progress percentage (0-100). When omitted
|
| 13 |
* the bar is computed from `currentStep / (steps.length - 1)`. */
|
| 14 |
progress?: number;
|
| 15 |
/** When `true` the active step uses the primary tint instead of
|
| 16 |
* the neutral active grey. Useful to signal "we're actively
|
| 17 |
-
* recovering" (e.g. a retry attempt) vs the standard happy
|
|
|
|
| 18 |
accent?: boolean;
|
| 19 |
}
|
| 20 |
-
export
|
| 21 |
//# sourceMappingURL=StepsProgressIndicator.d.ts.map
|
|
|
|
| 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;
|
|
|
|
| 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
|
vendor/reachy-mini-host/dist/components/StepsProgressIndicator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"StepsProgressIndicator.d.ts","sourceRoot":"","sources":["../../src/components/StepsProgressIndicator.tsx"],"names":[],"mappings":"
|
|
|
|
| 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"}
|
vendor/reachy-mini-host/dist/components/TopBar.d.ts
CHANGED
|
@@ -1,55 +1,54 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
appIconUrl?: string | null;
|
|
|
|
|
|
|
| 28 |
appEmoji?: string | null;
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
/**
|
| 32 |
-
*
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
* - disable the account menu so a second click can't start a
|
| 37 |
-
* parallel logout while the first one is still draining
|
| 38 |
-
* the WebRTC + sleep sequence.
|
| 39 |
-
* Optional - components that don't surface a logout (e.g. tests)
|
| 40 |
-
* can leave it unset.
|
| 41 |
-
*/
|
| 42 |
-
isStopping?: boolean;
|
| 43 |
-
/**
|
| 44 |
-
* Override label for the End-session button. Defaults to "End
|
| 45 |
-
* session" / "Endingβ¦" (telepresence shape). The host shell
|
| 46 |
-
* passes "Back to apps" when the iframe is live and we want
|
| 47 |
-
* the destructive verb to mean "leave this app, keep my pick".
|
| 48 |
-
*/
|
| 49 |
-
endSessionLabel?: string;
|
| 50 |
onEndSession(): void;
|
| 51 |
-
onLogout(): void;
|
| 52 |
}
|
| 53 |
-
export
|
| 54 |
-
export {};
|
| 55 |
//# sourceMappingURL=TopBar.d.ts.map
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Persistent host top bar.
|
| 3 |
+
*
|
| 4 |
+
* 1-to-1 port of the pre-migration `reachy_mini_host/src/components/
|
| 5 |
+
* TopBar.tsx` so users moving from the standalone host shell to the
|
| 6 |
+
* `@reachy-mini/host` package keep the exact same chrome:
|
| 7 |
+
*
|
| 8 |
+
* Layout (signed in, no session):
|
| 9 |
+
*
|
| 10 |
+
* [ logo ] Telepresence [ avatar @user βΎ ]
|
| 11 |
+
*
|
| 12 |
+
* Layout (signed in, streaming):
|
| 13 |
+
*
|
| 14 |
+
* [ logo ] Telepresence [ β» End session ] [ avatar @user βΎ ]
|
| 15 |
+
*
|
| 16 |
+
* UX rationale
|
| 17 |
+
* ββββββββββββ
|
| 18 |
+
* The destructive actions are visually distinct:
|
| 19 |
+
* - "End session" is a labeled red button that ONLY renders while a
|
| 20 |
+
* session is live. When there's no session it disappears, so the
|
| 21 |
+
* bar isn't cluttered with a permanent disabled glyph.
|
| 22 |
+
* - "Sign out" lives inside an account menu opened by clicking the
|
| 23 |
+
* avatar+username chip. Standard "click your face to see account
|
| 24 |
+
* actions" pattern, prevents accidental sign-out clicks.
|
| 25 |
+
*
|
| 26 |
+
* Signed-out
|
| 27 |
+
* ββββββββββ
|
| 28 |
+
* The bar STAYS visible on the sign-in screen, with the embedded app's
|
| 29 |
+
* logo + name on the left and an empty right slot - no avatar, no
|
| 30 |
+
* End-session button, since neither makes sense before the user has
|
| 31 |
+
* authenticated. Anchors "where am I" for users landing on the host
|
| 32 |
+
* through `huggingface.co/spaces/<app>`.
|
| 33 |
+
*/
|
| 34 |
+
import { type JSX } from 'react';
|
| 35 |
+
export type HostPhase = 'signing-in' | 'picking' | 'embedded' | 'leaving' | 'error';
|
| 36 |
+
export interface TopBarProps {
|
| 37 |
+
appName: string;
|
| 38 |
+
/** Resolved app icon URL probed from `${embedUrl}/icon.svg`. Best
|
| 39 |
+
* signal: the app shipped a real icon. */
|
| 40 |
appIconUrl?: string | null;
|
| 41 |
+
/** Fallback emoji from the HF Spaces frontmatter (`cardData.emoji`).
|
| 42 |
+
* Used when no `appIconUrl` is available. */
|
| 43 |
appEmoji?: string | null;
|
| 44 |
+
hostPhase: HostPhase;
|
| 45 |
+
userName: string | null;
|
| 46 |
+
/** Resolved HF avatar URL from `/api/whoami-v2`, or `null` while in
|
| 47 |
+
* flight / failed. The chip falls back to a first-letter glyph. */
|
| 48 |
+
avatarUrl?: string | null;
|
| 49 |
+
selectedRobotName?: string | null;
|
| 50 |
+
onSignOut(): void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
onEndSession(): void;
|
|
|
|
| 52 |
}
|
| 53 |
+
export declare function TopBar({ appName, appIconUrl, appEmoji, hostPhase, userName, avatarUrl, selectedRobotName: _selectedRobotName, onSignOut, onEndSession, }: TopBarProps): JSX.Element;
|
|
|
|
| 54 |
//# sourceMappingURL=TopBar.d.ts.map
|
vendor/reachy-mini-host/dist/components/TopBar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"TopBar.d.ts","sourceRoot":"","sources":["../../src/components/TopBar.tsx"],"names":[],"mappings":"
|
|
|
|
| 1 |
+
{"version":3,"file":"TopBar.d.ts","sourceRoot":"","sources":["../../src/components/TopBar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;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"}
|
vendor/reachy-mini-host/dist/components/WelcomeBackOverlay.d.ts
ADDED
|
@@ -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
|
vendor/reachy-mini-host/dist/components/WelcomeBackOverlay.d.ts.map
ADDED
|
@@ -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"}
|
vendor/reachy-mini-host/dist/components/WelcomeBackView.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
| 1 |
-
interface WelcomeBackViewProps {
|
| 2 |
-
username: string | null;
|
| 3 |
-
onDone(): void;
|
| 4 |
-
}
|
| 5 |
-
export default function WelcomeBackView({ username, onDone, }: WelcomeBackViewProps): import("react/jsx-runtime").JSX.Element;
|
| 6 |
-
export {};
|
| 7 |
-
//# sourceMappingURL=WelcomeBackView.d.ts.map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/reachy-mini-host/dist/components/WelcomeBackView.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"version":3,"file":"WelcomeBackView.d.ts","sourceRoot":"","sources":["../../src/components/WelcomeBackView.tsx"],"names":[],"mappings":"AAuCA,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,QAAQ,EACR,MAAM,GACP,EAAE,oBAAoB,2CAmEtB"}
|
|
|
|
|
|
vendor/reachy-mini-host/dist/embed/index.d.ts
CHANGED
|
@@ -7,106 +7,79 @@
|
|
| 7 |
*
|
| 8 |
* import { connectToHost } from '@reachy-mini/host/embed';
|
| 9 |
*
|
| 10 |
-
* const
|
| 11 |
-
*
|
|
|
|
| 12 |
*
|
| 13 |
-
*
|
| 14 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
*
|
| 16 |
-
*
|
| 17 |
-
*
|
| 18 |
-
*
|
| 19 |
-
*
|
| 20 |
-
*
|
| 21 |
-
* fires `reachymini:ready`).
|
| 22 |
-
* 3. Instantiate the SDK, seed the HF token into `sessionStorage`
|
| 23 |
-
* so `authenticate()` resolves without a redirect.
|
| 24 |
-
* 4. Send `embed:ready` to the parent.
|
| 25 |
-
* 5. Wait for `host:init` (resolves the promise).
|
| 26 |
-
* 6. Connect + startSession + ensureAwake.
|
| 27 |
-
* 7. Resolve `connectToHost()` with the live SDK handle.
|
| 28 |
-
*
|
| 29 |
-
* The app then renders. If the host posts `host:leaving`, every
|
| 30 |
-
* registered `onLeave` callback fires; if the app exposes its own
|
| 31 |
-
* exit affordance, call `requestLeave()` to ask the host to tear
|
| 32 |
-
* down.
|
| 33 |
-
*
|
| 34 |
-
* No React / no MUI / no global pollution: this entry stays
|
| 35 |
-
* ~5 KB gz so vanilla apps don't pay the cost of a UI framework
|
| 36 |
-
* they don't need.
|
| 37 |
*/
|
| 38 |
import type { ReachyMiniInstance, ReachyMiniOptions } from '../lib/sdk-types';
|
| 39 |
-
import
|
| 40 |
/** Resolved state at the moment `connectToHost()` returns. */
|
| 41 |
export interface ConnectedHandle<TConfig = unknown> {
|
| 42 |
-
/** Live SDK instance
|
| 43 |
reachy: ReachyMiniInstance;
|
| 44 |
-
/** Current theme; updated
|
| 45 |
theme: ThemeMode;
|
| 46 |
-
/** Initial config (
|
| 47 |
-
*
|
| 48 |
config: TConfig | null;
|
| 49 |
/** App display name as passed by the host. */
|
| 50 |
appName: string;
|
| 51 |
/** Host display name (e.g. "Reachy Mini"). */
|
| 52 |
hostName: string;
|
| 53 |
-
/** HF
|
| 54 |
-
|
| 55 |
-
/** Register a teardown callback. Fires
|
| 56 |
-
*
|
| 57 |
-
*
|
| 58 |
-
*
|
| 59 |
-
* the caller chain via a Promise.all. */
|
| 60 |
onLeave(cb: () => void | Promise<void>): () => void;
|
| 61 |
-
/** Register a theme-
|
| 62 |
-
* available on the returned `theme` field at call time, but
|
| 63 |
-
* for live updates use this. */
|
| 64 |
onThemeChange(cb: (theme: ThemeMode) => void): () => void;
|
| 65 |
-
/** Register a config-
|
| 66 |
onConfigChange(cb: (config: TConfig | null) => void): () => void;
|
| 67 |
-
/**
|
| 68 |
-
|
| 69 |
-
/** Push an app-level state update upstream (so the host can
|
| 70 |
-
* drive its ConnectingView). */
|
| 71 |
setAppState(state: {
|
| 72 |
phase: AppPhase;
|
| 73 |
connectingStep?: AppConnectingStep | null;
|
| 74 |
message?: string | null;
|
| 75 |
}): void;
|
| 76 |
-
/** Ask the host to start
|
| 77 |
requestLeave(): void;
|
| 78 |
-
/**
|
| 79 |
-
requestConfigUpdate(patch: ConfigPayload): void;
|
| 80 |
-
/** Report a non-fatal error to the host (logged + may surface
|
| 81 |
-
* a UI notice). Pass `fatal: true` to switch to the ErrorView. */
|
| 82 |
reportError(message: string, opts?: {
|
| 83 |
fatal?: boolean;
|
| 84 |
detail?: unknown;
|
| 85 |
}): void;
|
| 86 |
-
/** Push an arbitrary `embed:custom` envelope. */
|
| 87 |
-
sendCustom(channel: string, payload: unknown): void;
|
| 88 |
}
|
| 89 |
export interface ConnectToHostOptions {
|
| 90 |
-
/**
|
| 91 |
-
* `
|
| 92 |
sdkOptions?: Partial<ReachyMiniOptions>;
|
| 93 |
-
/**
|
| 94 |
-
*
|
| 95 |
expectedOrigin?: string;
|
| 96 |
}
|
| 97 |
-
/**
|
| 98 |
-
*
|
| 99 |
-
* shake hands with the host, connect + start session + wake the
|
| 100 |
-
* robot, then resolve with a ready-to-use SDK handle.
|
| 101 |
-
*
|
| 102 |
-
* Throws if the SDK script tag failed to load, if no creds bundle
|
| 103 |
-
* was found in the URL hash, or if the host never sends
|
| 104 |
-
* `host:init` (8 s timeout).
|
| 105 |
-
*/
|
| 106 |
export declare function connectToHost<TConfig = unknown>(options?: ConnectToHostOptions): Promise<ConnectedHandle<TConfig>>;
|
| 107 |
-
export declare function getReachy(): ReachyMiniInstance;
|
| 108 |
-
/** Internal hook used by `connectToHost()` to register the
|
| 109 |
-
* module-level singleton. Exposed for unit tests; do not call
|
| 110 |
-
* from app code. */
|
| 111 |
-
export declare function _registerActiveReachy(r: ReachyMiniInstance): void;
|
| 112 |
//# sourceMappingURL=index.d.ts.map
|
|
|
|
| 7 |
*
|
| 8 |
* import { connectToHost } from '@reachy-mini/host/embed';
|
| 9 |
*
|
| 10 |
+
* const handle = await connectToHost<MyAppConfig>();
|
| 11 |
+
* handle.onLeave(() => { /* clean up before unmount *\/ });
|
| 12 |
+
* handle.reachy.setHeadRpyDeg(0, 10, 0);
|
| 13 |
*
|
| 14 |
+
* Boot sequence (canonical reference: SPEC.md Β§6.4):
|
| 15 |
+
* 1. Read `#creds=<base64>` synchronously and wipe the hash
|
| 16 |
+
* with `history.replaceState`.
|
| 17 |
+
* 2. Wait for `window.ReachyMini` (8 s timeout).
|
| 18 |
+
* 3. Instantiate the SDK, seed the HF token into
|
| 19 |
+
* `sessionStorage`.
|
| 20 |
+
* 4. Send `embed:ready` to the parent.
|
| 21 |
+
* 5. Wait for `host:init` (8 s timeout; Mode B proceeds from
|
| 22 |
+
* hash alone when this never arrives).
|
| 23 |
+
* 6. `connect()` β `startSession()` β `ensureAwake()`, emitting
|
| 24 |
+
* `embed:app-state` at each step.
|
| 25 |
+
* 7. Resolve `connectToHost()` with the live SDK handle.
|
| 26 |
*
|
| 27 |
+
* Strict Mode safety (SPEC Β§8.4): the function is idempotent
|
| 28 |
+
* across multiple awaits via a module-level promise. Calling
|
| 29 |
+
* `connectToHost()` twice returns the same in-flight promise;
|
| 30 |
+
* a single SDK instance is created, a single `embed:ready` is
|
| 31 |
+
* posted.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
*/
|
| 33 |
import type { ReachyMiniInstance, ReachyMiniOptions } from '../lib/sdk-types';
|
| 34 |
+
import type { AppConnectingStep, AppPhase, ThemeMode } from '../lib/protocol';
|
| 35 |
/** Resolved state at the moment `connectToHost()` returns. */
|
| 36 |
export interface ConnectedHandle<TConfig = unknown> {
|
| 37 |
+
/** Live SDK instance: connected, session started, robot awake. */
|
| 38 |
reachy: ReachyMiniInstance;
|
| 39 |
+
/** Current theme; updated via `onThemeChange`. */
|
| 40 |
theme: ThemeMode;
|
| 41 |
+
/** Initial config (from URL `?config=` or mobile handoff).
|
| 42 |
+
* Updates pushed via `onConfigChange`. */
|
| 43 |
config: TConfig | null;
|
| 44 |
/** App display name as passed by the host. */
|
| 45 |
appName: string;
|
| 46 |
/** Host display name (e.g. "Reachy Mini"). */
|
| 47 |
hostName: string;
|
| 48 |
+
/** HF user name when known (from `host:init`). */
|
| 49 |
+
userName: string | null;
|
| 50 |
+
/** Register a teardown callback. Fires on `host:leaving`
|
| 51 |
+
* (one-shot) or `pagehide`. Return a promise to keep the host
|
| 52 |
+
* waiting (bounded by the host's `timeoutMs`). Returns an
|
| 53 |
+
* unsubscribe function. */
|
|
|
|
| 54 |
onLeave(cb: () => void | Promise<void>): () => void;
|
| 55 |
+
/** Register a theme-change handler. */
|
|
|
|
|
|
|
| 56 |
onThemeChange(cb: (theme: ThemeMode) => void): () => void;
|
| 57 |
+
/** Register a config-change handler. */
|
| 58 |
onConfigChange(cb: (config: TConfig | null) => void): () => void;
|
| 59 |
+
/** Push an app-level state update upstream so the host can
|
| 60 |
+
* drive its ConnectingView overlay. */
|
|
|
|
|
|
|
| 61 |
setAppState(state: {
|
| 62 |
phase: AppPhase;
|
| 63 |
connectingStep?: AppConnectingStep | null;
|
| 64 |
message?: string | null;
|
| 65 |
}): void;
|
| 66 |
+
/** Ask the host to start the leave sequence. */
|
| 67 |
requestLeave(): void;
|
| 68 |
+
/** Report an error. `fatal: true` switches the host to ErrorView. */
|
|
|
|
|
|
|
|
|
|
| 69 |
reportError(message: string, opts?: {
|
| 70 |
fatal?: boolean;
|
| 71 |
detail?: unknown;
|
| 72 |
}): void;
|
|
|
|
|
|
|
| 73 |
}
|
| 74 |
export interface ConnectToHostOptions {
|
| 75 |
+
/** Forwarded to the SDK constructor. `appName`, `signalingUrl`,
|
| 76 |
+
* `clientId` are auto-set from the creds bundle. */
|
| 77 |
sdkOptions?: Partial<ReachyMiniOptions>;
|
| 78 |
+
/** Origin of the host's window. Defaults to
|
| 79 |
+
* `window.location.origin` (same-origin iframe). */
|
| 80 |
expectedOrigin?: string;
|
| 81 |
}
|
| 82 |
+
/** Boot the embedded app. Idempotent: calling twice returns the
|
| 83 |
+
* same in-flight promise. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
export declare function connectToHost<TConfig = unknown>(options?: ConnectToHostOptions): Promise<ConnectedHandle<TConfig>>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
//# sourceMappingURL=index.d.ts.map
|
vendor/reachy-mini-host/dist/embed/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/embed/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
| 1 |
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/embed/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAO1B,OAAO,KAAK,EACV,iBAAiB,EACjB,QAAQ,EAMR,SAAS,EACV,MAAM,iBAAiB,CAAC;AAMzB,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;;;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;AAMD;8BAC8B;AAC9B,wBAAsB,aAAa,CAAC,OAAO,GAAG,OAAO,EACnD,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAKnC"}
|
vendor/reachy-mini-host/dist/entry/auto.d.ts
CHANGED
|
@@ -1,21 +1,25 @@
|
|
| 1 |
/**
|
| 2 |
-
* CDN entry
|
|
|
|
| 3 |
*
|
| 4 |
-
*
|
| 5 |
-
*
|
|
|
|
|
|
|
| 6 |
*
|
| 7 |
-
*
|
| 8 |
-
*
|
| 9 |
-
*
|
| 10 |
-
* mountHost({ appName: 'Emotions', appIconUrl: '/icon.svg' });
|
| 11 |
-
*
|
| 12 |
-
* Identical surface to `index.ts`; lives at a separate URL purely
|
| 13 |
-
* so the import path in the HTML dispatcher is human-recognisable
|
| 14 |
-
* as the CDN-side entry.
|
| 15 |
*/
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
//# sourceMappingURL=auto.d.ts.map
|
|
|
|
| 1 |
/**
|
| 2 |
+
* CDN "auto" entry: the single script tag loaded from an app's
|
| 3 |
+
* `index.html` to bring up the host shell.
|
| 4 |
*
|
| 5 |
+
* <script type="module"
|
| 6 |
+
* src="https://cdn.jsdelivr.net/npm/@reachy-mini/host@1/dist/entry/auto.js">
|
| 7 |
+
* </script>
|
| 8 |
+
* <script type="module" src="/src/dispatch.ts"></script>
|
| 9 |
*
|
| 10 |
+
* The auto bundle exposes `mountHost` on `window.ReachyMiniHost`
|
| 11 |
+
* for legacy / non-module callers. ESM consumers import it the
|
| 12 |
+
* normal way.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
*/
|
| 14 |
+
import { mountHost } from '../mountHost';
|
| 15 |
+
import type { MountHostOptions, MountedHost } from '../mountHost';
|
| 16 |
+
declare global {
|
| 17 |
+
interface Window {
|
| 18 |
+
ReachyMiniHost?: {
|
| 19 |
+
mountHost(options: MountHostOptions): MountedHost;
|
| 20 |
+
};
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
export { mountHost };
|
| 24 |
+
export type { MountHostOptions, MountedHost };
|
| 25 |
//# sourceMappingURL=auto.d.ts.map
|
vendor/reachy-mini-host/dist/entry/auto.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"auto.d.ts","sourceRoot":"","sources":["../../src/entry/auto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;
|
|
|
|
| 1 |
+
{"version":3,"file":"auto.d.ts","sourceRoot":"","sources":["../../src/entry/auto.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,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;AAMD,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC"}
|
vendor/reachy-mini-host/dist/entry/auto.js
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
vendor/reachy-mini-host/dist/entry/auto.js.map
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
vendor/reachy-mini-host/dist/entry/embed.d.ts
CHANGED
|
@@ -1,11 +1,25 @@
|
|
| 1 |
/**
|
| 2 |
-
* CDN entry
|
| 3 |
-
* in each app, or via the `@reachy-mini/host/embed` package export.
|
| 4 |
*
|
| 5 |
-
*
|
| 6 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
*/
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
//# sourceMappingURL=embed.d.ts.map
|
|
|
|
| 1 |
/**
|
| 2 |
+
* CDN "embed" entry: vanilla TS, no React / MUI, ~5 KB gz.
|
|
|
|
| 3 |
*
|
| 4 |
+
* Loaded inside the embedded app's iframe alongside the SDK:
|
| 5 |
+
*
|
| 6 |
+
* <script type="module"
|
| 7 |
+
* src="https://cdn.jsdelivr.net/npm/@reachy-mini/host@1/dist/entry/embed.js">
|
| 8 |
+
* </script>
|
| 9 |
+
*
|
| 10 |
+
* The bundle exposes `connectToHost` on
|
| 11 |
+
* `window.ReachyMiniHostEmbed` for legacy callers. ESM consumers
|
| 12 |
+
* import normally.
|
| 13 |
*/
|
| 14 |
+
import { connectToHost } from '../embed';
|
| 15 |
+
import type { ConnectedHandle, ConnectToHostOptions } from '../embed';
|
| 16 |
+
declare global {
|
| 17 |
+
interface Window {
|
| 18 |
+
ReachyMiniHostEmbed?: {
|
| 19 |
+
connectToHost<TConfig = unknown>(opts?: ConnectToHostOptions): Promise<ConnectedHandle<TConfig>>;
|
| 20 |
+
};
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
export { connectToHost };
|
| 24 |
+
export type { ConnectedHandle, ConnectToHostOptions };
|
| 25 |
//# sourceMappingURL=embed.d.ts.map
|
vendor/reachy-mini-host/dist/entry/embed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../src/entry/embed.ts"],"names":[],"mappings":"AAAA;;;;;;
|
|
|
|
| 1 |
+
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../src/entry/embed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,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;AAMD,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,CAAC"}
|
vendor/reachy-mini-host/dist/entry/embed.js
CHANGED
|
@@ -1,261 +1,6 @@
|
|
| 1 |
-
import {
|
| 2 |
-
|
| 3 |
-
function I(i) {
|
| 4 |
-
return new Promise((a) => {
|
| 5 |
-
if (typeof window > "u") {
|
| 6 |
-
a(!1);
|
| 7 |
-
return;
|
| 8 |
-
}
|
| 9 |
-
if (window.ReachyMini) {
|
| 10 |
-
a(!0);
|
| 11 |
-
return;
|
| 12 |
-
}
|
| 13 |
-
const n = () => {
|
| 14 |
-
window.removeEventListener("reachymini:ready", n), window.clearTimeout(b), a(!0);
|
| 15 |
-
}, b = window.setTimeout(() => {
|
| 16 |
-
window.removeEventListener("reachymini:ready", n), a(!1);
|
| 17 |
-
}, i);
|
| 18 |
-
window.addEventListener("reachymini:ready", n, { once: !0 });
|
| 19 |
-
});
|
| 20 |
-
}
|
| 21 |
-
function N(i, a) {
|
| 22 |
-
if (!(!i || !a))
|
| 23 |
-
try {
|
| 24 |
-
sessionStorage.setItem("hf_token", i), sessionStorage.setItem("hf_username", a);
|
| 25 |
-
const n = 3600 * 1e3;
|
| 26 |
-
sessionStorage.setItem(
|
| 27 |
-
"hf_token_expires",
|
| 28 |
-
new Date(Date.now() + n).toISOString()
|
| 29 |
-
);
|
| 30 |
-
} catch {
|
| 31 |
-
}
|
| 32 |
-
}
|
| 33 |
-
function h(i) {
|
| 34 |
-
if (!(typeof window > "u"))
|
| 35 |
-
try {
|
| 36 |
-
window.parent.postMessage(i, window.location.origin);
|
| 37 |
-
} catch (a) {
|
| 38 |
-
console.warn("[@reachy-mini/host/embed] failed to postMessage to host", a);
|
| 39 |
-
}
|
| 40 |
-
}
|
| 41 |
-
async function U(i = {}) {
|
| 42 |
-
const a = i.expectedOrigin ?? window.location.origin, n = M(window.location.hash);
|
| 43 |
-
if (!n)
|
| 44 |
-
throw new Error(
|
| 45 |
-
"[@reachy-mini/host/embed] no creds in URL hash - was the host expected to handshake?"
|
| 46 |
-
);
|
| 47 |
-
try {
|
| 48 |
-
history.replaceState(
|
| 49 |
-
null,
|
| 50 |
-
"",
|
| 51 |
-
window.location.pathname + window.location.search
|
| 52 |
-
);
|
| 53 |
-
} catch {
|
| 54 |
-
}
|
| 55 |
-
if (typeof document < "u" && document.documentElement.setAttribute("data-theme", n.theme), N(n.hfToken ?? null, n.username ?? null), !await I(_))
|
| 56 |
-
throw new Error(
|
| 57 |
-
"[@reachy-mini/host/embed] ReachyMini SDK failed to load"
|
| 58 |
-
);
|
| 59 |
-
const r = new window.ReachyMini({
|
| 60 |
-
appName: n.appName,
|
| 61 |
-
signalingUrl: n.signalingUrl,
|
| 62 |
-
enableMicrophone: !0,
|
| 63 |
-
...i.sdkOptions ?? {}
|
| 64 |
-
});
|
| 65 |
-
g = r;
|
| 66 |
-
const S = (async () => {
|
| 67 |
-
if (u("boot"), u("connecting", "link"), n.hfToken)
|
| 68 |
-
try {
|
| 69 |
-
await r.authenticate();
|
| 70 |
-
} catch {
|
| 71 |
-
}
|
| 72 |
-
await r.connect(), u("connecting", "session"), await r.startSession(n.robotPeerId), u("connecting", "wake");
|
| 73 |
-
try {
|
| 74 |
-
await r.ensureAwake();
|
| 75 |
-
} catch (e) {
|
| 76 |
-
console.warn("[@reachy-mini/host/embed] ensureAwake failed", e);
|
| 77 |
-
}
|
| 78 |
-
u("live");
|
| 79 |
-
})(), w = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set();
|
| 80 |
-
let c = n.theme, m = n.config ?? null, k = null;
|
| 81 |
-
function u(e, t = null, o = null) {
|
| 82 |
-
h({
|
| 83 |
-
source: l,
|
| 84 |
-
type: "embed:app-state",
|
| 85 |
-
version: d,
|
| 86 |
-
phase: e,
|
| 87 |
-
connectingStep: t,
|
| 88 |
-
message: o
|
| 89 |
-
});
|
| 90 |
-
}
|
| 91 |
-
const T = (e) => {
|
| 92 |
-
if (e.origin !== a || e.source !== window.parent || !E(e.data)) return;
|
| 93 |
-
const t = e.data;
|
| 94 |
-
switch (t.type) {
|
| 95 |
-
case "host:init": {
|
| 96 |
-
k = t, t.theme !== c && (c = t.theme, document.documentElement.setAttribute("data-theme", c), f.forEach((o) => o(c))), t.config !== m && (m = t.config ?? null, y.forEach((o) => o(m)));
|
| 97 |
-
break;
|
| 98 |
-
}
|
| 99 |
-
case "host:theme-changed": {
|
| 100 |
-
c = t.theme, document.documentElement.setAttribute("data-theme", c), f.forEach((o) => o(c));
|
| 101 |
-
break;
|
| 102 |
-
}
|
| 103 |
-
case "host:config-changed": {
|
| 104 |
-
m = t.config ?? null, y.forEach((o) => o(m));
|
| 105 |
-
break;
|
| 106 |
-
}
|
| 107 |
-
case "host:leaving": {
|
| 108 |
-
const o = v;
|
| 109 |
-
Promise.all(Array.from(w).map((s) => Promise.resolve(s()))).catch((s) => console.warn("[@reachy-mini/host/embed] onLeave threw", s)).then(async () => {
|
| 110 |
-
try {
|
| 111 |
-
await r.stopSession();
|
| 112 |
-
} catch (s) {
|
| 113 |
-
console.warn("[@reachy-mini/host/embed] stopSession failed", s);
|
| 114 |
-
}
|
| 115 |
-
}).finally(() => {
|
| 116 |
-
h({
|
| 117 |
-
source: l,
|
| 118 |
-
type: "embed:custom",
|
| 119 |
-
version: d,
|
| 120 |
-
channel: "leave-ack",
|
| 121 |
-
payload: { token: o ?? null }
|
| 122 |
-
});
|
| 123 |
-
});
|
| 124 |
-
break;
|
| 125 |
-
}
|
| 126 |
-
case "host:custom": {
|
| 127 |
-
if (t.channel === "leave-token") {
|
| 128 |
-
v = typeof t.payload == "object" && t.payload !== null ? t.payload.token ?? null : null;
|
| 129 |
-
return;
|
| 130 |
-
}
|
| 131 |
-
p.forEach((o) => o(t.channel, t.payload));
|
| 132 |
-
break;
|
| 133 |
-
}
|
| 134 |
-
}
|
| 135 |
-
};
|
| 136 |
-
let v = null;
|
| 137 |
-
window.addEventListener("message", T), h({
|
| 138 |
-
source: l,
|
| 139 |
-
type: "embed:ready",
|
| 140 |
-
version: d
|
| 141 |
-
});
|
| 142 |
-
const R = new Promise((e) => {
|
| 143 |
-
if (k) {
|
| 144 |
-
e();
|
| 145 |
-
return;
|
| 146 |
-
}
|
| 147 |
-
const t = window.setTimeout(() => {
|
| 148 |
-
window.removeEventListener("message", o), e();
|
| 149 |
-
}, P), o = (s) => {
|
| 150 |
-
s.origin === a && E(s.data) && s.data.type === "host:init" && (window.removeEventListener("message", o), window.clearTimeout(t), e());
|
| 151 |
-
};
|
| 152 |
-
window.addEventListener("message", o);
|
| 153 |
-
});
|
| 154 |
-
await Promise.all([S, R]);
|
| 155 |
-
const C = {
|
| 156 |
-
reachy: r,
|
| 157 |
-
theme: c,
|
| 158 |
-
config: m,
|
| 159 |
-
appName: n.appName,
|
| 160 |
-
hostName: n.hostName,
|
| 161 |
-
username: n.username ?? null,
|
| 162 |
-
onLeave(e) {
|
| 163 |
-
return w.add(e), () => {
|
| 164 |
-
w.delete(e);
|
| 165 |
-
};
|
| 166 |
-
},
|
| 167 |
-
onThemeChange(e) {
|
| 168 |
-
return f.add(e), () => {
|
| 169 |
-
f.delete(e);
|
| 170 |
-
};
|
| 171 |
-
},
|
| 172 |
-
onConfigChange(e) {
|
| 173 |
-
return y.add(e), () => {
|
| 174 |
-
y.delete(e);
|
| 175 |
-
};
|
| 176 |
-
},
|
| 177 |
-
onCustom(e) {
|
| 178 |
-
return p.add(e), () => {
|
| 179 |
-
p.delete(e);
|
| 180 |
-
};
|
| 181 |
-
},
|
| 182 |
-
setAppState(e) {
|
| 183 |
-
u(
|
| 184 |
-
e.phase,
|
| 185 |
-
e.connectingStep ?? null,
|
| 186 |
-
e.message ?? null
|
| 187 |
-
);
|
| 188 |
-
},
|
| 189 |
-
requestLeave() {
|
| 190 |
-
h({
|
| 191 |
-
source: l,
|
| 192 |
-
type: "embed:request-leave",
|
| 193 |
-
version: d
|
| 194 |
-
});
|
| 195 |
-
},
|
| 196 |
-
requestConfigUpdate(e) {
|
| 197 |
-
h({
|
| 198 |
-
source: l,
|
| 199 |
-
type: "embed:request-config-update",
|
| 200 |
-
version: d,
|
| 201 |
-
config: e
|
| 202 |
-
});
|
| 203 |
-
},
|
| 204 |
-
reportError(e, t) {
|
| 205 |
-
h({
|
| 206 |
-
source: l,
|
| 207 |
-
type: "embed:error",
|
| 208 |
-
version: d,
|
| 209 |
-
message: e,
|
| 210 |
-
fatal: !!t?.fatal,
|
| 211 |
-
detail: t?.detail
|
| 212 |
-
});
|
| 213 |
-
},
|
| 214 |
-
sendCustom(e, t) {
|
| 215 |
-
h({
|
| 216 |
-
source: l,
|
| 217 |
-
type: "embed:custom",
|
| 218 |
-
version: d,
|
| 219 |
-
channel: e,
|
| 220 |
-
payload: t
|
| 221 |
-
});
|
| 222 |
-
}
|
| 223 |
-
}, L = (e) => {
|
| 224 |
-
const t = e.detail;
|
| 225 |
-
typeof t?.awake == "boolean" && h({
|
| 226 |
-
source: l,
|
| 227 |
-
type: "embed:custom",
|
| 228 |
-
version: d,
|
| 229 |
-
channel: "motor-state",
|
| 230 |
-
payload: { awake: t.awake }
|
| 231 |
-
});
|
| 232 |
-
};
|
| 233 |
-
r.addEventListener("motorStateChanged", L);
|
| 234 |
-
const O = () => {
|
| 235 |
-
w.forEach((e) => {
|
| 236 |
-
try {
|
| 237 |
-
e();
|
| 238 |
-
} catch (t) {
|
| 239 |
-
console.warn("[@reachy-mini/host/embed] onLeave threw on pagehide", t);
|
| 240 |
-
}
|
| 241 |
-
});
|
| 242 |
-
try {
|
| 243 |
-
r.stopSession();
|
| 244 |
-
} catch {
|
| 245 |
-
}
|
| 246 |
-
};
|
| 247 |
-
return window.addEventListener("pagehide", O), C;
|
| 248 |
-
}
|
| 249 |
-
let g = null;
|
| 250 |
-
function H() {
|
| 251 |
-
if (!g)
|
| 252 |
-
throw new Error(
|
| 253 |
-
"[@reachy-mini/host/embed] getReachy() called before connectToHost()"
|
| 254 |
-
);
|
| 255 |
-
return g;
|
| 256 |
-
}
|
| 257 |
export {
|
| 258 |
-
|
| 259 |
-
H as getReachy
|
| 260 |
};
|
| 261 |
//# sourceMappingURL=embed.js.map
|
|
|
|
| 1 |
+
import { c as o } from "../chunks/index-BLeHwvaH.js";
|
| 2 |
+
typeof window < "u" && (window.ReachyMiniHostEmbed = { connectToHost: o });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
export {
|
| 4 |
+
o as connectToHost
|
|
|
|
| 5 |
};
|
| 6 |
//# sourceMappingURL=embed.js.map
|
vendor/reachy-mini-host/dist/entry/embed.js.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"embed.js","sources":["../../src/embed/index.ts"],"sourcesContent":["/**\n * Embedded-app client.\n *\n * Vanilla TypeScript helper that lives in the iframe side of the\n * host / app split. Consumed by `src/embed.{ts,tsx}` in each app\n * (or via the CDN entry `@reachy-mini/host/embed` script tag).\n *\n * import { connectToHost } from '@reachy-mini/host/embed';\n *\n * const { reachy, theme, config, onLeave, onCustom } =\n * await connectToHost<MyAppConfig>();\n *\n * onLeave(() => { /* clean up before the host unmounts us *\\/ });\n * reachy.setHeadRpyDeg(0, 10, 0);\n *\n * Bootstrap sequence\n * ββββββββββββββββββ\n * 1. Read `#creds=<base64>` from the URL hash (synchronous; lets\n * us configure the SDK before the postMessage handshake).\n * 2. Wait for `window.ReachyMini` (the SDK script tag in index.html\n * fires `reachymini:ready`).\n * 3. Instantiate the SDK, seed the HF token into `sessionStorage`\n * so `authenticate()` resolves without a redirect.\n * 4. Send `embed:ready` to the parent.\n * 5. Wait for `host:init` (resolves the promise).\n * 6. Connect + startSession + ensureAwake.\n * 7. Resolve `connectToHost()` with the live SDK handle.\n *\n * The app then renders. If the host posts `host:leaving`, every\n * registered `onLeave` callback fires; if the app exposes its own\n * exit affordance, call `requestLeave()` to ask the host to tear\n * down.\n *\n * No React / no MUI / no global pollution: this entry stays\n * ~5 KB gz so vanilla apps don't pay the cost of a UI framework\n * they don't need.\n */\nimport type { ReachyMiniInstance, ReachyMiniOptions } from '../lib/sdk-types';\nimport {\n type AppConnectingStep,\n type AppPhase,\n type ConfigPayload,\n type CredsBundle,\n type EmbedToHostMsg,\n type HostInitMsg,\n type HostToEmbedMsg,\n type ThemeMode,\n PROTOCOL_SOURCE,\n PROTOCOL_VERSION,\n decodeCredsFromHash,\n isProtocolMessage,\n} from '../lib/protocol';\n\nconst SDK_READY_TIMEOUT_MS = 8000;\nconst HOST_INIT_TIMEOUT_MS = 8000;\n\n/** Resolved state at the moment `connectToHost()` returns. */\nexport interface ConnectedHandle<TConfig = unknown> {\n /** Live SDK instance, already connected + session started. */\n reachy: ReachyMiniInstance;\n /** Current theme; updated by the host via `onThemeChange`. */\n theme: ThemeMode;\n /** Initial config (deep-link / mobile handoff / `?config=` URL\n * param). The host pushes patches via `onConfigChange`. */\n config: TConfig | null;\n /** App display name as passed by the host. */\n appName: string;\n /** Host display name (e.g. \"Reachy Mini\"). */\n hostName: string;\n /** HF username when known (host:init carries it). */\n username: string | null;\n /** Register a teardown callback. Fires when the host posts\n * `host:leaving` (one-shot) or when the iframe is about to\n * unmount. The host gives ~1.5-2 s before forcing the unmount;\n * do your async clean-up inside an async callback returned to\n * the caller chain via a Promise.all. */\n onLeave(cb: () => void | Promise<void>): () => void;\n /** Register a theme-changed handler. The current value is\n * available on the returned `theme` field at call time, but\n * for live updates use this. */\n onThemeChange(cb: (theme: ThemeMode) => void): () => void;\n /** Register a config-changed handler. */\n onConfigChange(cb: (config: TConfig | null) => void): () => void;\n /** Register a custom-channel handler. */\n onCustom(cb: (channel: string, payload: unknown) => void): () => void;\n /** Push an app-level state update upstream (so the host can\n * drive its ConnectingView). */\n setAppState(state: {\n phase: AppPhase;\n connectingStep?: AppConnectingStep | null;\n message?: string | null;\n }): void;\n /** Ask the host to start its leave sequence. */\n requestLeave(): void;\n /** Push a config patch upstream (host shallow-merges). */\n requestConfigUpdate(patch: ConfigPayload): void;\n /** Report a non-fatal error to the host (logged + may surface\n * a UI notice). Pass `fatal: true` to switch to the ErrorView. */\n reportError(message: string, opts?: { fatal?: boolean; detail?: unknown }): void;\n /** Push an arbitrary `embed:custom` envelope. */\n sendCustom(channel: string, payload: unknown): void;\n}\n\n/** Wait for `window.ReachyMini` (set by the CDN script tag in\n * index.html). Resolves to `false` after a timeout. */\nfunction waitForSdkReady(timeoutMs: number): Promise<boolean> {\n return new Promise((resolve) => {\n if (typeof window === 'undefined') {\n resolve(false);\n return;\n }\n if (window.ReachyMini) {\n resolve(true);\n return;\n }\n const onReady = (): void => {\n window.removeEventListener('reachymini:ready', onReady);\n window.clearTimeout(handle);\n resolve(true);\n };\n const handle = window.setTimeout(() => {\n window.removeEventListener('reachymini:ready', onReady);\n resolve(false);\n }, timeoutMs);\n window.addEventListener('reachymini:ready', onReady, { once: true });\n });\n}\n\nfunction seedSessionToken(token: string | null | undefined, username: string | null | undefined): void {\n if (!token || !username) return;\n try {\n sessionStorage.setItem('hf_token', token);\n sessionStorage.setItem('hf_username', username);\n const ONE_HOUR = 60 * 60 * 1000;\n sessionStorage.setItem(\n 'hf_token_expires',\n new Date(Date.now() + ONE_HOUR).toISOString(),\n );\n } catch {\n /* swallow */\n }\n}\n\nfunction postToHost(msg: EmbedToHostMsg): void {\n if (typeof window === 'undefined') return;\n try {\n window.parent.postMessage(msg, window.location.origin);\n } catch (err) {\n console.warn('[@reachy-mini/host/embed] failed to postMessage to host', err);\n }\n}\n\nexport interface ConnectToHostOptions {\n /** SDK options forwarded to the constructor. `appName`,\n * `signalingUrl` and `clientId` are auto-set from `host:init`. */\n sdkOptions?: Partial<ReachyMiniOptions>;\n /** Optional override for the parent origin to validate. Defaults\n * to `window.location.origin` (same-origin iframe). */\n expectedOrigin?: string;\n}\n\n/**\n * Boot the embedded app: read creds, instantiate the SDK,\n * shake hands with the host, connect + start session + wake the\n * robot, then resolve with a ready-to-use SDK handle.\n *\n * Throws if the SDK script tag failed to load, if no creds bundle\n * was found in the URL hash, or if the host never sends\n * `host:init` (8 s timeout).\n */\nexport async function connectToHost<TConfig = unknown>(\n options: ConnectToHostOptions = {},\n): Promise<ConnectedHandle<TConfig>> {\n const expectedOrigin = options.expectedOrigin ?? window.location.origin;\n\n const creds: CredsBundle | null = decodeCredsFromHash(window.location.hash);\n if (!creds) {\n throw new Error(\n '[@reachy-mini/host/embed] no creds in URL hash - was the host expected to handshake?',\n );\n }\n // Don't leave creds in the address bar; they're meant for the\n // bootstrap only. (Some browsers expose hash to extensions.)\n try {\n history.replaceState(\n null,\n '',\n window.location.pathname + window.location.search,\n );\n } catch {\n /* swallow */\n }\n\n // Apply theme attribute synchronously so first paint matches.\n if (typeof document !== 'undefined') {\n document.documentElement.setAttribute('data-theme', creds.theme);\n }\n\n seedSessionToken(creds.hfToken ?? null, creds.username ?? null);\n\n // Wait for the SDK script tag (index.html loads it from CDN).\n const sdkReady = await waitForSdkReady(SDK_READY_TIMEOUT_MS);\n if (!sdkReady) {\n throw new Error(\n '[@reachy-mini/host/embed] ReachyMini SDK failed to load',\n );\n }\n\n const reachy = new window.ReachyMini({\n appName: creds.appName,\n signalingUrl: creds.signalingUrl,\n enableMicrophone: true,\n ...(options.sdkOptions ?? {}),\n });\n activeReachy = reachy;\n\n // Start the connection + session right away in parallel with the\n // host handshake. We DON'T need `host:init` for the SDK ramp-up\n // (everything we need is already in the hash). The handshake is\n // only required to register live config-change / theme-change\n // listeners and to enable bidirectional postMessage.\n const sessionPromise = (async () => {\n pushState('boot');\n pushState('connecting', 'link');\n if (creds.hfToken) {\n // Skip `authenticate()` - sessionStorage is already seeded.\n try {\n await reachy.authenticate();\n } catch {\n /* swallow - we'll let connect() bubble the real auth error */\n }\n }\n await reachy.connect();\n pushState('connecting', 'session');\n await reachy.startSession(creds.robotPeerId);\n pushState('connecting', 'wake');\n try {\n await reachy.ensureAwake();\n } catch (err) {\n console.warn('[@reachy-mini/host/embed] ensureAwake failed', err);\n }\n pushState('live');\n })();\n\n // βββ Subscriber registry βββββββββββββββββββββββββββββββββββββ\n const leaveCbs = new Set<() => void | Promise<void>>();\n const themeCbs = new Set<(t: ThemeMode) => void>();\n const configCbs = new Set<(c: TConfig | null) => void>();\n const customCbs = new Set<(channel: string, payload: unknown) => void>();\n\n let liveTheme: ThemeMode = creds.theme;\n let liveConfig: TConfig | null = (creds.config as TConfig | null) ?? null;\n let initMsg: HostInitMsg | null = null;\n\n function pushState(\n phase: AppPhase,\n connectingStep: AppConnectingStep | null = null,\n message: string | null = null,\n ): void {\n postToHost({\n source: PROTOCOL_SOURCE,\n type: 'embed:app-state',\n version: PROTOCOL_VERSION,\n phase,\n connectingStep,\n message,\n });\n }\n\n // βββ Listen for host pushes ββββββββββββββββββββββββββββββββββ\n const onMessage = (event: MessageEvent): void => {\n if (event.origin !== expectedOrigin) return;\n if (event.source !== window.parent) return;\n if (!isProtocolMessage(event.data)) return;\n const msg = event.data as HostToEmbedMsg;\n switch (msg.type) {\n case 'host:init': {\n initMsg = msg;\n if (msg.theme !== liveTheme) {\n liveTheme = msg.theme;\n document.documentElement.setAttribute('data-theme', liveTheme);\n themeCbs.forEach((cb) => cb(liveTheme));\n }\n if (msg.config !== liveConfig) {\n liveConfig = (msg.config as TConfig | null) ?? null;\n configCbs.forEach((cb) => cb(liveConfig));\n }\n break;\n }\n case 'host:theme-changed': {\n liveTheme = msg.theme;\n document.documentElement.setAttribute('data-theme', liveTheme);\n themeCbs.forEach((cb) => cb(liveTheme));\n break;\n }\n case 'host:config-changed': {\n liveConfig = (msg.config as TConfig | null) ?? null;\n configCbs.forEach((cb) => cb(liveConfig));\n break;\n }\n case 'host:leaving': {\n // Tear down in this order:\n // 1. fan out to the app's onLeave callbacks (they may\n // need to call gotoSleep, save state, etc.)\n // 2. stop the SDK session (releases the robot at the\n // central so the next pick can grab it again)\n // 3. ack the host so it doesn't have to wait its full\n // timeout before clearing the picker\n const ackChannel = pendingLeaveTokenRef;\n Promise.all(Array.from(leaveCbs).map((cb) => Promise.resolve(cb())))\n .catch((err) => console.warn('[@reachy-mini/host/embed] onLeave threw', err))\n .then(async () => {\n try {\n await reachy.stopSession();\n } catch (err) {\n console.warn('[@reachy-mini/host/embed] stopSession failed', err);\n }\n })\n .finally(() => {\n postToHost({\n source: PROTOCOL_SOURCE,\n type: 'embed:custom',\n version: PROTOCOL_VERSION,\n channel: 'leave-ack',\n payload: { token: ackChannel ?? null },\n });\n });\n break;\n }\n case 'host:custom': {\n // Capture leave-token before the leave message arrives so we\n // can echo it back on the ack.\n if (msg.channel === 'leave-token') {\n const token =\n typeof msg.payload === 'object' && msg.payload !== null\n ? (msg.payload as { token?: string }).token ?? null\n : null;\n pendingLeaveTokenRef = token;\n return;\n }\n customCbs.forEach((cb) => cb(msg.channel, msg.payload));\n break;\n }\n }\n };\n let pendingLeaveTokenRef: string | null = null;\n window.addEventListener('message', onMessage);\n\n // Tell the host we're alive. Send AFTER subscribing to receive\n // the reply.\n postToHost({\n source: PROTOCOL_SOURCE,\n type: 'embed:ready',\n version: PROTOCOL_VERSION,\n });\n\n // Wait for host:init (best-effort; we don't fail if it never\n // comes - the app still works off the hash creds).\n const waitInit = new Promise<void>((resolve) => {\n if (initMsg) {\n resolve();\n return;\n }\n const t = window.setTimeout(() => {\n window.removeEventListener('message', onResolve);\n resolve();\n }, HOST_INIT_TIMEOUT_MS);\n const onResolve = (event: MessageEvent): void => {\n if (event.origin !== expectedOrigin) return;\n if (!isProtocolMessage(event.data)) return;\n if ((event.data as HostToEmbedMsg).type !== 'host:init') return;\n window.removeEventListener('message', onResolve);\n window.clearTimeout(t);\n resolve();\n };\n window.addEventListener('message', onResolve);\n });\n\n await Promise.all([sessionPromise, waitInit]);\n\n // βββ Public API ββββββββββββββββββββββββββββββββββββββββββββββ\n const handle: ConnectedHandle<TConfig> = {\n reachy,\n theme: liveTheme,\n config: liveConfig,\n appName: creds.appName,\n hostName: creds.hostName,\n username: creds.username ?? null,\n onLeave(cb) {\n leaveCbs.add(cb);\n return () => {\n leaveCbs.delete(cb);\n };\n },\n onThemeChange(cb) {\n themeCbs.add(cb);\n return () => {\n themeCbs.delete(cb);\n };\n },\n onConfigChange(cb) {\n configCbs.add(cb);\n return () => {\n configCbs.delete(cb);\n };\n },\n onCustom(cb) {\n customCbs.add(cb);\n return () => {\n customCbs.delete(cb);\n };\n },\n setAppState(state) {\n pushState(\n state.phase,\n state.connectingStep ?? null,\n state.message ?? null,\n );\n },\n requestLeave() {\n postToHost({\n source: PROTOCOL_SOURCE,\n type: 'embed:request-leave',\n version: PROTOCOL_VERSION,\n });\n },\n requestConfigUpdate(patch) {\n postToHost({\n source: PROTOCOL_SOURCE,\n type: 'embed:request-config-update',\n version: PROTOCOL_VERSION,\n config: patch,\n });\n },\n reportError(message, opts) {\n postToHost({\n source: PROTOCOL_SOURCE,\n type: 'embed:error',\n version: PROTOCOL_VERSION,\n message,\n fatal: Boolean(opts?.fatal),\n detail: opts?.detail,\n });\n },\n sendCustom(channel, payload) {\n postToHost({\n source: PROTOCOL_SOURCE,\n type: 'embed:custom',\n version: PROTOCOL_VERSION,\n channel,\n payload,\n });\n },\n };\n\n // Forward motorStateChanged to the host via a reserved custom\n // channel so the host TopBar can paint the awake indicator\n // without instantiating its own SDK or reading motor events.\n const onMotorState = (event: Event): void => {\n const detail = (event as CustomEvent<{ awake?: boolean }>).detail;\n if (typeof detail?.awake !== 'boolean') return;\n postToHost({\n source: PROTOCOL_SOURCE,\n type: 'embed:custom',\n version: PROTOCOL_VERSION,\n channel: 'motor-state',\n payload: { awake: detail.awake },\n });\n };\n reachy.addEventListener('motorStateChanged', onMotorState);\n\n // Surface `pagehide` as an implicit leave so apps don't have to\n // double-register every time.\n const onPageHide = (): void => {\n leaveCbs.forEach((cb) => {\n try {\n void cb();\n } catch (err) {\n console.warn('[@reachy-mini/host/embed] onLeave threw on pagehide', err);\n }\n });\n try {\n void reachy.stopSession();\n } catch {\n /* swallow */\n }\n };\n window.addEventListener('pagehide', onPageHide);\n\n return handle;\n}\n\n/**\n * Cheap helper for callers that don't want to import the SDK types\n * directly: returns the live `window.ReachyMini` instance after\n * `connectToHost()` resolved. Mostly here so vanilla TS apps can\n * `import { getReachy } from '@reachy-mini/host/embed'` without\n * having to thread the handle around manually.\n *\n * Throws if called before `connectToHost()` resolves.\n */\nlet activeReachy: ReachyMiniInstance | null = null;\nexport function getReachy(): ReachyMiniInstance {\n if (!activeReachy) {\n throw new Error(\n '[@reachy-mini/host/embed] getReachy() called before connectToHost()',\n );\n }\n return activeReachy;\n}\n\n/** Internal hook used by `connectToHost()` to register the\n * module-level singleton. Exposed for unit tests; do not call\n * from app code. */\nexport function _registerActiveReachy(r: ReachyMiniInstance): void {\n activeReachy = r;\n}\n"],"names":["SDK_READY_TIMEOUT_MS","HOST_INIT_TIMEOUT_MS","waitForSdkReady","timeoutMs","resolve","onReady","handle","seedSessionToken","token","username","ONE_HOUR","postToHost","msg","err","connectToHost","options","expectedOrigin","creds","decodeCredsFromHash","reachy","activeReachy","sessionPromise","pushState","leaveCbs","themeCbs","configCbs","customCbs","liveTheme","liveConfig","initMsg","phase","connectingStep","message","PROTOCOL_SOURCE","PROTOCOL_VERSION","onMessage","event","isProtocolMessage","cb","ackChannel","pendingLeaveTokenRef","waitInit","onResolve","state","patch","opts","channel","payload","onMotorState","detail","onPageHide","getReachy"],"mappings":";AAqDA,MAAMA,IAAuB,KACvBC,IAAuB;AAmD7B,SAASC,EAAgBC,GAAqC;AAC5D,SAAO,IAAI,QAAQ,CAACC,MAAY;AAC9B,QAAI,OAAO,SAAW,KAAa;AACjC,MAAAA,EAAQ,EAAK;AACb;AAAA,IACF;AACA,QAAI,OAAO,YAAY;AACrB,MAAAA,EAAQ,EAAI;AACZ;AAAA,IACF;AACA,UAAMC,IAAU,MAAY;AAC1B,aAAO,oBAAoB,oBAAoBA,CAAO,GACtD,OAAO,aAAaC,CAAM,GAC1BF,EAAQ,E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Y;AAIzD,QAAME,IAAa,MAAY;AAC7B,IAAA3B,EAAS,QAAQ,CAACe,MAAO;AACvB,UAAI;AACF,QAAKA,EAAA;AAAA,MACP,SAASzB,GAAK;AACZ,gBAAQ,KAAK,uDAAuDA,CAAG;AAAA,MACzE;AAAA,IACF,CAAC;AACD,QAAI;AACF,MAAKM,EAAO,YAAA;AAAA,IACd,QAAQ;AAAA,IAER;AAAA,EACF;AACA,gBAAO,iBAAiB,YAAY+B,CAAU,GAEvC5C;AACT;AAWA,IAAIc,IAA0C;AACvC,SAAS+B,IAAgC;AAC9C,MAAI,CAAC/B;AACH,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAGJ,SAAOA;AACT;"}
|
|
|
|
| 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 *\n * Loaded inside the embedded app's iframe alongside the SDK:\n *\n * <script type=\"module\"\n * src=\"https://cdn.jsdelivr.net/npm/@reachy-mini/host@1/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 */\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 window.ReachyMiniHostEmbed = { connectToHost };\n}\n\nexport { connectToHost };\nexport type { ConnectedHandle, ConnectToHostOptions };\n"],"names":["connectToHost"],"mappings":";AA6BI,OAAO,SAAW,QACpB,OAAO,sBAAsB,EAAE,eAAAA,EAAA;"}
|
vendor/reachy-mini-host/dist/hooks/useHfProfile.d.ts
CHANGED
|
@@ -1,16 +1,7 @@
|
|
| 1 |
export interface HfProfile {
|
| 2 |
username: string | null;
|
| 3 |
-
/** Fully-qualified avatar URL ready to drop into an `<img>`. */
|
| 4 |
avatarUrl: string | null;
|
| 5 |
}
|
| 6 |
-
|
| 7 |
-
* Fetches the HF profile (avatar URL + username) for the current
|
| 8 |
-
* session.
|
| 9 |
-
*
|
| 10 |
-
* `triggerKey` is an opaque value that, when changed, forces a
|
| 11 |
-
* refetch. Passing the SDK's `username` works well here: it
|
| 12 |
-
* flips from `null` to the real handle on successful auth, which
|
| 13 |
-
* is exactly when we want to hit whoami-v2.
|
| 14 |
-
*/
|
| 15 |
-
export declare function useHfProfile(triggerKey: string | null): HfProfile;
|
| 16 |
//# sourceMappingURL=useHfProfile.d.ts.map
|
|
|
|
| 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
|
vendor/reachy-mini-host/dist/hooks/useHfProfile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"useHfProfile.d.ts","sourceRoot":"","sources":["../../src/hooks/useHfProfile.ts"],"names":[],"mappings":"
|
|
|
|
| 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"}
|