@tiens.nguyen/gonext-local-worker 1.0.229 → 1.0.231

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-repl.mjs CHANGED
@@ -516,6 +516,19 @@ async function loadSessionTestAuto(cwd) {
516
516
  }
517
517
  }
518
518
 
519
+ // The /server deploy-target pick is also remembered per folder, so a fresh terminal in
520
+ // the same project still knows where to deploy (task #69 — it was session-only and got
521
+ // lost on restart). Returns {name,host,user} or null.
522
+ async function loadSessionServer(cwd) {
523
+ try {
524
+ const raw = JSON.parse(await readFile(sessionFilePath(cwd), "utf8"));
525
+ const s = raw?.deployServer;
526
+ return s && typeof s.host === "string" && typeof s.user === "string" ? s : null;
527
+ } catch {
528
+ return null;
529
+ }
530
+ }
531
+
519
532
  async function saveSession(cwd, history) {
520
533
  try {
521
534
  await mkdir(SESSIONS_DIR, { recursive: true });
@@ -523,7 +536,13 @@ async function saveSession(cwd, history) {
523
536
  await writeFile(
524
537
  sessionFilePath(cwd),
525
538
  JSON.stringify(
526
- { cwd, updatedAt: new Date().toISOString(), testAuto: sessionTestAuto, history: trimmed },
539
+ {
540
+ cwd,
541
+ updatedAt: new Date().toISOString(),
542
+ testAuto: sessionTestAuto,
543
+ deployServer: selectedServer, // remember the /server pick per folder (task #69)
544
+ history: trimmed,
545
+ },
527
546
  null,
528
547
  2
529
548
  ) + "\n"
@@ -1321,8 +1340,10 @@ async function runAgentTurn(history) {
1321
1340
  async function main() {
1322
1341
  console.log(cyan("GoNext agent REPL") + dim(` · API ${apiBase} · key ${workerKey.slice(0, 8)}…`));
1323
1342
  await ensureWorkspace();
1324
- // Restore this folder's remembered auto-test choice so the banner + agent-ask reflect it.
1343
+ // Restore this folder's remembered auto-test + deploy-target so the banner + agent-ask
1344
+ // reflect them (both survive a fresh terminal in the same project).
1325
1345
  sessionTestAuto = await loadSessionTestAuto(resolve(process.cwd()));
1346
+ selectedServer = await loadSessionServer(resolve(process.cwd()));
1326
1347
  // Show which models will answer, straight from user settings (also validates auth).
1327
1348
  try {
1328
1349
  const probe = await fetchAgentPayload([{ role: "user", content: "ping" }]);
@@ -1332,7 +1353,8 @@ async function main() {
1332
1353
  `agent model: ${p.agentModelId || probe?.modelKey || "?"}` +
1333
1354
  (p.codingModelId ? ` · coder: ${p.codingModelId}` : "") +
1334
1355
  (p.ragEnabled ? " · RAG on" : "") +
1335
- ` · auto-test: ${sessionTestAuto ? "on" : "off"}`
1356
+ ` · auto-test: ${sessionTestAuto ? "on" : "off"}` +
1357
+ (selectedServer ? ` · deploy: ${selectedServer.name} (${selectedServer.user}@${selectedServer.host})` : "")
1336
1358
  ) + (sessionTestAuto ? "" : dim(" (/test-auto to enable)"))
1337
1359
  );
1338
1360
  } catch (err) {
@@ -1415,6 +1437,7 @@ async function main() {
1415
1437
  }
1416
1438
  if (line === "/server") {
1417
1439
  await chooseServer();
1440
+ await saveSession(cwd, history); // remember the pick for this folder
1418
1441
  continue;
1419
1442
  }
1420
1443
  if (line === "/test-auto") {
@@ -3140,16 +3140,23 @@ def run_agent_chat(cfg):
3140
3140
  _dh = str(_deploy_server.get("host")).strip()
3141
3141
  _du = str(_deploy_server.get("user")).strip()
3142
3142
  _dn = str(_deploy_server.get("name") or _dh).strip()
3143
+ # Diagnostic: prove the picked server reached python (visible in the worker log).
3144
+ _log(f"deploy target: {_du}@{_dh} (server '{_dn}') — injecting into the prompt")
3143
3145
  _deploy_block = (
3144
- f"\nDEPLOY TARGET (the user selected server '{_dn}'): host {_dh}, user {_du}. "
3145
- f"When the task is about DEPLOYING, deploy to THIS server deploy_web(local_dir, "
3146
- f"host='{_dh}', user='{_du}', remote_path=...) or ssh/scp/rsync to {_du}@{_dh}. "
3147
- "KEY auth ONLY (-o BatchMode=yes); NEVER ask for or type a password. If key auth "
3148
- f"isn't set up (Permission denied publickey,password), STOP and tell the user to "
3149
- f"run 'ssh-copy-id {_du}@{_dh}' once, then retry.\n"
3146
+ f"\n*** DEPLOY TARGET the user already chose a server: '{_dn}' host={_dh}, "
3147
+ f"user={_du}. Do NOT search the project for host/user/credentials and do NOT ask "
3148
+ f"for them; you already have them. When the task is to DEPLOY, go straight to "
3149
+ f"deploy_web(local_dir, host='{_dh}', user='{_du}', remote_path='/var/www/<domain>', "
3150
+ f"domain='<domain>') or ssh/scp/rsync to {_du}@{_dh}. KEY auth ONLY "
3151
+ f"(-o BatchMode=yes); NEVER ask for or type a password. If key auth isn't set up "
3152
+ f"(Permission denied publickey,password), STOP and tell the user to run "
3153
+ f"'ssh-copy-id {_du}@{_dh}' once, then retry. ***\n"
3150
3154
  )
3151
3155
  tool_hint = (
3152
- f"Solve the TASK step by step (up to {max_steps} steps). At EACH step write a "
3156
+ # Deploy target FIRST (when a server is picked) a small model buries context deep
3157
+ # in a 20k-char hint, so the chosen server must lead, not trail (task #69 retest fix).
3158
+ _deploy_block
3159
+ + f"Solve the TASK step by step (up to {max_steps} steps). At EACH step write a "
3153
3160
  "brief Thought, then ONE code block that calls a SINGLE tool. You will SEE that "
3154
3161
  "tool's result (Observation) before the next step — use it to decide what to do "
3155
3162
  "next (e.g. web_search to find a URL, THEN fetch_url to read it). When you have "
@@ -3158,7 +3165,7 @@ def run_agent_chat(cfg):
3158
3165
  "{{TOOL_LIST}}\n" # filled in below, once from the REAL registered tool objects
3159
3166
  f"(Current date/time: {now_str} — pass a timezone to get_current_datetime() only "
3160
3167
  "if the task needs a DIFFERENT one.)\n"
3161
- + _rag_tool_block + _ws_tool_block + _auto_test_block + _deploy_block +
3168
+ + _rag_tool_block + _ws_tool_block + _auto_test_block +
3162
3169
  "\n"
3163
3170
  "http_request RETURN FORMAT: 'HTTP 200\\n{body}' — first line is 'HTTP <code>', body follows.\n"
3164
3171
  "\n"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gonext-local-worker",
3
- "version": "1.0.229",
3
+ "version": "1.0.231",
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",