open-agents-ai 0.187.280 → 0.187.281
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/dist/index.js +18 -28
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -328305,6 +328305,8 @@ var init_voicechat = __esm({
|
|
|
328305
328305
|
model;
|
|
328306
328306
|
apiKey;
|
|
328307
328307
|
runner;
|
|
328308
|
+
verbose = false;
|
|
328309
|
+
debugSnr = false;
|
|
328308
328310
|
// State machine
|
|
328309
328311
|
_state = "IDLE";
|
|
328310
328312
|
active = false;
|
|
@@ -328337,6 +328339,8 @@ var init_voicechat = __esm({
|
|
|
328337
328339
|
this.model = opts.model;
|
|
328338
328340
|
this.apiKey = opts.apiKey ?? "";
|
|
328339
328341
|
this.runner = opts.runner ?? null;
|
|
328342
|
+
this.verbose = Boolean(opts.verbose);
|
|
328343
|
+
this.debugSnr = Boolean(opts.debugSnr);
|
|
328340
328344
|
this.onStatus = opts.onStatus ?? (() => {
|
|
328341
328345
|
});
|
|
328342
328346
|
this.onUserSpeech = opts.onUserSpeech ?? (() => {
|
|
@@ -328376,7 +328380,7 @@ var init_voicechat = __esm({
|
|
|
328376
328380
|
this.active = true;
|
|
328377
328381
|
this.context = [{ role: "system", content: SYSTEM_PROMPT2 }];
|
|
328378
328382
|
this.turnCount = 0;
|
|
328379
|
-
this.onStatus("VoiceChat
|
|
328383
|
+
if (this.verbose) this.onStatus("VoiceChat active — LISTENING");
|
|
328380
328384
|
this._onTranscript = (...args) => {
|
|
328381
328385
|
let text;
|
|
328382
328386
|
let isFinal;
|
|
@@ -328406,7 +328410,7 @@ var init_voicechat = __esm({
|
|
|
328406
328410
|
await this.listen.stop().catch(() => {
|
|
328407
328411
|
});
|
|
328408
328412
|
await this.listen.start();
|
|
328409
|
-
this.onStatus("Mic auto-recovered — LISTENING");
|
|
328413
|
+
if (this.verbose) this.onStatus("Mic auto-recovered — LISTENING");
|
|
328410
328414
|
} catch {
|
|
328411
328415
|
}
|
|
328412
328416
|
}, 1e3);
|
|
@@ -328417,11 +328421,9 @@ var init_voicechat = __esm({
|
|
|
328417
328421
|
try {
|
|
328418
328422
|
await this.listen.start();
|
|
328419
328423
|
this.setState("LISTENING");
|
|
328420
|
-
this.onStatus("Mic active — LISTENING for speech...");
|
|
328424
|
+
if (this.verbose) this.onStatus("Mic active — LISTENING for speech...");
|
|
328421
328425
|
} catch (err) {
|
|
328422
|
-
this.onStatus(
|
|
328423
|
-
`Mic failed: ${err instanceof Error ? err.message : String(err)}. VoiceChat active without mic.`
|
|
328424
|
-
);
|
|
328426
|
+
this.onStatus(`Mic failed: ${err instanceof Error ? err.message : String(err)}. VoiceChat active without mic.`);
|
|
328425
328427
|
this.setState("LISTENING");
|
|
328426
328428
|
}
|
|
328427
328429
|
}
|
|
@@ -328456,7 +328458,7 @@ var init_voicechat = __esm({
|
|
|
328456
328458
|
} catch {
|
|
328457
328459
|
}
|
|
328458
328460
|
this.setState("IDLE");
|
|
328459
|
-
this.onStatus("VoiceChat ended");
|
|
328461
|
+
if (this.verbose) this.onStatus("VoiceChat ended");
|
|
328460
328462
|
this.emit("stopped");
|
|
328461
328463
|
}
|
|
328462
328464
|
// ---------------------------------------------------------------------------
|
|
@@ -328512,7 +328514,7 @@ var init_voicechat = __esm({
|
|
|
328512
328514
|
}
|
|
328513
328515
|
const score = this.lastSignalScore ?? computeSignalFromText(text);
|
|
328514
328516
|
if (score < MIN_SIGNAL_SCORE || NOISE_ONLY_RE.test(text)) {
|
|
328515
|
-
this.onStatus(`Ignoring low-signal utterance (SNR:${score.toFixed(2)}): ${truncateForLog(text, 48)}`);
|
|
328517
|
+
if (this.debugSnr) this.onStatus(`Ignoring low-signal utterance (SNR:${score.toFixed(2)}): ${truncateForLog(text, 48)}`);
|
|
328516
328518
|
this.emit("snrFiltered", { score, text });
|
|
328517
328519
|
this.setState("LISTENING");
|
|
328518
328520
|
this.captureBuffer = "";
|
|
@@ -328540,7 +328542,7 @@ var init_voicechat = __esm({
|
|
|
328540
328542
|
async think() {
|
|
328541
328543
|
if (!this.active) return;
|
|
328542
328544
|
this.setState("THINKING");
|
|
328543
|
-
this.onStatus("Thinking...");
|
|
328545
|
+
if (this.verbose) this.onStatus("Thinking...");
|
|
328544
328546
|
this.abortController = new AbortController();
|
|
328545
328547
|
try {
|
|
328546
328548
|
const response = await this.streamOllamaInference(this.abortController.signal);
|
|
@@ -328574,7 +328576,7 @@ var init_voicechat = __esm({
|
|
|
328574
328576
|
}
|
|
328575
328577
|
if (this.active) {
|
|
328576
328578
|
this.setState("LISTENING");
|
|
328577
|
-
this.onStatus("LISTENING...");
|
|
328579
|
+
if (this.verbose) this.onStatus("LISTENING...");
|
|
328578
328580
|
}
|
|
328579
328581
|
}
|
|
328580
328582
|
/**
|
|
@@ -333127,36 +333129,24 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
333127
333129
|
model: currentConfig.model,
|
|
333128
333130
|
apiKey: currentConfig.apiKey,
|
|
333129
333131
|
runner: summaryRunner,
|
|
333132
|
+
verbose: false,
|
|
333133
|
+
debugSnr: false,
|
|
333130
333134
|
onStatus(msg) {
|
|
333131
333135
|
writeContent(() => renderInfo2(`[voicechat] ${msg}`));
|
|
333132
333136
|
},
|
|
333133
333137
|
onUserSpeech(text) {
|
|
333134
333138
|
writeContent(() => renderInfo2(`\x1B[38;5;45m[you]\x1B[0m ${text}`));
|
|
333135
333139
|
},
|
|
333136
|
-
|
|
333137
|
-
|
|
333138
|
-
process.stdout.write(`\r\x1B[2K\x1B[38;5;243m [hearing] ${text.slice(0, 70)}\x1B[0m`);
|
|
333139
|
-
});
|
|
333140
|
+
// Suppressed to keep main loop quiet
|
|
333141
|
+
onPartialTranscript(_text) {
|
|
333140
333142
|
},
|
|
333141
333143
|
onAgentSpeech(text) {
|
|
333142
333144
|
writeContent(() => renderInfo2(`\x1B[38;5;178m[agent]\x1B[0m ${text.slice(0, 120)}`));
|
|
333143
333145
|
},
|
|
333144
|
-
|
|
333145
|
-
|
|
333146
|
-
}
|
|
333147
|
-
});
|
|
333148
|
-
_voiceChatSession2.on("snr", (e2) => {
|
|
333149
|
-
const s2 = typeof e2?.score === "number" ? Math.max(0, Math.min(1, e2.score)) : null;
|
|
333150
|
-
if (s2 !== null) {
|
|
333151
|
-
writeContent(() => {
|
|
333152
|
-
process.stdout.write(`\r\x1B[2K\x1B[38;5;243m [hearing] (snr:${s2.toFixed(2)})\x1B[0m`);
|
|
333153
|
-
});
|
|
333146
|
+
// Keep state changes silent
|
|
333147
|
+
onStateChange(_state2) {
|
|
333154
333148
|
}
|
|
333155
333149
|
});
|
|
333156
|
-
_voiceChatSession2.on("snrFiltered", (e2) => {
|
|
333157
|
-
const s2 = typeof e2?.score === "number" ? e2.score.toFixed(2) : "?";
|
|
333158
|
-
writeContent(() => renderInfo2(`\x1B[38;5;243m[voicechat]\x1B[0m dropped low-signal utterance (SNR:${s2})`));
|
|
333159
|
-
});
|
|
333160
333150
|
await _voiceChatSession2.start();
|
|
333161
333151
|
},
|
|
333162
333152
|
async voiceChatStop() {
|
package/package.json
CHANGED