import assert from "node:assert/strict"; import test from "node:test"; import { createNoctaliaStateRelay } from "../src/client/noctalia-relay.js"; test("relays aggregate workspace summary as compact Noctalia state", async () => { const updates = []; const relay = createNoctaliaStateRelay({ client: { request: async (operation) => { assert.equal(operation, "get_workspace_summary"); return { openCount: 3, workingCount: 1, attentionCount: 2, recoveringCount: 0, errorCount: 1 }; } }, onState: (state) => updates.push(state), pollMs: 250, }); await relay.start(); relay.stop(); assert.deepEqual(updates, [{ state: "error", projectLabel: "3 sessions", attentionCount: 2, detail: "3 open · 1 working · 2 attention · 0 recovering · 1 errors", openCount: 3, workingCount: 1, recoveringCount: 0, errorCount: 1 }]); });