Files
pi-gui/src/client/noctalia-relay-cli.js
T
alex 0949c6f0d7 refactor!: remove redundant compatibility layers
Use native browser and Tauri behavior instead of custom selector, dialog, and window-state implementations. Remove obsolete bridge, relay, asset, and dependency paths to keep the supported surface small.

BREAKING CHANGE: The Noctalia relay no longer accepts --agent, and the Tauri host no longer exposes the legacy load_agent command.
2026-08-31 17:35:07 +02:00

41 lines
1.1 KiB
JavaScript
Executable File

#!/usr/bin/env node
import { connectLocalClient } from "./local-client.js";
import { publishNoctaliaState } from "./noctalia-ipc.js";
import { createNoctaliaStateRelay } from "./noctalia-relay.js";
function flag(args, name) {
const index = args.indexOf(name);
return index >= 0 ? args[index + 1] : undefined;
}
async function run() {
const args = process.argv.slice(2);
const socketPath =
flag(args, "--socket") ?? process.env.PI_STATUS_BRIDGE_SOCKET;
if (!socketPath)
throw new Error("Usage: pi-status-bridge-noctalia-relay --socket <path>");
const client = await connectLocalClient({ socketPath });
const relay = createNoctaliaStateRelay({
client,
onState: (state) =>
void publishNoctaliaState(state).catch((error) =>
process.stderr.write(`${error.message}\n`),
),
});
await relay.start();
await new Promise((resolve) => {
const shutdown = () => resolve();
process.once("SIGINT", shutdown);
process.once("SIGTERM", shutdown);
});
relay.stop();
await client.close();
}
run().catch((error) => {
process.stderr.write(
`${error instanceof Error ? error.message : "Noctalia relay failed"}\n`,
);
process.exitCode = 1;
});