open-agents-ai 0.103.64 → 0.103.66
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 +58 -27
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13152,14 +13152,23 @@ try {
|
|
|
13152
13152
|
});
|
|
13153
13153
|
} catch {}
|
|
13154
13154
|
|
|
13155
|
+
// Suppress EPIPE on stdout/stderr \u2014 parent may close pipe at any time
|
|
13156
|
+
try { process.stdout.on('error', function(e) { if (e.code !== 'EPIPE') throw e; }); } catch {}
|
|
13157
|
+
try { process.stderr.on('error', function(e) { if (e.code !== 'EPIPE') throw e; }); } catch {}
|
|
13158
|
+
|
|
13155
13159
|
// Crash protection \u2014 prevent unhandled errors from killing the daemon
|
|
13156
13160
|
process.on('uncaughtException', (err) => {
|
|
13157
|
-
|
|
13158
|
-
|
|
13161
|
+
var errMsg = err && err.message ? err.message : String(err);
|
|
13162
|
+
// EPIPE means parent closed the pipe \u2014 not a real error, just ignore
|
|
13163
|
+
if (err && err.code === 'EPIPE') return;
|
|
13164
|
+
if (errMsg.includes('EPIPE')) return;
|
|
13165
|
+
try { console.error('Nexus daemon uncaughtException:', errMsg); } catch {}
|
|
13166
|
+
writeStatus({ error: 'uncaughtException: ' + errMsg });
|
|
13159
13167
|
});
|
|
13160
13168
|
process.on('unhandledRejection', (reason) => {
|
|
13161
|
-
|
|
13162
|
-
|
|
13169
|
+
var msg = reason instanceof Error ? reason.message : String(reason);
|
|
13170
|
+
if (msg.includes('EPIPE')) return;
|
|
13171
|
+
try { console.error('Nexus daemon unhandledRejection:', msg); } catch {}
|
|
13163
13172
|
// Do NOT exit \u2014 keep daemon alive
|
|
13164
13173
|
});
|
|
13165
13174
|
|
|
@@ -13875,21 +13884,26 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
|
|
|
13875
13884
|
nodePaths.push(globalDir);
|
|
13876
13885
|
} catch {
|
|
13877
13886
|
}
|
|
13887
|
+
const { openSync, closeSync } = await import("node:fs");
|
|
13888
|
+
const daemonLogPath = join30(this.nexusDir, "daemon.log");
|
|
13889
|
+
const daemonErrPath = join30(this.nexusDir, "daemon.err");
|
|
13890
|
+
const outFd = openSync(daemonLogPath, "w");
|
|
13891
|
+
const errFd = openSync(daemonErrPath, "w");
|
|
13878
13892
|
const child = spawn11("node", [daemonPath, this.nexusDir, agentName, agentType], {
|
|
13879
13893
|
detached: true,
|
|
13880
|
-
stdio: ["ignore",
|
|
13894
|
+
stdio: ["ignore", outFd, errFd],
|
|
13881
13895
|
cwd: this.repoRoot,
|
|
13882
13896
|
env: { ...process.env, NODE_PATH: nodePaths.join(":") }
|
|
13883
13897
|
});
|
|
13884
13898
|
child.unref();
|
|
13885
|
-
|
|
13886
|
-
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
|
|
13890
|
-
|
|
13891
|
-
|
|
13892
|
-
}
|
|
13899
|
+
try {
|
|
13900
|
+
closeSync(outFd);
|
|
13901
|
+
} catch {
|
|
13902
|
+
}
|
|
13903
|
+
try {
|
|
13904
|
+
closeSync(errFd);
|
|
13905
|
+
} catch {
|
|
13906
|
+
}
|
|
13893
13907
|
const statusFile = join30(this.nexusDir, "status.json");
|
|
13894
13908
|
for (let i = 0; i < 40; i++) {
|
|
13895
13909
|
await new Promise((r) => setTimeout(r, 500));
|
|
@@ -13897,7 +13911,12 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
|
|
|
13897
13911
|
try {
|
|
13898
13912
|
const status = JSON.parse(await readFile13(statusFile, "utf8"));
|
|
13899
13913
|
if (status.error) {
|
|
13900
|
-
|
|
13914
|
+
let errTail = "";
|
|
13915
|
+
try {
|
|
13916
|
+
errTail = (await readFile13(daemonErrPath, "utf8")).slice(-300);
|
|
13917
|
+
} catch {
|
|
13918
|
+
}
|
|
13919
|
+
return `Nexus daemon failed to connect: ${status.error}${errTail ? "\n" + errTail : ""}`;
|
|
13901
13920
|
}
|
|
13902
13921
|
if (status.connected && status.peerId) {
|
|
13903
13922
|
return [
|
|
@@ -13914,10 +13933,20 @@ process.on('SIGINT', () => process.emit('SIGTERM'));
|
|
|
13914
13933
|
}
|
|
13915
13934
|
}
|
|
13916
13935
|
const pid = this.getDaemonPid();
|
|
13936
|
+
let earlyError = "";
|
|
13937
|
+
try {
|
|
13938
|
+
earlyError = (await readFile13(daemonErrPath, "utf8")).slice(-500);
|
|
13939
|
+
} catch {
|
|
13940
|
+
}
|
|
13941
|
+
let earlyOutput = "";
|
|
13942
|
+
try {
|
|
13943
|
+
earlyOutput = (await readFile13(daemonLogPath, "utf8")).slice(-500);
|
|
13944
|
+
} catch {
|
|
13945
|
+
}
|
|
13917
13946
|
if (pid) {
|
|
13918
13947
|
return `Daemon spawned (pid: ${pid}) but still connecting. Check status in a moment.${earlyError ? "\nStderr: " + earlyError.slice(0, 200) : ""}`;
|
|
13919
13948
|
}
|
|
13920
|
-
return `Daemon failed to start.${earlyError ? "\n" + earlyError
|
|
13949
|
+
return `Daemon failed to start.${earlyError ? "\n" + earlyError : ""}${earlyOutput ? "\n" + earlyOutput : ""}`;
|
|
13921
13950
|
}
|
|
13922
13951
|
async doDisconnect() {
|
|
13923
13952
|
const pid = this.getDaemonPid();
|
|
@@ -38860,7 +38889,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
38860
38889
|
const venvPy = luxttsVenvPy();
|
|
38861
38890
|
if (existsSync34(venvPy)) {
|
|
38862
38891
|
try {
|
|
38863
|
-
execSync27(`${venvPy} -c "import sys; sys.path.insert(0, '${luxttsRepoDir()}'); from
|
|
38892
|
+
execSync27(`${venvPy} -c "import sys; sys.path.insert(0, '${luxttsRepoDir()}'); from zipvoice.luxvoice import LuxTTS; print('ok')"`, { stdio: "pipe", timeout: 3e4 });
|
|
38864
38893
|
this.writeLuxttsInferScript();
|
|
38865
38894
|
this.autoDetectCloneRef();
|
|
38866
38895
|
return;
|
|
@@ -38891,7 +38920,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
38891
38920
|
}
|
|
38892
38921
|
}
|
|
38893
38922
|
const repoDir = luxttsRepoDir();
|
|
38894
|
-
if (!existsSync34(join43(repoDir, "
|
|
38923
|
+
if (!existsSync34(join43(repoDir, "zipvoice", "luxvoice.py"))) {
|
|
38895
38924
|
renderInfo(" Cloning LuxTTS repository...");
|
|
38896
38925
|
try {
|
|
38897
38926
|
if (existsSync34(repoDir)) {
|
|
@@ -38906,12 +38935,13 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
38906
38935
|
const pipCmd = JSON.stringify(venvPy);
|
|
38907
38936
|
const installCmds = [
|
|
38908
38937
|
// Core deps from requirements.txt
|
|
38909
|
-
`${pipCmd} -m pip install --quiet lhotse huggingface_hub safetensors pydub onnxruntime librosa "transformers<=4.57.6" inflect numpy`,
|
|
38910
|
-
// piper_phonemize from custom index
|
|
38938
|
+
`${pipCmd} -m pip install --quiet lhotse huggingface_hub safetensors pydub onnxruntime librosa "transformers<=4.57.6" inflect numpy vocos "setuptools<81"`,
|
|
38939
|
+
// Tokenization deps (piper_phonemize from custom index, plus CJK support)
|
|
38911
38940
|
`${pipCmd} -m pip install --quiet piper-phonemize --find-links https://k2-fsa.github.io/icefall/piper_phonemize.html`,
|
|
38912
|
-
|
|
38941
|
+
`${pipCmd} -m pip install --quiet jieba pypinyin cn2an`,
|
|
38942
|
+
// LinaCodec custom vocoder (required by Zipvoice)
|
|
38913
38943
|
`${pipCmd} -m pip install --quiet "git+https://github.com/ysharma3501/LinaCodec.git"`,
|
|
38914
|
-
//
|
|
38944
|
+
// Zipvoice package from the cloned repo (installs as 'zipvoice')
|
|
38915
38945
|
`${pipCmd} -m pip install --quiet -e ${JSON.stringify(repoDir)}`
|
|
38916
38946
|
];
|
|
38917
38947
|
for (const cmd of installCmds) {
|
|
@@ -38927,7 +38957,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
38927
38957
|
}
|
|
38928
38958
|
}
|
|
38929
38959
|
try {
|
|
38930
|
-
execSync27(`${venvPy} -c "import sys; sys.path.insert(0, '${repoDir}'); from
|
|
38960
|
+
execSync27(`${venvPy} -c "import sys; sys.path.insert(0, '${repoDir}'); from zipvoice.luxvoice import LuxTTS; print('ok')"`, { stdio: "pipe", timeout: 3e4 });
|
|
38931
38961
|
} catch (err) {
|
|
38932
38962
|
throw new Error(`LuxTTS installed but import failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
38933
38963
|
}
|
|
@@ -38969,7 +38999,7 @@ def main():
|
|
|
38969
38999
|
|
|
38970
39000
|
if action == 'check':
|
|
38971
39001
|
try:
|
|
38972
|
-
from
|
|
39002
|
+
from zipvoice.luxvoice import LuxTTS
|
|
38973
39003
|
print(json.dumps({'ok': True}))
|
|
38974
39004
|
except Exception as e:
|
|
38975
39005
|
print(json.dumps({'ok': False, 'error': str(e)}))
|
|
@@ -38977,7 +39007,7 @@ def main():
|
|
|
38977
39007
|
|
|
38978
39008
|
if action == 'synthesize':
|
|
38979
39009
|
import torch
|
|
38980
|
-
from
|
|
39010
|
+
from zipvoice.luxvoice import LuxTTS
|
|
38981
39011
|
|
|
38982
39012
|
text = args['text']
|
|
38983
39013
|
clone_ref = args['clone_ref']
|
|
@@ -38992,9 +39022,10 @@ def main():
|
|
|
38992
39022
|
else:
|
|
38993
39023
|
device = 'cpu'
|
|
38994
39024
|
|
|
38995
|
-
|
|
38996
|
-
|
|
38997
|
-
|
|
39025
|
+
threads = 4 if device == 'cpu' else 4
|
|
39026
|
+
tts = LuxTTS(model_path='YatharthS/LuxTTS', device=device, threads=threads)
|
|
39027
|
+
encoded = tts.encode_prompt(clone_ref, duration=5, rms=0.001)
|
|
39028
|
+
wav_tensor = tts.generate_speech(text, encoded, num_steps=4, guidance_scale=3.0, t_shift=0.5, speed=speed)
|
|
38998
39029
|
wav_np = wav_tensor.cpu().numpy().squeeze()
|
|
38999
39030
|
|
|
39000
39031
|
# Write as 48kHz 16-bit mono WAV using stdlib
|
package/package.json
CHANGED