open-agents-ai 0.187.579 → 0.187.580
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 +155 -22
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -569513,6 +569513,7 @@ var init_sponsor_wizard = __esm({
|
|
|
569513
569513
|
var voice_exports = {};
|
|
569514
569514
|
__export(voice_exports, {
|
|
569515
569515
|
VoiceEngine: () => VoiceEngine,
|
|
569516
|
+
applySupertonicExpressionTags: () => applySupertonicExpressionTags,
|
|
569516
569517
|
computeProsodyHint: () => computeProsodyHint,
|
|
569517
569518
|
describeTaskComplete: () => describeTaskComplete,
|
|
569518
569519
|
describeToolCall: () => describeToolCall,
|
|
@@ -569600,7 +569601,7 @@ function supertonicProfilesFile() {
|
|
|
569600
569601
|
return join106(voiceDir(), "supertonic3-profiles.json");
|
|
569601
569602
|
}
|
|
569602
569603
|
function isSupertonicExpression(value2) {
|
|
569603
|
-
return value2 === "none" || value2 === "laugh" || value2 === "breath" || value2 === "sigh";
|
|
569604
|
+
return value2 === "auto" || value2 === "none" || value2 === "laugh" || value2 === "breath" || value2 === "sigh";
|
|
569604
569605
|
}
|
|
569605
569606
|
function normalizeSupertonicSettings(value2) {
|
|
569606
569607
|
const v = value2 && typeof value2 === "object" ? value2 : {};
|
|
@@ -569625,9 +569626,122 @@ function clampFloat(value2, fallback, min, max) {
|
|
|
569625
569626
|
function clampInt(value2, fallback, min, max) {
|
|
569626
569627
|
return Math.round(clampFloat(value2, fallback, min, max));
|
|
569627
569628
|
}
|
|
569628
|
-
function
|
|
569629
|
-
|
|
569630
|
-
|
|
569629
|
+
function applySupertonicExpressionTags(text, expression, emotion) {
|
|
569630
|
+
const cleaned = text.trim();
|
|
569631
|
+
if (!cleaned || expression === "none") return cleaned;
|
|
569632
|
+
if (SUPERTONIC_EXPRESSION_TAG_RE.test(cleaned)) {
|
|
569633
|
+
return normalizeSupertonicTagSpacing(cleaned);
|
|
569634
|
+
}
|
|
569635
|
+
if (expression !== "auto") {
|
|
569636
|
+
return injectSupertonicTag(cleaned, expression);
|
|
569637
|
+
}
|
|
569638
|
+
const plan = inferSupertonicExpressionPlan(cleaned, emotion);
|
|
569639
|
+
if (!plan.primary) return cleaned;
|
|
569640
|
+
let expressive = injectSupertonicTag(cleaned, plan.primary);
|
|
569641
|
+
if (plan.boundaryBreath && !expressive.includes("<breath>")) {
|
|
569642
|
+
expressive = injectBreathAtSentenceBoundary(expressive);
|
|
569643
|
+
}
|
|
569644
|
+
if (plan.secondary && !expressive.includes(`<${plan.secondary}>`)) {
|
|
569645
|
+
expressive = injectSupertonicTag(expressive, plan.secondary);
|
|
569646
|
+
}
|
|
569647
|
+
return normalizeSupertonicTagSpacing(expressive);
|
|
569648
|
+
}
|
|
569649
|
+
function normalizeSupertonicTagSpacing(text) {
|
|
569650
|
+
return text.replace(/\s*(<(?:laugh|breath|sigh)>)\s*/gi, " $1 ").replace(/\s{2,}/g, " ").trim();
|
|
569651
|
+
}
|
|
569652
|
+
function inferSupertonicExpressionPlan(text, emotion) {
|
|
569653
|
+
const lower = text.toLowerCase();
|
|
569654
|
+
const hasFailure = /\b(error|failed|failure|failing|issue|exception|timeout|blocked|cannot|can't|could not|incomplete|crash|missing|denied|rejected|unreadable|stale|invalid)\b/.test(
|
|
569655
|
+
lower
|
|
569656
|
+
);
|
|
569657
|
+
const persistentFailure = hasFailure && /\b(again|repeated|persistent|consecutive|second|third|keeps|still|retry|attempt)\b/.test(
|
|
569658
|
+
lower
|
|
569659
|
+
);
|
|
569660
|
+
const hasSuccess = /\b(success|successful|successfully|complete|completed|done|clean|passed|green|fixed|resolved|ready|excellent|great|nice|all clean|zero errors)\b/.test(
|
|
569661
|
+
lower
|
|
569662
|
+
);
|
|
569663
|
+
const playful = /\b(playful|fun|delight|spark|nice|great|excellent|tiny victory|clean run)\b/.test(
|
|
569664
|
+
lower
|
|
569665
|
+
);
|
|
569666
|
+
const valence = emotion?.valence ?? 0;
|
|
569667
|
+
const arousal = emotion?.arousal ?? 0.3;
|
|
569668
|
+
const stressed = valence < -0.2 && arousal > 0.5;
|
|
569669
|
+
const subdued = valence < -0.2 && arousal <= 0.5;
|
|
569670
|
+
const excited = valence > 0.3 && arousal > 0.5;
|
|
569671
|
+
const multiSentence = /[.!?]\s+\S/.test(text);
|
|
569672
|
+
if (persistentFailure) {
|
|
569673
|
+
return { primary: "sigh", secondary: stressed ? "breath" : void 0 };
|
|
569674
|
+
}
|
|
569675
|
+
if (hasFailure) {
|
|
569676
|
+
return {
|
|
569677
|
+
primary: "sigh",
|
|
569678
|
+
secondary: stressed ? "breath" : void 0,
|
|
569679
|
+
boundaryBreath: multiSentence
|
|
569680
|
+
};
|
|
569681
|
+
}
|
|
569682
|
+
if (excited && (hasSuccess || playful)) {
|
|
569683
|
+
return { primary: "laugh" };
|
|
569684
|
+
}
|
|
569685
|
+
if (hasSuccess && playful) {
|
|
569686
|
+
return { primary: "laugh" };
|
|
569687
|
+
}
|
|
569688
|
+
if (stressed) {
|
|
569689
|
+
return { primary: "breath", boundaryBreath: multiSentence };
|
|
569690
|
+
}
|
|
569691
|
+
if (subdued && text.length > 80) {
|
|
569692
|
+
return { primary: "sigh" };
|
|
569693
|
+
}
|
|
569694
|
+
if (arousal > 0.75 && text.length > 90) {
|
|
569695
|
+
return { primary: "breath", boundaryBreath: multiSentence };
|
|
569696
|
+
}
|
|
569697
|
+
return { primary: null };
|
|
569698
|
+
}
|
|
569699
|
+
function injectBreathAtSentenceBoundary(text) {
|
|
569700
|
+
return text.replace(/([.!?])\s+(?=\S)/, `$1 <breath> `);
|
|
569701
|
+
}
|
|
569702
|
+
function injectSupertonicTag(text, tag) {
|
|
569703
|
+
if (tag === "laugh") {
|
|
569704
|
+
const opener = text.match(/^(nice|great|excellent|beautiful|perfect|lovely)\b[,!.]?\s*/i);
|
|
569705
|
+
if (opener) {
|
|
569706
|
+
return `${opener[0].trim()} <laugh> ${text.slice(opener[0].length).trim()}`;
|
|
569707
|
+
}
|
|
569708
|
+
const successIdx = text.search(
|
|
569709
|
+
/\b(successfully|passed|clean|all clean|zero errors|ready|resolved|green|complete|completed|done)\b/i
|
|
569710
|
+
);
|
|
569711
|
+
if (successIdx >= 0) {
|
|
569712
|
+
return insertTagAfterMatch(
|
|
569713
|
+
text,
|
|
569714
|
+
/\b(successfully|passed|clean|all clean|zero errors|ready|resolved|green|complete|completed|done)\b/i,
|
|
569715
|
+
tag
|
|
569716
|
+
);
|
|
569717
|
+
}
|
|
569718
|
+
return insertTagAfterOpeningClause(text, tag);
|
|
569719
|
+
}
|
|
569720
|
+
if (tag === "sigh") {
|
|
569721
|
+
const failure = /\b(failed again|keeps failing|failed|failure|failing|hit an issue|returned an error|could not finish|incomplete|timed out|timeout|blocked)\b/i;
|
|
569722
|
+
if (failure.test(text)) return insertTagBeforeMatch(text, failure, tag);
|
|
569723
|
+
return `<${tag}> ${text}`;
|
|
569724
|
+
}
|
|
569725
|
+
const pivot = /,\s*(pushing through|moving forward|being careful|addressing|retrying|checking|continuing)\b/i;
|
|
569726
|
+
if (pivot.test(text)) {
|
|
569727
|
+
return text.replace(pivot, (_match, phrase) => `, <${tag}> ${phrase}`);
|
|
569728
|
+
}
|
|
569729
|
+
return insertTagAfterOpeningClause(text, tag);
|
|
569730
|
+
}
|
|
569731
|
+
function insertTagAfterMatch(text, pattern, tag) {
|
|
569732
|
+
return text.replace(pattern, (match) => `${match} <${tag}>`);
|
|
569733
|
+
}
|
|
569734
|
+
function insertTagBeforeMatch(text, pattern, tag) {
|
|
569735
|
+
return text.replace(pattern, (match) => `<${tag}> ${match}`);
|
|
569736
|
+
}
|
|
569737
|
+
function insertTagAfterOpeningClause(text, tag) {
|
|
569738
|
+
const clause = text.match(/^(.{24,96}?[,:;.])\s+(.+)$/);
|
|
569739
|
+
if (clause) return `${clause[1]} <${tag}> ${clause[2]}`;
|
|
569740
|
+
const words = text.split(/\s+/);
|
|
569741
|
+
if (words.length > 6) {
|
|
569742
|
+
return `${words.slice(0, 5).join(" ")} <${tag}> ${words.slice(5).join(" ")}`;
|
|
569743
|
+
}
|
|
569744
|
+
return `<${tag}> ${text}`;
|
|
569631
569745
|
}
|
|
569632
569746
|
function writeDetectTorchScript(targetPath) {
|
|
569633
569747
|
if (existsSync89(targetPath)) return;
|
|
@@ -570295,7 +570409,7 @@ function formatBytes2(bytes) {
|
|
|
570295
570409
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)}KB`;
|
|
570296
570410
|
return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
|
|
570297
570411
|
}
|
|
570298
|
-
var VOICE_MODELS, SUPERTONIC_LANGS, SUPERTONIC_VOICES, DEFAULT_SUPERTONIC_SETTINGS, SUPERTONIC_INFER_PY, VoiceEngine, RING_BUFFER_SIZE, narration;
|
|
570412
|
+
var VOICE_MODELS, SUPERTONIC_LANGS, SUPERTONIC_VOICES, DEFAULT_SUPERTONIC_SETTINGS, SUPERTONIC_EXPRESSION_TAG_RE, SUPERTONIC_INFER_PY, VoiceEngine, RING_BUFFER_SIZE, narration;
|
|
570299
570413
|
var init_voice = __esm({
|
|
570300
570414
|
"packages/cli/src/tui/voice.ts"() {
|
|
570301
570415
|
"use strict";
|
|
@@ -570436,8 +570550,9 @@ var init_voice = __esm({
|
|
|
570436
570550
|
lang: "en",
|
|
570437
570551
|
speed: 1.05,
|
|
570438
570552
|
totalStep: 8,
|
|
570439
|
-
expression: "
|
|
570553
|
+
expression: "auto"
|
|
570440
570554
|
};
|
|
570555
|
+
SUPERTONIC_EXPRESSION_TAG_RE = /<(?:laugh|breath|sigh)>/i;
|
|
570441
570556
|
SUPERTONIC_INFER_PY = String.raw`
|
|
570442
570557
|
import json, sys, traceback
|
|
570443
570558
|
|
|
@@ -570854,7 +570969,7 @@ except Exception as exc:
|
|
|
570854
570969
|
speak(text, emotion) {
|
|
570855
570970
|
const pitchBias = emotion ? emotionToPitchBias(emotion, this.starkMode, this.autistMode) : 0;
|
|
570856
570971
|
const speedFactor = emotion ? emotionToSpeedFactor(emotion, this.starkMode, this.autistMode) : 1;
|
|
570857
|
-
this.enqueueSpeech(text, 1, 1 + pitchBias, speedFactor, 0.6);
|
|
570972
|
+
this.enqueueSpeech(text, 1, 1 + pitchBias, speedFactor, 0.6, emotion);
|
|
570858
570973
|
}
|
|
570859
570974
|
/**
|
|
570860
570975
|
* Speak text at reduced volume with narrow stereo placement to indicate
|
|
@@ -570866,7 +570981,7 @@ except Exception as exc:
|
|
|
570866
570981
|
speakSubordinate(text, emotion) {
|
|
570867
570982
|
const pitchBias = emotion ? emotionToPitchBias(emotion, this.starkMode, this.autistMode) : 0;
|
|
570868
570983
|
const speedFactor = emotion ? emotionToSpeedFactor(emotion, this.starkMode, this.autistMode) : 1;
|
|
570869
|
-
this.enqueueSpeech(text, 0.55, 1 + pitchBias, speedFactor, 0.15);
|
|
570984
|
+
this.enqueueSpeech(text, 0.55, 1 + pitchBias, speedFactor, 0.15, emotion);
|
|
570870
570985
|
}
|
|
570871
570986
|
/** Wait until the speak queue is fully drained (all audio played). */
|
|
570872
570987
|
async waitUntilIdle() {
|
|
@@ -570877,11 +570992,20 @@ except Exception as exc:
|
|
|
570877
570992
|
await this.sleep(100);
|
|
570878
570993
|
}
|
|
570879
570994
|
}
|
|
570880
|
-
enqueueSpeech(text, volume, pitchFactor, speedFactor = 1, stereoDelayMs = 0.6) {
|
|
570995
|
+
enqueueSpeech(text, volume, pitchFactor, speedFactor = 1, stereoDelayMs = 0.6, emotion) {
|
|
570881
570996
|
if (!this.enabled || !this.ready) return;
|
|
570882
570997
|
text = sanitizeForTTS(text);
|
|
570883
570998
|
if (!text.trim()) return;
|
|
570884
570999
|
const chunks = this.chunkText(text);
|
|
571000
|
+
const supertonicTagsPrepared = this.supertonicActive;
|
|
571001
|
+
if (supertonicTagsPrepared && chunks.length > 0) {
|
|
571002
|
+
const settings = this.getSupertonicSettings();
|
|
571003
|
+
chunks[0] = applySupertonicExpressionTags(
|
|
571004
|
+
chunks[0],
|
|
571005
|
+
settings.expression,
|
|
571006
|
+
emotion
|
|
571007
|
+
);
|
|
571008
|
+
}
|
|
570885
571009
|
if (this.speakQueue.length >= 30) {
|
|
570886
571010
|
return;
|
|
570887
571011
|
}
|
|
@@ -570891,7 +571015,9 @@ except Exception as exc:
|
|
|
570891
571015
|
volume,
|
|
570892
571016
|
pitchFactor,
|
|
570893
571017
|
speedFactor,
|
|
570894
|
-
stereoDelayMs
|
|
571018
|
+
stereoDelayMs,
|
|
571019
|
+
emotion,
|
|
571020
|
+
supertonicTagsPrepared
|
|
570895
571021
|
});
|
|
570896
571022
|
}
|
|
570897
571023
|
if (!this.speaking) {
|
|
@@ -571150,7 +571276,9 @@ except Exception as exc:
|
|
|
571150
571276
|
item.volume,
|
|
571151
571277
|
item.pitchFactor,
|
|
571152
571278
|
item.speedFactor,
|
|
571153
|
-
item.stereoDelayMs
|
|
571279
|
+
item.stereoDelayMs,
|
|
571280
|
+
item.emotion,
|
|
571281
|
+
item.supertonicTagsPrepared
|
|
571154
571282
|
);
|
|
571155
571283
|
}
|
|
571156
571284
|
} catch {
|
|
@@ -571178,7 +571306,7 @@ except Exception as exc:
|
|
|
571178
571306
|
// -------------------------------------------------------------------------
|
|
571179
571307
|
// Synthesis pipeline
|
|
571180
571308
|
// -------------------------------------------------------------------------
|
|
571181
|
-
async synthesizeAndPlay(text, volume = 1, pitchFactor = 1, speedFactor = 1, stereoDelayMs = 0.6) {
|
|
571309
|
+
async synthesizeAndPlay(text, volume = 1, pitchFactor = 1, speedFactor = 1, stereoDelayMs = 0.6, emotion, supertonicTagsPrepared = false) {
|
|
571182
571310
|
if (this.luxttsActive) {
|
|
571183
571311
|
await this.synthesizeWithLuxtts(
|
|
571184
571312
|
text,
|
|
@@ -571195,7 +571323,9 @@ except Exception as exc:
|
|
|
571195
571323
|
volume,
|
|
571196
571324
|
pitchFactor,
|
|
571197
571325
|
speedFactor,
|
|
571198
|
-
stereoDelayMs
|
|
571326
|
+
stereoDelayMs,
|
|
571327
|
+
emotion,
|
|
571328
|
+
!supertonicTagsPrepared
|
|
571199
571329
|
);
|
|
571200
571330
|
return;
|
|
571201
571331
|
}
|
|
@@ -571707,13 +571837,11 @@ except Exception as exc:
|
|
|
571707
571837
|
child.stdin?.end(JSON.stringify(req2));
|
|
571708
571838
|
});
|
|
571709
571839
|
}
|
|
571710
|
-
async synthesizeSupertonicWav(text, speedFactor = 1) {
|
|
571840
|
+
async synthesizeSupertonicWav(text, speedFactor = 1, emotion, injectExpressionTags = true) {
|
|
571711
571841
|
await this.ensureSupertonic();
|
|
571712
571842
|
const settings = this.getSupertonicSettings();
|
|
571713
|
-
const
|
|
571714
|
-
|
|
571715
|
-
settings.expression
|
|
571716
|
-
);
|
|
571843
|
+
const baseText = sanitizeForTTS(text);
|
|
571844
|
+
const cleaned = injectExpressionTags ? applySupertonicExpressionTags(baseText, settings.expression, emotion) : baseText;
|
|
571717
571845
|
if (!cleaned) return null;
|
|
571718
571846
|
const wavPath = join106(
|
|
571719
571847
|
tmpdir20(),
|
|
@@ -571733,8 +571861,13 @@ except Exception as exc:
|
|
|
571733
571861
|
return null;
|
|
571734
571862
|
}
|
|
571735
571863
|
}
|
|
571736
|
-
async synthesizeWithSupertonic(text, volume = 1, pitchFactor = 1, speedFactor = 1, stereoDelayMs = 0.6) {
|
|
571737
|
-
const wavPath = await this.synthesizeSupertonicWav(
|
|
571864
|
+
async synthesizeWithSupertonic(text, volume = 1, pitchFactor = 1, speedFactor = 1, stereoDelayMs = 0.6, emotion, injectExpressionTags = true) {
|
|
571865
|
+
const wavPath = await this.synthesizeSupertonicWav(
|
|
571866
|
+
text,
|
|
571867
|
+
speedFactor,
|
|
571868
|
+
emotion,
|
|
571869
|
+
injectExpressionTags
|
|
571870
|
+
);
|
|
571738
571871
|
if (!wavPath) return;
|
|
571739
571872
|
await this.postProcessAndPlayLuxtts(
|
|
571740
571873
|
wavPath,
|
|
@@ -579967,14 +580100,14 @@ async function handleSupertonicMenu(ctx3, save2) {
|
|
|
579967
580100
|
];
|
|
579968
580101
|
const speeds = ["0.9", "1.0", "1.05", "1.2", "1.35", "1.5"];
|
|
579969
580102
|
const steps = ["6", "8", "10", "12"];
|
|
579970
|
-
const expressions = ["none", "laugh", "breath", "sigh"];
|
|
580103
|
+
const expressions = ["auto", "none", "laugh", "breath", "sigh"];
|
|
579971
580104
|
while (true) {
|
|
579972
580105
|
const st = ctx3.voiceGetSupertonicSettings?.() ?? {
|
|
579973
580106
|
voiceName: "M4",
|
|
579974
580107
|
lang: "en",
|
|
579975
580108
|
speed: 1.05,
|
|
579976
580109
|
totalStep: 8,
|
|
579977
|
-
expression: "
|
|
580110
|
+
expression: "auto"
|
|
579978
580111
|
};
|
|
579979
580112
|
const profiles = ctx3.voiceListSupertonicProfiles?.() ?? [];
|
|
579980
580113
|
const items = [
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-agents-ai",
|
|
3
|
-
"version": "0.187.
|
|
3
|
+
"version": "0.187.580",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "open-agents-ai",
|
|
9
|
-
"version": "0.187.
|
|
9
|
+
"version": "0.187.580",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "CC-BY-NC-4.0",
|
|
12
12
|
"dependencies": {
|
package/package.json
CHANGED