@ycodium-ai/agent-codex 0.2.4486 → 0.2.4688

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 +51 -17
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { definePlugin } from "@ycodium-ai/plugin-api";
3
3
 
4
4
  // ../../packages/plugin-api/src/version.ts
5
- var PLUGIN_API_VERSION = 119;
5
+ var PLUGIN_API_VERSION = 128;
6
6
 
7
7
  // src/index.ts
8
8
  import {
@@ -48,6 +48,7 @@ var CODEX_CARD = {
48
48
  "5.3-spark": "gpt-5.3-codex-spark",
49
49
  "gpt-5.3-spark": "gpt-5.3-codex-spark"
50
50
  },
51
+ mcpToolCallCeilingSeconds: 630,
51
52
  mcpTransports: ["stdio", "http"],
52
53
  pluginManaged: true,
53
54
  verifiedSkills: true,
@@ -96,6 +97,7 @@ var CODEX_CARD = {
96
97
  type: "string",
97
98
  "x-ycodium-form": {
98
99
  titleKey: "form.homePath.title",
100
+ machineLocal: true,
99
101
  placeholderKey: "form.homePath.placeholder"
100
102
  }
101
103
  },
@@ -103,6 +105,7 @@ var CODEX_CARD = {
103
105
  type: "string",
104
106
  "x-ycodium-form": {
105
107
  titleKey: "form.shadowHomePath.title",
108
+ machineLocal: true,
106
109
  descriptionKey: "form.shadowHomePath.description",
107
110
  placeholderKey: "form.shadowHomePath.placeholder"
108
111
  }
@@ -2434,10 +2437,12 @@ function buildCodexSpawnEnv(input) {
2434
2437
  handOverrides: input.crushApiKeys ? CRUSHED_API_KEYS : {}
2435
2438
  });
2436
2439
  }
