@tiens.nguyen/gonext-local-worker 1.0.44 → 1.0.45

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.
@@ -20,7 +20,8 @@ import OpenAI from "openai";
20
20
  const execFile = promisify(execFileCallback);
21
21
 
22
22
  const ENV_FILE = join(homedir(), ".gonext", "worker.env");
23
- dotenv.config({ path: ENV_FILE });
23
+ const preloadedWorkerKey = String(process.env.GONEXT_WORKER_KEY ?? "").trim();
24
+ const envFileLoad = dotenv.config({ path: ENV_FILE });
24
25
  dotenv.config();
25
26
 
26
27
  const args = process.argv.slice(2);
@@ -31,6 +32,13 @@ function workerKeyFingerprint(secret) {
31
32
  return createHash("sha256").update(v, "utf8").digest("hex").slice(0, 12);
32
33
  }
33
34
 
35
+ function maskWorkerKey(secret) {
36
+ const v = String(secret ?? "").trim();
37
+ if (!v) return "(empty)";
38
+ if (v.length <= 12) return `${v.slice(0, 3)}***`;
39
+ return `${v.slice(0, 8)}...${v.slice(-4)}`;
40
+ }
41
+
34
42
  function printHelp() {
35
43
  console.log(`
36
44
  gonext-local-worker
@@ -108,6 +116,16 @@ const apiBase = String(process.env.GONEXT_API_BASE ?? "")
108
116
  .trim()
109
117
  .replace(/\/+$/, "");
110
118
  const workerKey = String(process.env.GONEXT_WORKER_KEY ?? "").trim();
119
+ const envFileWorkerKey = String(envFileLoad.parsed?.GONEXT_WORKER_KEY ?? "").trim();
120
+ const workerKeySource = (() => {
121
+ if (preloadedWorkerKey && workerKey === preloadedWorkerKey) {
122
+ return "process.env";
123
+ }
124
+ if (envFileWorkerKey && workerKey === envFileWorkerKey) {
125
+ return ENV_FILE;
126
+ }
127
+ return "unknown";
128
+ })();
111
129
  const pollMs = 500;
112
130
  const localHealthConcurrency = 4;
113
131
 
@@ -294,6 +312,11 @@ console.log(
294
312
  workerKey
295
313
  )}`
296
314
  );
315
+ console.log(
316
+ `[gonext-worker] worker key ${maskWorkerKey(workerKey)} (keyfp=${workerKeyFingerprint(
317
+ workerKey
318
+ )}, source=${workerKeySource})`
319
+ );
297
320
 
298
321
  function toOpenAIMessages(messages) {
299
322
  return (Array.isArray(messages) ? messages : []).map((m) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gonext-local-worker",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
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",