@tiens.nguyen/gonext-local-worker 1.0.63 → 1.0.64

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.
@@ -1219,13 +1219,6 @@ async function runAgentChatJob(job) {
1219
1219
  console.log(
1220
1220
  `[gonext-worker] agent_chat ${jobId} baseURL=${payload?.agentBaseURL ?? "(none)"} modelId=${payload?.agentModelId ?? "(none)"}`
1221
1221
  );
1222
- // Send an immediate heartbeat so the web 60-180s no-progress timer doesn't
1223
- // fire while the local model is loading/generating its first reasoning step.
1224
- enqueueText("<think>Agent starting…\n\n");
1225
- flushTail = flushTail.then(() => flushChunks()).catch((err) => {
1226
- console.error("[gonext-worker] agent_chat heartbeat flush error:", err);
1227
- });
1228
-
1229
1222
  try {
1230
1223
  const python =
1231
1224
  (process.env.GONEXT_PROBE_PYTHON ?? process.env.GONEXT_MLX_LM_PYTHON ?? "")
@@ -1241,7 +1234,7 @@ async function runAgentChatJob(job) {
1241
1234
  });
1242
1235
  const timeoutMs = 300_000; // 5 min max for an agent run
1243
1236
 
1244
- let inThink = true; // already opened <think> above
1237
+ let inThink = false;
1245
1238
  let finalText = "";
1246
1239
 
1247
1240
  await runProcessWithStreamingStdout(python, [scriptPath], input, timeoutMs, (event) => {
@@ -194,18 +194,18 @@ def run_agent_chat(cfg):
194
194
  _log(f"task={task_text[:120]!r}")
195
195
 
196
196
  # Route: ask the model if this task needs HTTP tool use.
197
- _emit({"type": "step", "text": "Routing…"})
198
197
  needs_agent = _route(task_text, agent_base_url, agent_api_key, agent_model_id)
199
198
 
200
199
  if not needs_agent:
201
200
  _log("router: plain chat (no HTTP needed)")
202
- _emit({"type": "step", "text": "No HTTP request needed — answering directly…"})
203
201
  answer = _plain_reply(task_text, agent_base_url, agent_api_key, agent_model_id)
204
202
  _log(f"plain reply: {len(answer)} chars")
205
203
  _emit({"type": "final", "text": answer})
206
204
  return
207
205
 
206
+ # Agent path — from here all step events go into <think>.
208
207
  _log("router: agent (HTTP tool use needed)")
208
+ _emit({"type": "step", "text": "Planning HTTP request…"})
209
209
 
210
210
  # Prepend explicit tool instructions so small models use http_request correctly
211
211
  # and always terminate with final_answer() rather than looping forever.
@@ -284,7 +284,6 @@ def run_agent_chat(cfg):
284
284
  executor_kwargs={"timeout_seconds": 60},
285
285
  additional_authorized_imports=["json", "urllib", "urllib.request", "urllib.error"],
286
286
  )
287
- _emit({"type": "step", "text": f"Sending task to {agent_model_id}…"})
288
287
  with contextlib.redirect_stdout(sys.stderr):
289
288
  result = agent.run(task_with_hint)
290
289
  final_text = str(result).strip()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gonext-local-worker",
3
- "version": "1.0.63",
3
+ "version": "1.0.64",
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",