open-agents-ai 0.103.79 → 0.103.80
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 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19134,7 +19134,8 @@ If you're stuck, try a completely different approach. Do NOT repeat what failed
|
|
|
19134
19134
|
if (!choice)
|
|
19135
19135
|
break;
|
|
19136
19136
|
const msg = choice.message;
|
|
19137
|
-
const
|
|
19137
|
+
const isThinkOnly = response._thinkOnly === true;
|
|
19138
|
+
const isEmptyResponse = !isThinkOnly && (!msg.content || !msg.content.trim()) && (!msg.toolCalls || msg.toolCalls.length === 0);
|
|
19138
19139
|
if (isEmptyResponse) {
|
|
19139
19140
|
consecutiveEmptyResponses++;
|
|
19140
19141
|
if (consecutiveEmptyResponses >= 2) {
|
|
@@ -20970,6 +20971,8 @@ ${transcript}`
|
|
|
20970
20971
|
}
|
|
20971
20972
|
this.emit({ type: "stream_end", content, turn, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
20972
20973
|
const cleanContent = content.replace(/<think>[\s\S]*?<\/think>/g, "").trim();
|
|
20974
|
+
const hadThinking = content.includes("<think>") && content.includes("</think>");
|
|
20975
|
+
const thinkOnlyResponse = hadThinking && !cleanContent;
|
|
20973
20976
|
const toolCalls = toolCallAccumulators.size > 0 ? Array.from(toolCallAccumulators.values()).map((tc) => {
|
|
20974
20977
|
let args;
|
|
20975
20978
|
try {
|
|
@@ -20980,10 +20983,20 @@ ${transcript}`
|
|
|
20980
20983
|
}
|
|
20981
20984
|
return { id: tc.id, name: tc.name, arguments: args };
|
|
20982
20985
|
}) : void 0;
|
|
20983
|
-
|
|
20984
|
-
choices: [{
|
|
20986
|
+
const resp = {
|
|
20987
|
+
choices: [{
|
|
20988
|
+
message: {
|
|
20989
|
+
// For think-only responses, include a marker so the model knows it already
|
|
20990
|
+
// thought about this (prevents infinite think loops without visible output)
|
|
20991
|
+
content: thinkOnlyResponse ? "[Your previous response was internal reasoning only. Now respond with visible text or a tool call.]" : cleanContent || null,
|
|
20992
|
+
toolCalls
|
|
20993
|
+
}
|
|
20994
|
+
}],
|
|
20985
20995
|
usage: streamUsage
|
|
20986
20996
|
};
|
|
20997
|
+
if (thinkOnlyResponse)
|
|
20998
|
+
resp._thinkOnly = true;
|
|
20999
|
+
return resp;
|
|
20987
21000
|
}
|
|
20988
21001
|
};
|
|
20989
21002
|
OllamaAgenticBackend = class {
|
|
@@ -39471,6 +39484,23 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
39471
39484
|
if (existsSync34(venvPy)) {
|
|
39472
39485
|
try {
|
|
39473
39486
|
execSync27(`${venvPy} -c "import sys; sys.path.insert(0, '${luxttsRepoDir()}'); from zipvoice.luxvoice import LuxTTS; print('ok')"`, { stdio: "pipe", timeout: 3e4 });
|
|
39487
|
+
let hasCudaSys = false;
|
|
39488
|
+
try {
|
|
39489
|
+
execSync27("nvidia-smi", { stdio: "pipe", timeout: 5e3 });
|
|
39490
|
+
hasCudaSys = true;
|
|
39491
|
+
} catch {
|
|
39492
|
+
}
|
|
39493
|
+
if (hasCudaSys) {
|
|
39494
|
+
try {
|
|
39495
|
+
const torchCheck = execSync27(`${venvPy} -c "import torch; print('cuda' if torch.cuda.is_available() else 'cpu')"`, { stdio: "pipe", timeout: 15e3 }).toString().trim();
|
|
39496
|
+
if (torchCheck === "cpu") {
|
|
39497
|
+
renderWarning("GPU detected but PyTorch is CPU-only. Reinstalling with CUDA support...");
|
|
39498
|
+
execSync27(`${JSON.stringify(venvPy)} -m pip install --quiet --force-reinstall torch torchaudio --index-url https://download.pytorch.org/whl/cu124`, { stdio: "pipe", timeout: 6e5 });
|
|
39499
|
+
renderInfo("PyTorch reinstalled with CUDA GPU support.");
|
|
39500
|
+
}
|
|
39501
|
+
} catch {
|
|
39502
|
+
}
|
|
39503
|
+
}
|
|
39474
39504
|
this.writeLuxttsInferScript();
|
|
39475
39505
|
this.autoDetectCloneRef();
|
|
39476
39506
|
return;
|
|
@@ -39490,14 +39520,33 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
|
39490
39520
|
throw new Error(`Failed to create venv: ${err instanceof Error ? err.message : String(err)}`);
|
|
39491
39521
|
}
|
|
39492
39522
|
}
|
|
39493
|
-
|
|
39523
|
+
let hasCuda = false;
|
|
39494
39524
|
try {
|
|
39495
|
-
execSync27(
|
|
39496
|
-
|
|
39525
|
+
execSync27("nvidia-smi", { stdio: "pipe", timeout: 5e3 });
|
|
39526
|
+
hasCuda = true;
|
|
39527
|
+
} catch {
|
|
39528
|
+
}
|
|
39529
|
+
if (hasCuda) {
|
|
39530
|
+
renderInfo(" Installing PyTorch (CUDA GPU)...");
|
|
39497
39531
|
try {
|
|
39498
|
-
execSync27(`${JSON.stringify(venvPy)} -m pip install --quiet torch torchaudio`, { stdio: "pipe", timeout: 6e5 });
|
|
39499
|
-
} catch
|
|
39500
|
-
|
|
39532
|
+
execSync27(`${JSON.stringify(venvPy)} -m pip install --quiet torch torchaudio --index-url https://download.pytorch.org/whl/cu124`, { stdio: "pipe", timeout: 6e5 });
|
|
39533
|
+
} catch {
|
|
39534
|
+
try {
|
|
39535
|
+
execSync27(`${JSON.stringify(venvPy)} -m pip install --quiet torch torchaudio`, { stdio: "pipe", timeout: 6e5 });
|
|
39536
|
+
} catch (err2) {
|
|
39537
|
+
throw new Error(`Failed to install PyTorch (CUDA): ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
39538
|
+
}
|
|
39539
|
+
}
|
|
39540
|
+
} else {
|
|
39541
|
+
renderInfo(" Installing PyTorch (CPU \u2014 no NVIDIA GPU detected)...");
|
|
39542
|
+
try {
|
|
39543
|
+
execSync27(`${JSON.stringify(venvPy)} -m pip install --quiet torch torchaudio --index-url https://download.pytorch.org/whl/cpu`, { stdio: "pipe", timeout: 6e5 });
|
|
39544
|
+
} catch {
|
|
39545
|
+
try {
|
|
39546
|
+
execSync27(`${JSON.stringify(venvPy)} -m pip install --quiet torch torchaudio`, { stdio: "pipe", timeout: 6e5 });
|
|
39547
|
+
} catch (err2) {
|
|
39548
|
+
throw new Error(`Failed to install PyTorch: ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
39549
|
+
}
|
|
39501
39550
|
}
|
|
39502
39551
|
}
|
|
39503
39552
|
const repoDir = luxttsRepoDir();
|
package/package.json
CHANGED