@tiens.nguyen/gonext-local-worker 1.0.213 → 1.0.214

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.
@@ -1837,6 +1837,21 @@ async function runAgentChatJob(job) {
1837
1837
  // lands here (must be a registered workspace; the python side re-validates).
1838
1838
  activeWorkspace: payload?.activeWorkspace ?? "",
1839
1839
  });
1840
+ // Remember the terminal's current folder so the web homepage can highlight which
1841
+ // registered workspace is ACTIVE (the local_health job reads this back). Without it
1842
+ // the web can only dump the full workspaces.json list with no "you are here" signal.
1843
+ // Fire-and-forget; a stale value just points at the last-used folder, which is fine.
1844
+ if (typeof payload?.activeWorkspace === "string" && payload.activeWorkspace) {
1845
+ const activePath = payload.activeWorkspace;
1846
+ void mkdir(join(homedir(), ".gonext"), { recursive: true })
1847
+ .then(() =>
1848
+ writeFile(
1849
+ join(homedir(), ".gonext", "active-workspace.json"),
1850
+ JSON.stringify({ path: activePath, at: new Date().toISOString() }) + "\n"
1851
+ )
1852
+ )
1853
+ .catch(() => {});
1854
+ }
1840
1855
  // 30 min max for an agent run: multi-step ReAct on a 14B/31B with a cold prompt
1841
1856
  // cache — or a remote Ollama box on slow GPU cold-loading a big model — can run
1842
1857
  // for many minutes per step. Must stay BELOW the web client's hard WS deadline
@@ -2558,19 +2573,31 @@ async function runLocalHealthJob(job) {
2558
2573
  }
2559
2574
  : undefined,
2560
2575
  // Registered coding workspaces (names/paths only — no secrets) so the web can
2561
- // show which folders the agent may read/edit on this Mac.
2562
- workspaces: await readFile(join(homedir(), ".gonext", "workspaces.json"), "utf8")
2563
- .then((raw) => {
2564
- const parsed = JSON.parse(raw);
2565
- return Array.isArray(parsed?.workspaces)
2566
- ? parsed.workspaces.map((w) => ({
2567
- name: String(w.name ?? ""),
2568
- path: String(w.path ?? ""),
2569
- allowRun: Boolean(w.allowRun),
2570
- }))
2571
- : undefined;
2572
- })
2573
- .catch(() => undefined),
2576
+ // show which folders the agent may read/edit on this Mac. The one the `gonext`
2577
+ // terminal last ran in is flagged `active` (persisted per agent job) and sorted
2578
+ // first so the web can highlight it instead of dumping the whole list flat.
2579
+ workspaces: await (async () => {
2580
+ const activePath = await readFile(
2581
+ join(homedir(), ".gonext", "active-workspace.json"),
2582
+ "utf8"
2583
+ )
2584
+ .then((raw) => String(JSON.parse(raw)?.path ?? ""))
2585
+ .catch(() => "");
2586
+ return readFile(join(homedir(), ".gonext", "workspaces.json"), "utf8")
2587
+ .then((raw) => {
2588
+ const parsed = JSON.parse(raw);
2589
+ if (!Array.isArray(parsed?.workspaces)) return undefined;
2590
+ const list = parsed.workspaces.map((w) => ({
2591
+ name: String(w.name ?? ""),
2592
+ path: String(w.path ?? ""),
2593
+ allowRun: Boolean(w.allowRun),
2594
+ active: Boolean(activePath) && String(w.path ?? "") === activePath,
2595
+ }));
2596
+ // Active folder first; the rest keep their registration order.
2597
+ return list.sort((a, b) => Number(b.active) - Number(a.active));
2598
+ })
2599
+ .catch(() => undefined);
2600
+ })(),
2574
2601
  };
2575
2602
  const totalTimeSeconds = (Date.now() - start) / 1000;
2576
2603
  const doneRes = await workerFetch(`/api/worker/jobs/${jobId}`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gonext-local-worker",
3
- "version": "1.0.213",
3
+ "version": "1.0.214",
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",