feat(bridge): establish local pi status bridge

Deliver the initial local bridge, Noctalia v4/v5 adapters, desktop client, service unit, tests, and implementation documentation for persistent Pi status and control.
This commit is contained in:
2026-07-27 14:51:45 +02:00
commit b7fea83ed6
91 changed files with 15029 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
import assert from "node:assert/strict";
import { mkdtemp, stat } from "node:fs/promises";
import { tmpdir } from "node:os";
import test from "node:test";
import { BridgeAlreadyRunningError } from "../src/bridge/instance-lock.js";
import {
createRuntimePaths,
startBridgeServer,
} from "../src/bridge/runtime.js";
test("creates a private runtime directory and enforces one live bridge", async () => {
const runtimeDir = await mkdtemp(`${tmpdir()}/pi-status-bridge-runtime-`);
const paths = await createRuntimePaths(runtimeDir);
const runtimeStats = await stat(paths.directory);
assert.equal(runtimeStats.mode & 0o777, 0o700);
const bridge = await startBridgeServer({
runtimeDir,
handleRequest: async () => ({}),
});
try {
await assert.rejects(
startBridgeServer({ runtimeDir, handleRequest: async () => ({}) }),
BridgeAlreadyRunningError,
);
} finally {
await bridge.close();
}
});