open-agents-ai 0.5.0 → 0.5.2
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 +29 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6199,6 +6199,10 @@ function renderAssistantText(text) {
|
|
|
6199
6199
|
`);
|
|
6200
6200
|
}
|
|
6201
6201
|
}
|
|
6202
|
+
function renderVoiceText(text) {
|
|
6203
|
+
process.stdout.write(` ${c2.dim("\u{1F50A}")} ${c2.italic(c2.dim(text))}
|
|
6204
|
+
`);
|
|
6205
|
+
}
|
|
6202
6206
|
function renderToolCallStart(toolName, args) {
|
|
6203
6207
|
const icon = TOOL_ICONS[toolName] ?? "\u{1F527}";
|
|
6204
6208
|
const label = TOOL_LABELS[toolName] ?? toolName;
|
|
@@ -7333,25 +7337,36 @@ var init_voice = __esm({
|
|
|
7333
7337
|
// -------------------------------------------------------------------------
|
|
7334
7338
|
textToPhonemeIds(text) {
|
|
7335
7339
|
const map = this.config.phoneme_id_map;
|
|
7336
|
-
let
|
|
7340
|
+
let phonemeText;
|
|
7337
7341
|
if (this.hasEspeak) {
|
|
7338
7342
|
try {
|
|
7339
7343
|
const voice = this.config.espeak?.voice ?? "en-us";
|
|
7340
|
-
|
|
7344
|
+
phonemeText = execSync8(`espeak-ng --ipa -q -v ${voice} -- ${JSON.stringify(text)}`, { encoding: "utf8", timeout: 5e3, stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
7341
7345
|
} catch {
|
|
7342
|
-
|
|
7346
|
+
phonemeText = text.toLowerCase();
|
|
7343
7347
|
}
|
|
7344
7348
|
} else {
|
|
7345
|
-
|
|
7349
|
+
phonemeText = text.toLowerCase();
|
|
7346
7350
|
}
|
|
7351
|
+
const PROSODY = /* @__PURE__ */ new Set(["\u02C8", "\u02CC", "\u02D0", "\u02D1"]);
|
|
7347
7352
|
const ids = [];
|
|
7348
7353
|
if (map["^"])
|
|
7349
7354
|
ids.push(...map["^"]);
|
|
7350
|
-
|
|
7351
|
-
|
|
7355
|
+
const words = phonemeText.split(/\s+/).filter((w) => w.length > 0);
|
|
7356
|
+
for (let wi = 0; wi < words.length; wi++) {
|
|
7357
|
+
const word = words[wi];
|
|
7358
|
+
const chars = [...word];
|
|
7359
|
+
for (let ci = 0; ci < chars.length; ci++) {
|
|
7360
|
+
const char = chars[ci];
|
|
7361
|
+
if (!map[char])
|
|
7362
|
+
continue;
|
|
7352
7363
|
ids.push(...map[char]);
|
|
7353
|
-
if (map["_"])
|
|
7364
|
+
if (!PROSODY.has(char) && map["_"]) {
|
|
7354
7365
|
ids.push(...map["_"]);
|
|
7366
|
+
}
|
|
7367
|
+
}
|
|
7368
|
+
if (wi < words.length - 1 && map[" "]) {
|
|
7369
|
+
ids.push(...map[" "]);
|
|
7355
7370
|
}
|
|
7356
7371
|
}
|
|
7357
7372
|
if (map["$"])
|
|
@@ -7630,16 +7645,21 @@ async function runTask(task, config, repoRoot, voice) {
|
|
|
7630
7645
|
runner.onEvent((event) => {
|
|
7631
7646
|
switch (event.type) {
|
|
7632
7647
|
case "tool_call":
|
|
7633
|
-
renderToolCallStart(event.toolName ?? "unknown", event.toolArgs ?? {});
|
|
7634
7648
|
if (voice?.enabled) {
|
|
7635
7649
|
const desc = describeToolCall(event.toolName ?? "unknown", event.toolArgs ?? {});
|
|
7650
|
+
renderVoiceText(desc);
|
|
7636
7651
|
voice.speak(desc);
|
|
7637
7652
|
}
|
|
7653
|
+
renderToolCallStart(event.toolName ?? "unknown", event.toolArgs ?? {});
|
|
7638
7654
|
break;
|
|
7639
7655
|
case "tool_result":
|
|
7640
7656
|
renderToolResult(event.toolName ?? "unknown", event.success ?? false, event.content ?? "");
|
|
7641
7657
|
if (voice?.enabled && !(event.success ?? true)) {
|
|
7642
|
-
|
|
7658
|
+
const desc = describeToolResult(event.toolName ?? "unknown", false);
|
|
7659
|
+
if (desc) {
|
|
7660
|
+
renderVoiceText(desc);
|
|
7661
|
+
voice.speak(desc);
|
|
7662
|
+
}
|
|
7643
7663
|
}
|
|
7644
7664
|
break;
|
|
7645
7665
|
case "model_response":
|
package/package.json
CHANGED