@nestor-home /卫星
要写的TypeScript SDK 卫星 用于 长者,在浏览器和
节点:与Nestor配对的设备(壁挂式平板电脑上的标签、树莓派扬声器、机器人)
服务器,流式音频通过WebRTC,执行其意图和报告他们观察到的,遵循
nestor.satellite/1 协议。它不依赖于Nestor服务器。
文档: nestorhome.dev / docs / sdk /打印稿 (节点,配对选项,QR码,命令,一致性)。
pnpm add @nestor-home/satellite
pnpm add @roamhq/wrtc # in Node only
卫星标签:作为卫星的标签:
import {
AUDIO_CAPTURE,
AUDIO_PLAYBACK,
browserWebRtc,
IDENTIFY,
LocalStorageTokenStore,
Manifest,
Satellite,
} from "@nestor-home/satellite";
const satellite = new Satellite({
core: location.origin,
manifest: Manifest.of(
{ id: "tablette-cuisine", model: "browser", room: "cuisine" },
AUDIO_CAPTURE,
AUDIO_PLAYBACK,
IDENTIFY,
),
tokens: new LocalStorageTokenStore(),
webrtc: browserWebRtc(),
pairing: {
// the device code to type in Nestor; `code` is null once it is no longer needed
display: (code, text) => {
document.querySelector("#code")!.textContent = code ?? "";
document.querySelector("#status")!.textContent = text;
},
},
body: {
behavior: (behavior) => (document.body.dataset.behavior = behavior),
identify: () => document.body.animate([{ opacity: 0.2 }, { opacity: 1 }], { duration: 500, iterations: 6 }),
},
});
button.onclick = () => satellite.run(); // a click: browsers only play sound after a gesture
在Node中,机器的麦克风和扬声器,没有什么可写的:
NESTOR_PAIRING_URI='nestor+http://nestor.local:8471/?code=K7QF2M9X' npx nestor-satellite run --room salon
设备码录音在CC BY 4.0下共享:参见
voice/LICENSE.
开发
pnpm install
pnpm lint && pnpm typecheck && pnpm test
pnpm conformance # the published server's conformance suite (uvx; version in .nestor-version)
许可证
麻省理工学院