The agent's ears and voice: a server on the home server transcribes a clip (sox, whisper.cpp) and speaks text (piper), one job at a time. A gate hands the capability to whoever presents its key; the key comes from systemd's credentials, not argv. make test runs the unit tests in Nix's sandbox; make smoke starts a real server on localhost, speaks a phrase, and hears it back. Generated-by: Claude Opus 5.5
14 lines
521 B
JavaScript
14 lines
521 B
JavaScript
// Tests for the gate, in process: no network.
|
|
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { makeGate } from './gate.js';
|
|
|
|
test('the right key opens the gate; a wrong one is refused', () => {
|
|
const cap = { it: 'the capability' };
|
|
const gate = makeGate('k3y', cap);
|
|
assert.equal(gate.open('k3y'), cap);
|
|
assert.throws(() => gate.open('guess'), /no such key/);
|
|
assert.throws(() => gate.open(''), /no such key/);
|
|
assert.throws(() => gate.open(undefined), /no such key/);
|
|
});
|