@tiens.nguyen/gonext-local-worker 1.0.80 → 1.0.81
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 +2 -0
- package/gonext_agent_chat.py +30 -16
- package/package.json +1 -1
package/gonext-local-worker.mjs
CHANGED
|
@@ -1376,6 +1376,8 @@ async function runAgentChatJob(job) {
|
|
|
1376
1376
|
agentBaseURL: payload?.agentBaseURL ?? "",
|
|
1377
1377
|
agentApiKey: payload?.agentApiKey ?? "",
|
|
1378
1378
|
agentModelId: payload?.agentModelId ?? "",
|
|
1379
|
+
codingBaseURL: payload?.codingBaseURL ?? "",
|
|
1380
|
+
codingModelId: payload?.codingModelId ?? "",
|
|
1379
1381
|
tools: payload?.tools ?? ["http_request"],
|
|
1380
1382
|
maxSteps: payload?.maxSteps ?? 5,
|
|
1381
1383
|
});
|
package/gonext_agent_chat.py
CHANGED
|
@@ -8,6 +8,8 @@ Reads on stdin:
|
|
|
8
8
|
"agentBaseURL": str,
|
|
9
9
|
"agentApiKey": str,
|
|
10
10
|
"agentModelId": str,
|
|
11
|
+
"codingBaseURL": str, # optional: dedicated coding/reasoning model for the
|
|
12
|
+
"codingModelId": str, # CodeAgent's tool-use loop; empty = reuse agentModelId
|
|
11
13
|
"tools": ["http_request"], # v1: only http_request
|
|
12
14
|
"maxSteps": int # default 10
|
|
13
15
|
}
|
|
@@ -244,9 +246,17 @@ def run_agent_chat(cfg):
|
|
|
244
246
|
agent_base_url = cfg.get("agentBaseURL") or ""
|
|
245
247
|
agent_api_key = cfg.get("agentApiKey") or "local"
|
|
246
248
|
agent_model_id = cfg.get("agentModelId") or ""
|
|
249
|
+
# Optional dedicated coding/reasoning model for the CodeAgent's tool-use loop.
|
|
250
|
+
# Routing, plain replies and summarization stay on the chat model (better at
|
|
251
|
+
# natural language); the code model only drives http_request reasoning.
|
|
252
|
+
coding_base_url = (cfg.get("codingBaseURL") or "").strip() or agent_base_url
|
|
253
|
+
coding_model_id = (cfg.get("codingModelId") or "").strip() or agent_model_id
|
|
247
254
|
max_steps = int(cfg.get("maxSteps") or 5)
|
|
248
255
|
|
|
249
|
-
_log(
|
|
256
|
+
_log(
|
|
257
|
+
f"start model={agent_model_id!r} base={agent_base_url!r} "
|
|
258
|
+
f"codeModel={coding_model_id!r} codeBase={coding_base_url!r} maxSteps={max_steps}"
|
|
259
|
+
)
|
|
250
260
|
|
|
251
261
|
# Build task from the conversation history.
|
|
252
262
|
# Include prior USER messages as context so the agent has conversational memory,
|
|
@@ -291,20 +301,24 @@ def run_agent_chat(cfg):
|
|
|
291
301
|
tool_hint = (
|
|
292
302
|
"You have ONE built-in function:\n"
|
|
293
303
|
" `http_request(method, url, headers='', body='', username='', password='')`\n"
|
|
294
|
-
"
|
|
295
|
-
"
|
|
296
|
-
"
|
|
297
|
-
"
|
|
298
|
-
" response = http_request('GET',
|
|
304
|
+
"\n"
|
|
305
|
+
"RETURN FORMAT: 'HTTP 200\\n{body}' — first line is 'HTTP <code>', body follows.\n"
|
|
306
|
+
"\n"
|
|
307
|
+
"BASIC AUTH — ALWAYS use username= and password=, NEVER construct headers manually:\n"
|
|
308
|
+
" response = http_request('GET', 'https://api.example.com/data',\n"
|
|
309
|
+
" username='alice@example.com', password='secret123')\n"
|
|
310
|
+
" final_answer(response)\n"
|
|
311
|
+
"The function handles base64 encoding automatically. NEVER write 'Basic ' + anything.\n"
|
|
312
|
+
"\n"
|
|
313
|
+
"BEARER TOKEN — use headers:\n"
|
|
314
|
+
" response = http_request('GET', url, headers='{\"Authorization\": \"Bearer TOKEN\"}')\n"
|
|
299
315
|
" final_answer(response)\n"
|
|
300
|
-
"
|
|
301
|
-
"
|
|
302
|
-
"-
|
|
303
|
-
"
|
|
304
|
-
"-
|
|
305
|
-
"-
|
|
306
|
-
"- If http_request returns an error (starts with 'Error:'), try a different URL.\n"
|
|
307
|
-
"- Python's `datetime` module is available for date/time tasks.\n"
|
|
316
|
+
"\n"
|
|
317
|
+
"RULES:\n"
|
|
318
|
+
"- Pass response DIRECTLY to final_answer — do NOT split, parse, or index the string.\n"
|
|
319
|
+
"- If the response starts with 'HTTP 2' it SUCCEEDED — call final_answer immediately.\n"
|
|
320
|
+
"- If http_request returns 'Error:' or HTTP 4xx/5xx, try a different approach.\n"
|
|
321
|
+
"- Python's datetime module is available for date/time tasks (no HTTP needed).\n"
|
|
308
322
|
"- Do NOT put final_answer outside the code block.\n\n"
|
|
309
323
|
)
|
|
310
324
|
task_with_hint = tool_hint + "Task: " + task_text
|
|
@@ -394,8 +408,8 @@ def run_agent_chat(cfg):
|
|
|
394
408
|
|
|
395
409
|
try:
|
|
396
410
|
model = OpenAIServerModel(
|
|
397
|
-
model_id=
|
|
398
|
-
api_base=
|
|
411
|
+
model_id=coding_model_id,
|
|
412
|
+
api_base=coding_base_url,
|
|
399
413
|
api_key=agent_api_key,
|
|
400
414
|
)
|
|
401
415
|
agent = CodeAgent(
|
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.81",
|
|
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",
|