@leo000001/codex-mcp 2.1.5 → 2.1.6

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/dist/index.js CHANGED
@@ -243,7 +243,7 @@ function getPathExtensions(env) {
243
243
  }
244
244
  return Array.from(new Set(merged));
245
245
  }
246
- function commandExistsOnPath(command, env) {
246
+ function resolveCommandFromPath(command, env) {
247
247
  const dirs = getPathEntries(env);
248
248
  const ext = process.platform === "win32" ? path2.extname(command) : "";
249
249
  const names = process.platform === "win32" ? Array.from(
@@ -254,10 +254,10 @@ function commandExistsOnPath(command, env) {
254
254
  for (const dir of dirs) {
255
255
  for (const name of names) {
256
256
  const candidate = path2.join(dir, name);
257
- if (isExecutableFile(candidate)) return true;
257
+ if (isExecutableFile(candidate)) return path2.normalize(candidate);
258
258
  }
259
259
  }
260
- return false;
260
+ return void 0;
261
261
  }
262
262
  function looksLikePath(value) {
263
263
  return value.includes("/") || value.includes("\\");
@@ -288,14 +288,16 @@ function resolveDefaultCodexExecutable(env = process.env) {
288
288
  `${CODEX_MCP_COMMAND}="${envCommand}" looks like a path. Use ${CODEX_MCP_PATH} for filesystem paths.`
289
289
  );
290
290
  }
291
- if (!commandExistsOnPath(envCommand, env)) {
291
+ const resolved = resolveCommandFromPath(envCommand, env);
292
+ if (!resolved) {
292
293
  throw new Error(`${CODEX_MCP_COMMAND}="${envCommand}" was not found in PATH.`);
293
294
  }
294
- return { command: envCommand, isPath: false, source: "env_command" };
295
+ return { command: resolved, isPath: true, source: "env_command" };
295
296
  }
296
297
  for (const candidate of AUTO_CODEX_COMMANDS) {
297
- if (commandExistsOnPath(candidate, env)) {
298
- return { command: candidate, isPath: false, source: "auto_detect" };
298
+ const resolved = resolveCommandFromPath(candidate, env);
299
+ if (resolved) {
300
+ return { command: resolved, isPath: true, source: "auto_detect" };
299
301
  }
300
302
  }
301
303
  return { command: "codex", isPath: false, source: "default" };
@@ -308,16 +310,15 @@ function getDefaultCodexExecutable() {
308
310
  }
309
311
  function checkDefaultCodexExecutableAvailability() {
310
312
  const info = getDefaultCodexExecutable();
311
- const label = info.isPath ? "path" : "command";
312
313
  switch (info.source) {
313
314
  case "env_path":
314
315
  console.error(`[codex-executable] Using ${CODEX_MCP_PATH}: ${info.command}`);
315
316
  break;
316
317
  case "env_command":
317
- console.error(`[codex-executable] Using ${CODEX_MCP_COMMAND}: ${info.command}`);
318
+ console.error(`[codex-executable] Using ${CODEX_MCP_COMMAND}: resolved to ${info.command}`);
318
319
  break;
319
320
  case "auto_detect":
320
- console.error(`[codex-executable] Auto-detected ${label}: ${info.command}`);
321
+ console.error(`[codex-executable] Auto-detected executable: ${info.command}`);
321
322
  break;
322
323
  case "default":
323
324
  console.error(
@@ -392,7 +393,7 @@ var DEFAULT_TERMINAL_CLEANUP_MS = 5 * 60 * 1e3;
392
393
  var CLEANUP_INTERVAL_MS = 6e4;
393
394
 
394
395
  // src/app-server/client.ts
395
- var CLIENT_VERSION = true ? "2.1.5" : "0.0.0-dev";
396
+ var CLIENT_VERSION = true ? "2.1.6" : "0.0.0-dev";
396
397
  var DEFAULT_REQUEST_TIMEOUT = 3e4;
397
398
  var STARTUP_REQUEST_TIMEOUT = 9e4;
398
399
  var MAX_WRITE_QUEUE_BYTES = 5 * 1024 * 1024;
@@ -3147,6 +3148,10 @@ function probeAppServer(codexCommand, codexIsPath, env) {
3147
3148
  }
3148
3149
 
3149
3150
  // src/tools/codex-setup.ts
3151
+ function isCodexInternalExecutable(info) {
3152
+ const ext = path5.extname(info.command);
3153
+ return path5.basename(info.command, ext).toLowerCase() === "codex-internal";
3154
+ }
3150
3155
  function classifyAuthResult(status, combined) {
3151
3156
  if (status === 0) return "authenticated";
3152
3157
  if (/(not (logged|authenticated)|login required|run\s+codex\s+login)/i.test(combined)) {
@@ -3159,6 +3164,13 @@ function resolveCodexStateDir() {
3159
3164
  return configured && configured !== "" ? configured : path5.join(homedir(), ".codex-mcp", "state");
3160
3165
  }
3161
3166
  function probeCodexAuth(info) {
3167
+ if (isCodexInternalExecutable(info)) {
3168
+ return {
3169
+ ok: true,
3170
+ state: "unknown",
3171
+ detail: "Using a codex-internal executable; auth/login readiness is not probed and does not block setup readiness."
3172
+ };
3173
+ }
3162
3174
  const invocation = resolveCodexInvocation(["login", "status"], {
3163
3175
  codexCommand: info.command,
3164
3176
  codexIsPath: info.isPath
@@ -3191,9 +3203,11 @@ async function executeCodexSetup(input, serverCwd) {
3191
3203
  let executable;
3192
3204
  let auth;
3193
3205
  let clientMode;
3206
+ let internalExecutable = false;
3194
3207
  try {
3195
3208
  const info = resolveDefaultCodexExecutable();
3196
3209
  const available = info.source !== "default";
3210
+ internalExecutable = isCodexInternalExecutable(info);
3197
3211
  executable = {
3198
3212
  ok: available,
3199
3213
  source: info.source,
@@ -3237,7 +3251,7 @@ async function executeCodexSetup(input, serverCwd) {
3237
3251
  if (auth.state === "unauthenticated") {
3238
3252
  warnings.push(auth.detail);
3239
3253
  nextSteps.push("Run `codex login` and rerun `codex_setup`.");
3240
- } else if (auth.state === "unknown") {
3254
+ } else if (auth.state === "unknown" && !internalExecutable) {
3241
3255
  warnings.push(auth.detail);
3242
3256
  nextSteps.push(
3243
3257
  "Verify Codex authentication explicitly (for example with `codex login status`) before relying on this environment."
@@ -3929,7 +3943,7 @@ function registerResources(server, deps) {
3929
3943
  }
3930
3944
 
3931
3945
  // src/server.ts
3932
- var SERVER_VERSION = true ? "2.1.5" : "0.0.0-dev";
3946
+ var SERVER_VERSION = true ? "2.1.6" : "0.0.0-dev";
3933
3947
  function formatErrorMessage(err) {
3934
3948
  const message = err instanceof Error ? err.message : String(err);
3935
3949
  const m = /^Error \[([A-Z_]+)\]:\s*(.*)$/.exec(message);