426e9eeabd
Benchmark Bridge Tests / benchmark (bunx @biomejs/biome check packages/lifeops-bench/src, benchmark-lint) (push) Waiting to run
Benchmark Bridge Tests / benchmark (bunx vitest run --config packages/lifeops-bench/vitest.config.ts --root packages/lifeops-bench --passWithNoTests, benchmark-tests) (push) Waiting to run
Build Agent Image / build-and-push (push) Waiting to run
Chat shell gestures / Chat shell gesture + parity e2e (push) Waiting to run
ci / test (push) Waiting to run
ci / lint-and-format (push) Waiting to run
ci / build (push) Waiting to run
ci / dev-startup (push) Waiting to run
Cloud Gateway Discord / Test (push) Waiting to run
Cloud Gateway Webhook / Test (push) Waiting to run
Cloud Tests / lint-and-types (push) Waiting to run
Cloud Tests / unit-tests (push) Waiting to run
Cloud Tests / integration-tests (push) Waiting to run
Cloud Tests / e2e-tests (push) Blocked by required conditions
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Deploy Apps Worker (Product 2) / Determine environment (push) Waiting to run
Deploy Apps Worker (Product 2) / Deploy apps worker to apps-control host (${{ needs.determine-env.outputs.environment }}) (push) Blocked by required conditions
Deploy Eliza Provisioning Worker / Determine environment (push) Waiting to run
Deploy Eliza Provisioning Worker / Deploy worker to Hetzner host (${{ needs.determine-env.outputs.environment }} @ ${{ needs.determine-env.outputs.deployment_sha }}) (push) Blocked by required conditions
Dev Smoke / Classify changed paths (push) Waiting to run
Dev Smoke / bun run dev onboarding chat (push) Blocked by required conditions
Dev Smoke / Vite HMR dependency-level smoke (push) Blocked by required conditions
Electrobun Submodule Guard / electrobun gitlink is fetchable (push) Waiting to run
gitleaks / gitleaks (push) Waiting to run
Markdown Links / Relative Markdown Links (push) Waiting to run
Publish @elizaos/example-code / check_npm (push) Waiting to run
Publish @elizaos/example-code / publish_npm (push) Blocked by required conditions
Publish @elizaos/plugin-elizacloud / verify_version (push) Waiting to run
Publish @elizaos/plugin-elizacloud / publish_npm (push) Blocked by required conditions
Quality (Extended) / Homepage Build (PR smoke) (push) Waiting to run
Quality (Extended) / Comment-only diff guard (push) Waiting to run
Quality (Extended) / Format + Type Safety Ratchet (push) Waiting to run
Quality (Extended) / Develop Gate (secret scan + UI determinism) (push) Waiting to run
Quality (Extended) / Develop Gate (lint) (push) Waiting to run
Sandbox Live Smoke / Sandbox live smoke (push) Waiting to run
Snap Build & Test / Build Snap (amd64) (push) Waiting to run
Snap Build & Test / Build Snap (arm64) (push) Waiting to run
supply-chain / sbom (push) Waiting to run
supply-chain / vulnerability-scan (push) Waiting to run
Build, Push & Deploy to Phala Cloud / build-and-push (push) Waiting to run
Test Packaging / Validate Packaging Configs (push) Waiting to run
Test Packaging / PyPI on Python ${{ matrix.python }} (push) Waiting to run
Test Packaging / Pack & Test JS Tarballs (push) Waiting to run
Test Packaging / elizaos CLI global-install smoke (node + bun) (push) Waiting to run
UI Fixture E2E / ui-fixture-e2e (push) Waiting to run
UI Fixture E2E / fixture-e2e (push) Waiting to run
UI Story Gate / story-gate (push) Waiting to run
vault-ci / test (macos-latest) (push) Waiting to run
vault-ci / test (ubuntu-latest) (push) Waiting to run
vault-ci / test (windows-latest) (push) Waiting to run
vault-ci / app-core wiring tests (push) Waiting to run
verify-patches / verify patches/CHECKSUMS.sha256 (push) Waiting to run
Voice Benchmark Smoke / voice-emotion fixture smoke (push) Waiting to run
Voice Benchmark Smoke / voiceagentbench fixture smoke (push) Waiting to run
Voice Benchmark Smoke / voicebench-quality unit smoke (push) Waiting to run
Voice Benchmark Smoke / voicebench TypeScript unit (no audio) (push) Waiting to run
Voice Benchmark Smoke / voice bench smoke summary (push) Blocked by required conditions
Windows CI / windows ([bun run --cwd packages/app-core test bun run --cwd packages/elizaos test bun run --cwd packages/cloud/shared test], app-and-cli) (push) Waiting to run
Windows CI / windows ([bun run --cwd packages/scenario-runner test bun run --cwd packages/vault test bun run --cwd packages/security test bun run --cwd plugins/plugin-coding-tools test], framework-packages) (push) Waiting to run
Windows CI / windows ([bun run --cwd plugins/plugin-elizacloud test bun run --cwd plugins/plugin-discord test bun run --cwd plugins/plugin-anthropic test bun run --cwd plugins/plugin-openai test bun run --cwd plugins/plugin-app-control test bun run --cwd plugins/pl… (push) Waiting to run
Windows CI / windows ([node packages/scripts/run-turbo.mjs run build --filter=@elizaos/core --filter=@elizaos/shared --filter=@elizaos/agent --concurrency=4 node packages/scripts/run-bash-linux-only.mjs scripts/verify-riscv64-buildpaths.sh node packages/scripts/run… (push) Waiting to run
Windows CI / windows ([node packages/scripts/run-turbo.mjs run typecheck --filter=@elizaos/core --filter=@elizaos/shared --filter=@elizaos/cloud-shared --concurrency=4 bun run --cwd packages/core test bun run --cwd packages/shared test], core-runtime, 75) (push) Waiting to run
Test Packaging / Build & Test PyPI Package (push) Waiting to run
Voice Workbench / headless workbench (mocked backends) (push) Has been cancelled
Voice Workbench / real acoustic lane (nightly, provisioned only) (push) Has been cancelled
325 lines
9.6 KiB
TypeScript
325 lines
9.6 KiB
TypeScript
// Supports the Smartglasses example described in this package README.
|
|
import {
|
|
G1Command,
|
|
G1DashboardLayout,
|
|
MockSmartglassesTransport,
|
|
SmartglassesService,
|
|
} from "@elizaos/plugin-facewear";
|
|
|
|
const transport = new MockSmartglassesTransport();
|
|
const service = new SmartglassesService();
|
|
service.setTransport(transport);
|
|
service.setAudioDecoder(() => Uint8Array.from([0, 0, 0, 64]));
|
|
|
|
service.onRawAudio((audio, sampleRate, side, encoding, sequence) => {
|
|
console.log(
|
|
`audio side=${side} sampleRate=${sampleRate} encoding=${encoding} sequence=${sequence ?? "none"} bytes=${audio.length}`,
|
|
);
|
|
});
|
|
service.onAudio((pcm, sampleRate, side) => {
|
|
console.log(
|
|
`decoded pcm side=${side} sampleRate=${sampleRate} samples=${pcm.length}`,
|
|
);
|
|
});
|
|
|
|
await service.connect();
|
|
await service.displayText("Eliza is connected to Even Realities smartglasses.");
|
|
await service.displayText("Direct Text Show mode is available.", {
|
|
mode: "text",
|
|
});
|
|
await service.displayRsvpText("RSVP display streams short word groups.", {
|
|
wordsPerGroup: 2,
|
|
mode: "text",
|
|
skipDelay: true,
|
|
});
|
|
await service.pageUp();
|
|
await service.pageDown();
|
|
service.startHeartbeatLoop({ intervalMs: 1000 });
|
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
service.stopHeartbeatLoop();
|
|
await service.requestBatteryStatus();
|
|
await service.setBrightness(10, true);
|
|
await service.setDashboard(true, 4);
|
|
await service.setDashboardPosition(3, 7);
|
|
await service.setDashboardLayout(G1DashboardLayout.Dual);
|
|
await service.sendDashboardCalendarItem({
|
|
name: "Eliza standup",
|
|
time: "13:30-14:30",
|
|
location: "Lab",
|
|
});
|
|
await service.sendDashboardTimeWeather({
|
|
seqId: 1,
|
|
timestampMs: 1_700_000_000_000,
|
|
timezoneOffsetSeconds: 0,
|
|
temperatureInCelsius: 21,
|
|
weatherIcon: 0x10,
|
|
});
|
|
await service.sendG1Setup({ calendar_enable: true });
|
|
await service.startNavigation();
|
|
await service.sendNavigationDirections({
|
|
totalDuration: "4 min",
|
|
totalDistance: "1 km",
|
|
direction: "Main St",
|
|
distance: "200 m",
|
|
speed: "30",
|
|
directionTurn: 0x03,
|
|
});
|
|
await service.sendNavigationPoller();
|
|
await service.endNavigation();
|
|
await service.sendTranslateSetup();
|
|
await service.startTranslate();
|
|
await service.setTranslateLanguages(0x02, 0x05);
|
|
await service.sendTranslateText("translated", "bonjour", 3);
|
|
await service.setHeadUpAngle(20);
|
|
await service.setSilentMode(false);
|
|
await service.setGlassesWearDetection(true);
|
|
await service.scanWifi();
|
|
await service.configureWifi("ExampleNet", "secret");
|
|
await service.requestWifiSetup("Example needs headset Wi-Fi");
|
|
await service.getWifiStatus();
|
|
await service.sendConnectionReady();
|
|
await service.sendConnectionReady("both", "official");
|
|
await service.sendConnectionReady("both", "android-f4");
|
|
await service.exitFunction();
|
|
await service.requestSerial("right");
|
|
await service.sendAppWhitelist({ apps: ["eliza"] });
|
|
await service.sendRaw(Uint8Array.from([0x4d, 0x01]), "left");
|
|
await service.addOrUpdateNote(1, "Eliza", "Smartglasses example note");
|
|
await service.requestVoiceNoteList({ syncId: 1 });
|
|
await service.requestVoiceNoteAudio(1, { syncId: 2 });
|
|
await service.deleteVoiceNoteAudio(1, { syncId: 3 });
|
|
await service.deleteAllVoiceNoteAudio({ syncId: 4 });
|
|
await service.sendMonochromeBmpImage(Uint8Array.from([0, 255, 255, 0]), {
|
|
width: 2,
|
|
height: 2,
|
|
});
|
|
await service.sendNotification({
|
|
appIdentifier: "eliza",
|
|
title: "Eliza",
|
|
message: "Smartglasses example notification",
|
|
});
|
|
|
|
transport.emitRaw("left", Uint8Array.from([0xf5, 0x17]));
|
|
transport.emitRaw("right", Uint8Array.from([0xf1, 1, 0, 0, 0, 64]));
|
|
transport.emitRaw(
|
|
"left",
|
|
Uint8Array.from([G1Command.Battery, 0x66, 88, 0x02, 0x9c, 0x0f]),
|
|
);
|
|
transport.emitRaw(
|
|
"right",
|
|
Uint8Array.from([G1Command.Battery, 0x66, 84, 0x02, 0x88, 0x0f]),
|
|
);
|
|
transport.emitRaw(
|
|
"right",
|
|
Uint8Array.from([
|
|
G1Command.GetSerial,
|
|
0xc9,
|
|
...new TextEncoder().encode("G1RIGHTSERIAL001"),
|
|
0,
|
|
]),
|
|
);
|
|
transport.emitRaw("left", Uint8Array.from([0xf5, 0x18]));
|
|
transport.emitRaw("right", Uint8Array.from([0xf5, 0x01]));
|
|
transport.emitRaw("right", Uint8Array.from([0xf5, 0x00]));
|
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
|
|
const writes = transport.writes.map((write) => ({
|
|
side: write.side,
|
|
command: `0x${write.data[0].toString(16).padStart(2, "0")}`,
|
|
bytes: Array.from(write.data),
|
|
}));
|
|
|
|
console.log(JSON.stringify({ status: service.getStatus(), writes }, null, 2));
|
|
|
|
if (!transport.writes.some((write) => write.data[0] === G1Command.SendResult)) {
|
|
throw new Error("Example did not send display packets");
|
|
}
|
|
if (
|
|
!transport.writes.some(
|
|
(write) => write.data[0] === G1Command.OpenMic && write.data[1] === 1,
|
|
)
|
|
) {
|
|
throw new Error("Example did not enable the microphone");
|
|
}
|
|
if (
|
|
!transport.writes.some(
|
|
(write) => write.data[0] === G1Command.OpenMic && write.data[1] === 0,
|
|
)
|
|
) {
|
|
throw new Error("Example did not disable the microphone");
|
|
}
|
|
if (!transport.writes.some((write) => write.data[0] === G1Command.Brightness)) {
|
|
throw new Error("Example did not send brightness settings");
|
|
}
|
|
if (
|
|
!transport.writes.some(
|
|
(write) => write.data[0] === G1Command.DashboardContent,
|
|
)
|
|
) {
|
|
throw new Error("Example did not send dashboard content packets");
|
|
}
|
|
if (!transport.writes.some((write) => write.data[0] === G1Command.Navigation)) {
|
|
throw new Error("Example did not send navigation packets");
|
|
}
|
|
if (
|
|
!transport.writes.some((write) => write.data[0] === G1Command.TranslateSetup)
|
|
) {
|
|
throw new Error("Example did not send translation setup packets");
|
|
}
|
|
if (
|
|
!transport.writes.some(
|
|
(write) => write.data[0] === G1Command.TranslateTranslatedText,
|
|
)
|
|
) {
|
|
throw new Error("Example did not send translated text packets");
|
|
}
|
|
if (
|
|
!transport.writes.some(
|
|
(write) => write.side === "left" && write.data[0] === G1Command.Init,
|
|
) ||
|
|
!transport.writes.some(
|
|
(write) => write.side === "right" && write.data[0] === G1Command.RightInit,
|
|
)
|
|
) {
|
|
throw new Error("Example did not send connection-ready packets");
|
|
}
|
|
if (
|
|
transport.writes.filter(
|
|
(write) =>
|
|
write.data[0] === G1Command.Init &&
|
|
write.data[1] === 0x01 &&
|
|
(write.side === "left" || write.side === "right"),
|
|
).length < 3
|
|
) {
|
|
throw new Error("Example did not send official same-init packets");
|
|
}
|
|
if (
|
|
transport.writes.filter(
|
|
(write) =>
|
|
write.data[0] === G1Command.RightInit &&
|
|
write.data[1] === 0x01 &&
|
|
(write.side === "left" || write.side === "right"),
|
|
).length < 3
|
|
) {
|
|
throw new Error("Example did not send Android F4 same-init packets");
|
|
}
|
|
if (
|
|
!transport.writes.some((write) => write.data[0] === G1Command.ExitFunction)
|
|
) {
|
|
throw new Error("Example did not send native function-exit packets");
|
|
}
|
|
if (!transport.writes.some((write) => write.data[0] === G1Command.GetSerial)) {
|
|
throw new Error("Example did not send serial request packets");
|
|
}
|
|
if (service.getStatus().lastSerialNumber !== "G1RIGHTSERIAL001") {
|
|
throw new Error("Example did not parse serial response packets");
|
|
}
|
|
if (
|
|
!transport.writes.some((write) => write.data[0] === G1Command.AppWhitelist)
|
|
) {
|
|
throw new Error("Example did not send app whitelist packets");
|
|
}
|
|
if (
|
|
!transport.writes.some(
|
|
(write) => write.data[0] === 0x4d && write.data[1] === 0x01,
|
|
)
|
|
) {
|
|
throw new Error("Example did not send raw packets");
|
|
}
|
|
if (
|
|
!transport.writes.some(
|
|
(write) =>
|
|
write.side === "left" &&
|
|
write.data[0] === G1Command.StartAi &&
|
|
write.data[1] === 1,
|
|
) ||
|
|
!transport.writes.some(
|
|
(write) =>
|
|
write.side === "right" &&
|
|
write.data[0] === G1Command.StartAi &&
|
|
write.data[1] === 1,
|
|
)
|
|
) {
|
|
throw new Error("Example did not send manual page controls");
|
|
}
|
|
if (!transport.writes.some((write) => write.data[0] === G1Command.Heartbeat)) {
|
|
throw new Error("Example did not send heartbeat packets");
|
|
}
|
|
if (!transport.writes.some((write) => write.data[0] === G1Command.Battery)) {
|
|
throw new Error("Example did not send battery status request packets");
|
|
}
|
|
if (
|
|
service.getStatus().batteryLevels.left !== 88 ||
|
|
service.getStatus().batteryLevels.right !== 84
|
|
) {
|
|
throw new Error("Example did not parse battery status responses");
|
|
}
|
|
if (
|
|
!transport.writes.some((write) => write.data[0] === G1Command.Notification)
|
|
) {
|
|
throw new Error("Example did not send notification packets");
|
|
}
|
|
if (
|
|
!transport.writes.some(
|
|
(write) =>
|
|
write.data[0] === G1Command.Note &&
|
|
write.data[3] === 1 &&
|
|
write.data[4] === 1,
|
|
)
|
|
) {
|
|
throw new Error("Example did not send voice note list packets");
|
|
}
|
|
if (
|
|
!transport.writes.some(
|
|
(write) =>
|
|
write.data[0] === G1Command.Note &&
|
|
write.data[3] === 2 &&
|
|
write.data[4] === 2,
|
|
)
|
|
) {
|
|
throw new Error("Example did not send voice note fetch packets");
|
|
}
|
|
if (
|
|
!transport.writes.some(
|
|
(write) =>
|
|
write.data[0] === G1Command.Note &&
|
|
write.data[3] === 3 &&
|
|
write.data[4] === 4,
|
|
)
|
|
) {
|
|
throw new Error("Example did not send voice note delete packets");
|
|
}
|
|
if (
|
|
!transport.writes.some(
|
|
(write) =>
|
|
write.data[0] === G1Command.Note &&
|
|
write.data[3] === 4 &&
|
|
write.data[4] === 5,
|
|
)
|
|
) {
|
|
throw new Error("Example did not send voice note delete-all packets");
|
|
}
|
|
if (
|
|
!transport.writes.some(
|
|
(write) =>
|
|
write.data[0] === G1Command.BmpData &&
|
|
write.data[6] === 0x42 &&
|
|
write.data[7] === 0x4d,
|
|
)
|
|
) {
|
|
throw new Error("Example did not send generated BMP packets");
|
|
}
|
|
if (
|
|
JSON.stringify(transport.wifiRequests) !==
|
|
JSON.stringify([
|
|
{ op: "scan" },
|
|
{ op: "configure", ssid: "ExampleNet", password: "secret" },
|
|
{ op: "status" },
|
|
])
|
|
) {
|
|
throw new Error("Example did not exercise Wi-Fi service methods");
|
|
}
|
|
if (service.getStatus().lastWifiStatus?.status !== "mock-wifi-ready") {
|
|
throw new Error("Example did not preserve Wi-Fi status");
|
|
}
|