@tiens.nguyen/gonext-local-worker 1.0.128 → 1.0.130
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 +7 -2
- package/gonext_agent_chat.py +8 -3
- package/package.json +1 -1
package/gonext-local-worker.mjs
CHANGED
|
@@ -1506,7 +1506,7 @@ async function runAgentChatJob(job) {
|
|
|
1506
1506
|
codingBaseURL: payload?.codingBaseURL ?? "",
|
|
1507
1507
|
codingModelId: payload?.codingModelId ?? "",
|
|
1508
1508
|
tools: payload?.tools ?? ["http_request"],
|
|
1509
|
-
maxSteps: payload?.maxSteps ??
|
|
1509
|
+
maxSteps: payload?.maxSteps ?? 5,
|
|
1510
1510
|
// Tool-invocation mode for the agent: "code" (default, python CodeAgent) or
|
|
1511
1511
|
// "toolcall" (structured JSON tool calls). Passed through only; the API/web can
|
|
1512
1512
|
// set payload.agentToolMode to A/B — default keeps current behavior.
|
|
@@ -1526,7 +1526,12 @@ async function runAgentChatJob(job) {
|
|
|
1526
1526
|
emailFrom: payload?.emailFrom ?? "",
|
|
1527
1527
|
emailAllowList: payload?.emailAllowList ?? "",
|
|
1528
1528
|
});
|
|
1529
|
-
|
|
1529
|
+
// 7 min max for an agent run: up to 5 ReAct steps on a local 14B with a cold
|
|
1530
|
+
// prompt cache can legitimately exceed the old 5-min cap. Must stay BELOW the web
|
|
1531
|
+
// client's hard WS deadline (480s) so our clean timeout error reaches the user
|
|
1532
|
+
// instead of a generic WS timeout. On expiry the python child is SIGKILLed, which
|
|
1533
|
+
// also shows up as a BrokenPipeError in the mlx_lm.server log (expected).
|
|
1534
|
+
const timeoutMs = 420_000;
|
|
1530
1535
|
|
|
1531
1536
|
let inThink = false;
|
|
1532
1537
|
let finalText = "";
|
package/gonext_agent_chat.py
CHANGED
|
@@ -11,7 +11,7 @@ Reads on stdin:
|
|
|
11
11
|
"codingBaseURL": str, # optional: dedicated coding/reasoning model for the
|
|
12
12
|
"codingModelId": str, # CodeAgent's tool-use loop; empty = reuse agentModelId
|
|
13
13
|
"tools": ["http_request"], # v1: only http_request
|
|
14
|
-
"maxSteps": int # multi-step ReAct budget; default
|
|
14
|
+
"maxSteps": int # multi-step ReAct budget; default 5
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
Emits NDJSON lines on stdout:
|
|
@@ -66,13 +66,18 @@ def _http_request_impl(method, url, headers=None, body=None, timeout=25):
|
|
|
66
66
|
return f"Error: {e}"
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
def _html_to_text(html_text, limit=
|
|
69
|
+
def _html_to_text(html_text, limit=3000):
|
|
70
70
|
"""Strip HTML to readable plain text (zero-dep). Used by fetch_url so the weak
|
|
71
71
|
model receives prose instead of raw tags it cannot parse."""
|
|
72
72
|
import html as _html
|
|
73
73
|
text = html_text or ""
|
|
74
74
|
# Drop script/style/head/svg noise wholesale (incl. their content).
|
|
75
75
|
text = re.sub(r"(?is)<(script|style|head|noscript|svg|template)\b.*?</\1>", " ", text)
|
|
76
|
+
# Drop page chrome wholesale too — nav menus, headers, footers, sidebars, forms.
|
|
77
|
+
# Without this, a Wikipedia fetch spends ~1KB of the budget on "Jump to content /
|
|
78
|
+
# Main menu / Donate / Create account…" before any article text, which both starves
|
|
79
|
+
# the model of real content and bloats the per-step context (OOM risk on local MLX).
|
|
80
|
+
text = re.sub(r"(?is)<(nav|header|footer|aside|form|button|menu)\b.*?</\1>", " ", text)
|
|
76
81
|
# Turn block-ending tags into newlines so document structure survives stripping.
|
|
77
82
|
text = re.sub(r"(?i)<(br|/p|/div|/li|/tr|/h[1-6]|/section|/article)\s*>", "\n", text)
|
|
78
83
|
# Remove all remaining tags.
|
|
@@ -969,7 +974,7 @@ def run_agent_chat(cfg):
|
|
|
969
974
|
# overridable via cfg.maxSteps. The provide_final_answer override below is now only
|
|
970
975
|
# the exhaustion fallback (loop ends without final_answer).
|
|
971
976
|
try:
|
|
972
|
-
max_steps = int(cfg.get("maxSteps") or
|
|
977
|
+
max_steps = int(cfg.get("maxSteps") or 5)
|
|
973
978
|
except (TypeError, ValueError):
|
|
974
979
|
max_steps = 8
|
|
975
980
|
if max_steps < 1:
|
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.130",
|
|
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",
|