@tiens.nguyen/gonext-local-worker 1.0.97 → 1.0.98
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/gonext-local-worker.mjs +19 -3
- package/package.json +1 -1
package/gonext-local-worker.mjs
CHANGED
|
@@ -671,9 +671,13 @@ async function performHttpMeasurement(params) {
|
|
|
671
671
|
* line as they arrive. Resolves when the process exits cleanly; rejects on
|
|
672
672
|
* non-zero exit or timeout. stderr is collected and appended to error messages.
|
|
673
673
|
*/
|
|
674
|
-
function runProcessWithStreamingStdout(cmd, cmdArgs, stdinStr, timeoutMs, onLine) {
|
|
674
|
+
function runProcessWithStreamingStdout(cmd, cmdArgs, stdinStr, timeoutMs, onLine, extraEnv) {
|
|
675
675
|
return new Promise((resolve, reject) => {
|
|
676
|
-
const
|
|
676
|
+
const spawnOpts = { stdio: ["pipe", "pipe", "pipe"] };
|
|
677
|
+
if (extraEnv && Object.keys(extraEnv).length > 0) {
|
|
678
|
+
spawnOpts.env = { ...process.env, ...extraEnv };
|
|
679
|
+
}
|
|
680
|
+
const child = spawn(cmd, cmdArgs, spawnOpts);
|
|
677
681
|
let stderr = "";
|
|
678
682
|
let lineBuffer = "";
|
|
679
683
|
let timedOut = false;
|
|
@@ -1390,6 +1394,18 @@ async function runAgentChatJob(job) {
|
|
|
1390
1394
|
let inThink = false;
|
|
1391
1395
|
let finalText = "";
|
|
1392
1396
|
|
|
1397
|
+
// The create_pdf tool uses WeasyPrint, whose Homebrew libs (pango/cairo/gobject)
|
|
1398
|
+
// live in /opt/homebrew/lib (Apple Silicon) or /usr/local/lib (Intel). macOS doesn't
|
|
1399
|
+
// search those by default, so ctypes can't dlopen them. Inject the path for the child
|
|
1400
|
+
// so users don't have to set DYLD_FALLBACK_LIBRARY_PATH themselves.
|
|
1401
|
+
let pdfEnv;
|
|
1402
|
+
if (process.platform === "darwin") {
|
|
1403
|
+
const existing = process.env.DYLD_FALLBACK_LIBRARY_PATH ?? "";
|
|
1404
|
+
const brewLibs = ["/opt/homebrew/lib", "/usr/local/lib"];
|
|
1405
|
+
const merged = [existing, ...brewLibs].filter(Boolean).join(":");
|
|
1406
|
+
pdfEnv = { DYLD_FALLBACK_LIBRARY_PATH: merged };
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1393
1409
|
await runProcessWithStreamingStdout(python, [scriptPath], input, timeoutMs, (event) => {
|
|
1394
1410
|
if (event.type === "log" && typeof event.text === "string") {
|
|
1395
1411
|
console.log(`[gonext-agent] ${event.text}`);
|
|
@@ -1407,7 +1423,7 @@ async function runAgentChatJob(job) {
|
|
|
1407
1423
|
finalText = event.text;
|
|
1408
1424
|
enqueueText(event.text);
|
|
1409
1425
|
}
|
|
1410
|
-
});
|
|
1426
|
+
}, pdfEnv);
|
|
1411
1427
|
|
|
1412
1428
|
if (inThink) {
|
|
1413
1429
|
enqueueText("</think>");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiens.nguyen/gonext-local-worker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.98",
|
|
4
4
|
"description": "Polls GoNext cloud API for async local LLM jobs and runs them against Ollama/OpenAI-compatible servers on this Mac",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|