clavarium 0.2.173-next.1 → 0.2.174-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/server/boxes.mjs +5 -7
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.174-next.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.174-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/server/boxes.mjs
CHANGED
|
@@ -23,7 +23,6 @@ export const CODE_MINUTES = 10;
|
|
|
23
23
|
export const PAIR_PATH = '/c/api/box/pair';
|
|
24
24
|
export const LINK_PATH = '/c/api/box/ws';
|
|
25
25
|
export const SENTENCE_MAX = 15 * 32_000 + 32_000; /* 15 s of 16 kHz 16-bit mono, and some slack */
|
|
26
|
-
export const ANSWER_MINUTES = 5; /* after a sentence, what the tool says is spoken */
|
|
27
26
|
export const TRIES_PER_MINUTE = 10;
|
|
28
27
|
export const NAME_MAX = 40;
|
|
29
28
|
/* Where a box in setup answers, on its own Wi-Fi: ESP-IDF's access point address, the same on
|
|
@@ -171,14 +170,13 @@ export class Boxes {
|
|
|
171
170
|
});
|
|
172
171
|
}
|
|
173
172
|
|
|
174
|
-
/* The tool said or asked something in a conversation
|
|
175
|
-
|
|
173
|
+
/* The tool said or asked something in a conversation: said aloud only by the boxes it is
|
|
174
|
+
addressed to (`to`: box ids, #215). Anything else stays in the thread, silent -- a box
|
|
175
|
+
read a whole technical message aloud once (31-10), which nobody wants. */
|
|
176
176
|
async agentSaid(conversation, text, to = null) {
|
|
177
177
|
const words = forSpeech(text);
|
|
178
|
-
if (!words) return;
|
|
179
|
-
const
|
|
180
|
-
const mine = [...this.#links.values()].filter((l) => l.box().conversation === conversation);
|
|
181
|
-
const boxes = Array.isArray(to) && to.length ? mine.filter((l) => to.includes(l.box().id)) : mine.filter((l) => l.heardAt > now - ANSWER_MINUTES * 60_000);
|
|
178
|
+
if (!words || !Array.isArray(to) || to.length === 0) return;
|
|
179
|
+
const boxes = [...this.#links.values()].filter((l) => l.box().conversation === conversation && to.includes(l.box().id));
|
|
182
180
|
if (boxes.length === 0) return;
|
|
183
181
|
let pcm;
|
|
184
182
|
try { pcm = await this.#speak(words); } catch (error) { this.#log(`voice box: no voice for the answer (${error.message})`); for (const l of boxes) l.send({ t: 'cue', name: 'error' }); return; }
|