feat: the brain can change the box's speaker volume
"Speak up" and "too loud" now work: the reply tool takes louder, in percentage points, and the button service nudges the speaker's softvol before it speaks that reply, so the person hears the change at once. The box keeps the level between 10% and 80% (body/mixer.py). No new port or key: the volume changes only with a reply, in a conversation someone is listening to. Generated-by: Claude Opus 5.5
This commit is contained in:
1 parent
cf503ac247
commit
5191ee9931
11 files changed
+146
-21
No files matched your search
+17
-1
@@ -1,7 +1,7 @@
|
||||
// Tests for the ask capability's core: no MCP, no network, no real timers.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { Channel, Asker, MAX_QUESTION_CHARS } from './ask.js';
|
||||
import { Channel, Asker, MAX_LOUDER, MAX_QUESTION_CHARS } from './ask.js';
|
||||
|
||||
const harness = () => {
|
||||
const sent = [], timers = [];
|
||||
@@ -52,6 +52,22 @@ test('the box ends a conversation; the brain hears it, with no question to answe
|
||||
assert.throws(() => channel.end('k 7; rm', 'box'), /conversation/);
|
||||
});
|
||||
|
||||
test('a reply can turn the volume up or down; out of range, it speaks but leaves the volume', async () => {
|
||||
const { channel } = harness();
|
||||
const up = channel.ask('Speak up!', 'box');
|
||||
assert.match(channel.reply('c1', 'Is this better?', false, 10), /louder by 10/);
|
||||
assert.deepEqual(await up, { text: 'Is this better?', end: false, louder: 10 });
|
||||
const down = channel.ask('Too loud.', 'box');
|
||||
assert.match(channel.reply('c2', 'Sorry.', false, -5), /softer by 5/);
|
||||
assert.deepEqual(await down, { text: 'Sorry.', end: false, louder: -5 });
|
||||
const way = channel.ask('Way up!', 'box');
|
||||
assert.match(channel.reply('c3', 'Okay.', false, MAX_LOUDER + 1), /volume is unchanged/);
|
||||
assert.deepEqual(await way, { text: 'Okay.', end: false });
|
||||
const odd = channel.ask('Louder?', 'box');
|
||||
assert.match(channel.reply('c4', 'Hm.', false, 'max'), /volume is unchanged/);
|
||||
assert.deepEqual(await odd, { text: 'Hm.', end: false });
|
||||
});
|
||||
|
||||
test('replies go to the right question; a stale chat_id is reported, not thrown', async () => {
|
||||
const { channel } = harness();
|
||||
const a = channel.ask('one', 'box');
|
||||
|
||||
Reference in new issue
Block a user