@slock-ai/daemon 0.19.0 → 0.20.0

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.
Files changed (2) hide show
  1. package/dist/index.js +37 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -372,8 +372,14 @@ var ClaudeDriver = class {
372
372
  }
373
373
  }
374
374
  });
375
- const mcpConfigPath = path.join(ctx.workingDirectory, ".slock-claude-mcp.json");
376
- writeFileSync(mcpConfigPath, mcpConfig, "utf8");
375
+ let mcpConfigArg;
376
+ if (process.platform === "win32") {
377
+ const mcpConfigPath = path.join(ctx.workingDirectory, ".slock-claude-mcp.json");
378
+ writeFileSync(mcpConfigPath, mcpConfig, "utf8");
379
+ mcpConfigArg = mcpConfigPath;
380
+ } else {
381
+ mcpConfigArg = mcpConfig;
382
+ }
377
383
  const args2 = [
378
384
  "--allow-dangerously-skip-permissions",
379
385
  "--dangerously-skip-permissions",
@@ -383,7 +389,7 @@ var ClaudeDriver = class {
383
389
  "--input-format",
384
390
  "stream-json",
385
391
  "--mcp-config",
386
- mcpConfigPath,
392
+ mcpConfigArg,
387
393
  "--model",
388
394
  ctx.config.model || "sonnet",
389
395
  "--disallowed-tools",
@@ -578,11 +584,36 @@ var CodexDriver = class {
578
584
  }
579
585
  args2.push(ctx.prompt);
580
586
  const spawnEnv = { ...process.env, FORCE_COLOR: "0", NO_COLOR: "1", ...ctx.config.envVars || {} };
581
- const proc = spawn2("codex", args2, {
587
+ let spawnCmd = "codex";
588
+ let spawnArgs = args2;
589
+ if (process.platform === "win32") {
590
+ let codexEntry = null;
591
+ try {
592
+ const globalRoot = execSync("npm root -g", { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }).trim();
593
+ const candidate = path2.join(globalRoot, "@openai", "codex", "bin", "codex.js");
594
+ if (existsSync(candidate)) codexEntry = candidate;
595
+ } catch {
596
+ }
597
+ if (!codexEntry) {
598
+ try {
599
+ const cmdPath = execSync("where codex", { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }).trim().split(/\r?\n/)[0];
600
+ const candidate = path2.join(path2.dirname(cmdPath), "node_modules", "@openai", "codex", "bin", "codex.js");
601
+ if (existsSync(candidate)) codexEntry = candidate;
602
+ } catch {
603
+ }
604
+ }
605
+ if (!codexEntry) {
606
+ throw new Error(
607
+ "Cannot resolve Codex CLI entry point on Windows. Ensure @openai/codex is installed globally via npm (npm i -g @openai/codex)."
608
+ );
609
+ }
610
+ spawnCmd = process.execPath;
611
+ spawnArgs = [codexEntry, ...args2];
612
+ }
613
+ const proc = spawn2(spawnCmd, spawnArgs, {
582
614
  cwd: ctx.workingDirectory,
583
615
  stdio: ["pipe", "pipe", "pipe"],
584
- env: spawnEnv,
585
- shell: process.platform === "win32"
616
+ env: spawnEnv
586
617
  });
587
618
  return { process: proc };
588
619
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slock-ai/daemon",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "slock-daemon": "dist/index.js"