2437
- function nativeLoginSpawnEnv(processEnv, isolatedHome) {
2440
+ function nativeLoginSpawnEnv(input) {
2441
+ const { HOME: _instanceHome, ...instanceTable } = input.recipe.environment;
2438
2442
  return mergeLaunchEnv({
2439
- inherited: processEnv,
2440
- handOverrides: { ...CRUSHED_API_KEYS, CODEX_HOME: isolatedHome }
2443
+ inherited: input.processEnv,
2444
+ instanceTable,
2445
+ handOverrides: { ...CRUSHED_API_KEYS, CODEX_HOME: input.isolatedHome }
2441
2446
  });
2442
2447
  }
2443
2448
  function shouldCrushApiKeys(authMode) {
@@ -2538,8 +2543,9 @@ var DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
2538
2543
  var ANSI_ESCAPE_CHAR = String.fromCharCode(27);
2539
2544
  var ANSI_RE = new RegExp(`${ANSI_ESCAPE_CHAR}\\[[0-9;]*m`, "g");
2540
2545
  var CODEX_STDERR_LOG_REGEX = /\b(TRACE|DEBUG|INFO|WARN|ERROR)\b/;
2546
+ var stripCodexColors = (text) => text.replace(ANSI_RE, "");
2541
2547
  function classifyStderrLine(line) {
2542
- const stripped = line.replace(ANSI_RE, "").trim();
2548
+ const stripped = stripCodexColors(line).trim();
2543
2549
  if (stripped.length === 0) return "drop";
2544
2550
  const match = CODEX_STDERR_LOG_REGEX.exec(stripped);
2545
2551
  if (match === null) return "error";
@@ -6253,10 +6259,15 @@ async function startCodexSignIn(input) {
6253
6259
  throw new Error("Codex program path is not configured");
6254
6260
  }
6255
6261
  const isolatedHome = accountHomeFromLayout(input.layout);
6256
- const env = nativeLoginSpawnEnv(input.processEnv, isolatedHome);
6262
+ const env = nativeLoginSpawnEnv({
6263
+ processEnv: input.processEnv,
6264
+ recipe: input.recipe,
6265
+ isolatedHome
6266
+ });
6257
6267
  const loginRecipe = { ...input.recipe, authMode: "chatgpt" };
6258
6268
  const owner = { bindingId: input.host.bindingId };
6259
6269
  const lifetime = signInLifetime(input.signal);
6270
+ let appServerFailure;
6260
6271
  try {
6261
6272
  const tryAppServer = async () => {
6262
6273
  const { handle: handle2 } = await spawnCodexAppServer({
@@ -6342,6 +6353,7 @@ async function startCodexSignIn(input) {
6342
6353
  } catch (error) {
6343
6354
  await closeSignInRpc(rpc, input.host, handle2).catch(() => void 0);
6344
6355
  if (lifetime.signal.aborted) throw error;
6356
+ appServerFailure = error instanceof Error ? error.message : String(error);
6345
6357
  return void 0;
6346
6358
  }
6347
6359
  };
@@ -6359,24 +6371,42 @@ async function startCodexSignIn(input) {
6359
6371
  });
6360
6372
  const stdout = { text: "" };
6361
6373
  const stderr = { text: "" };
6362
- void collectText(handle.stdout, stdout);
6363
- void collectText(handle.stderr, stderr);
6374
+ const reading = Promise.all([
6375
+ collectText(handle.stdout, stdout),
6376
+ collectText(handle.stderr, stderr)
6377
+ ]).catch(() => void 0);
6378
+ const cli = { exited: false };
6379
+ void handle.exited.then(
6380
+ () => cli.exited = true,
6381
+ () => cli.exited = true
6382
+ );
6383
+ const output = () => stripCodexColors(`${stdout.text}
6384
+ ${stderr.text}`);
6364
6385
  const deadline = Date.now() + 3e3;
6365
- while (Date.now() < deadline) {
6366
- const combined2 = `${stdout.text}
6367
- ${stderr.text}`;
6386
+ while (Date.now() < deadline && !cli.exited) {
6387
+ const combined2 = output();
6368
6388
  if (deviceCodeUrl(combined2) && deviceCodeValue(combined2)) break;
6369
6389
  await new Promise((resolve4) => setTimeout(resolve4, 50));
6370
6390
  }
6371
- const combined = `${stdout.text}
6372
- ${stderr.text}`;
6391
+ if (cli.exited) await reading;
6392
+ const combined = output();
6373
6393
  const operationId = `codex-login-${Date.now()}`;
6374
6394
  const userCode = deviceCodeValue(combined);
6375
6395
  const verificationUrl = deviceCodeUrl(combined);
6396
+ if (userCode === void 0 || verificationUrl === void 0) {
6397
+ await handle.kill("SIGTERM").catch(() => void 0);
6398
+ await handle.exited.catch(() => void 0);
6399
+ const said = combined.trim().slice(-600) || appServerFailure;
6400
+ throw new Error(
6401
+ said === void 0 ? "Codex did not show a device code." : `Codex did not show a device code: ${said}`
6402
+ );
6403
+ }
6376
6404
  const completed = raceAbort(
6377
6405
  handle.exited.then((code) => {
6378
6406
  if (code !== 0)
6379
- throw new Error(stderr.text.trim() || `Codex sign-in exited with code ${String(code)}`);
6407
+ throw new Error(
6408
+ stripCodexColors(stderr.text).trim() || `Codex sign-in exited with code ${String(code)}`
6409
+ );
6380
6410
  }),
6381
6411
  lifetime.signal
6382
6412
  );
@@ -6399,8 +6429,8 @@ ${stderr.text}`;
6399
6429
  }
6400
6430
  }
6401
6431
  },
6402
- ...userCode ? { userCode } : {},
6403
- ...verificationUrl ? { verificationUrl } : {}
6432
+ userCode,
6433
+ verificationUrl
6404
6434
  };
6405
6435
  } catch (error) {
6406
6436
  lifetime.close();
@@ -6419,7 +6449,11 @@ async function verifyCodexSignIn(input) {
6419
6449
  detail: "Codex program path is not configured"
6420
6450
  };
6421
6451
  }
6422
- const env = nativeLoginSpawnEnv(input.processEnv, home);
6452
+ const env = nativeLoginSpawnEnv({
6453
+ processEnv: input.processEnv,
6454
+ recipe: input.recipe,
6455
+ isolatedHome: home
6456
+ });
6423
6457
  const { handle } = await spawnCodexAppServer({
6424
6458
  host: input.host,
6425
6459
  recipe: { ...input.recipe, authMode: "chatgpt" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-codex",
3
- "version": "0.2.4486",
3
+ "version": "0.2.4688",
4
4
  "description": "Codex executor: Codex CLI over the app-server JSON-RPC protocol.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -29,9 +29,9 @@
29
29
  "tailwindcss": "^4.0.0",
30
30
  "typescript": "~6.0.3",
31
31
  "vite-plus": "0.2.2",
32
- "@ycodium-ai/plugin-api": "0.2.4486",
33
- "ycodium-executor-testing": "0.0.0",
34
- "ycodium-jsonl-stream": "0.0.0"
32
+ "@ycodium-ai/plugin-api": "0.2.4688",
33
+ "ycodium-jsonl-stream": "0.0.0",
34
+ "ycodium-executor-testing": "0.0.0"
35
35
  },
36
36
  "ycodium": {
37
37
  "plugin": "./dist/index.js",