ai-sdk-provider-codex-cli 1.0.2 → 1.0.4

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/README.md CHANGED
@@ -21,10 +21,10 @@ A community provider for Vercel AI SDK v6 that uses OpenAI's Codex CLI (non‑in
21
21
 
22
22
  ## Version Compatibility
23
23
 
24
- | Provider Version | AI SDK Version | NPM Tag | NPM Installation |
25
- | ---------------- | -------------- | ------------ | ---------------- |
26
- | 1.x.x | v6 | `latest` | `npm i ai-sdk-provider-codex-cli ai@^6.0.0` |
27
- | 0.x.x | v5 | `ai-sdk-v5` | `npm i ai-sdk-provider-codex-cli@ai-sdk-v5 ai@^5.0.0` |
24
+ | Provider Version | AI SDK Version | NPM Tag | NPM Installation |
25
+ | ---------------- | -------------- | ----------- | ----------------------------------------------------- |
26
+ | 1.x.x | v6 | `latest` | `npm i ai-sdk-provider-codex-cli ai@^6.0.0` |
27
+ | 0.x.x | v5 | `ai-sdk-v5` | `npm i ai-sdk-provider-codex-cli@ai-sdk-v5 ai@^5.0.0` |
28
28
 
29
29
  ## Installation
30
30
 
package/dist/index.cjs CHANGED
@@ -410,7 +410,13 @@ var codexCliProviderOptionsSchema = zod.z.object({
410
410
  rmcpClient: zod.z.boolean().optional()
411
411
  }).strict();
412
412
  function resolveCodexPath(explicitPath, allowNpx) {
413
- if (explicitPath) return { cmd: "node", args: [explicitPath] };
413
+ if (explicitPath) {
414
+ const lower = explicitPath.toLowerCase();
415
+ if (lower.endsWith(".js") || lower.endsWith(".mjs") || lower.endsWith(".cjs")) {
416
+ return { cmd: "node", args: [explicitPath] };
417
+ }
418
+ return { cmd: explicitPath, args: [] };
419
+ }
414
420
  try {
415
421
  const req = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
416
422
  const pkgPath = req.resolve("@openai/codex/package.json");
@@ -615,7 +621,6 @@ var CodexCliLanguageModel = class {
615
621
  this.logger.warn(`[codex-cli] Failed to write image to temp file: ${String(e)}`);
616
622
  }
617
623
  }
618
- args.push(promptText);
619
624
  const env = {
620
625
  ...process.env,
621
626
  ...settings.env || {},
@@ -629,6 +634,10 @@ var CodexCliLanguageModel = class {
629
634
  lastMessageIsTemp = true;
630
635
  }
631
636
  args.push("--output-last-message", lastMessagePath);
637
+ if (tempImagePaths.length > 0) {
638
+ args.push("--");
639
+ }
640
+ args.push(promptText);
632
641
  return {
633
642
  cmd: base.cmd,
634
643
  args,
@@ -996,7 +1005,7 @@ var CodexCliLanguageModel = class {
996
1005
  );
997
1006
  let text = "";
998
1007
  let usage = createEmptyCodexUsage();
999
- let finishReason = mapCodexCliFinishReason(void 0);
1008
+ const finishReason = mapCodexCliFinishReason(void 0);
1000
1009
  const startTime = Date.now();
1001
1010
  const child = child_process.spawn(cmd, args, { env, cwd, stdio: ["ignore", "pipe", "pipe"] });
1002
1011
  let onAbort;
package/dist/index.js CHANGED
@@ -407,7 +407,13 @@ var codexCliProviderOptionsSchema = z.object({
407
407
  rmcpClient: z.boolean().optional()
408
408
  }).strict();
409
409
  function resolveCodexPath(explicitPath, allowNpx) {
410
- if (explicitPath) return { cmd: "node", args: [explicitPath] };
410
+ if (explicitPath) {
411
+ const lower = explicitPath.toLowerCase();
412
+ if (lower.endsWith(".js") || lower.endsWith(".mjs") || lower.endsWith(".cjs")) {
413
+ return { cmd: "node", args: [explicitPath] };
414
+ }
415
+ return { cmd: explicitPath, args: [] };
416
+ }
411
417
  try {
412
418
  const req = createRequire(import.meta.url);
413
419
  const pkgPath = req.resolve("@openai/codex/package.json");
@@ -612,7 +618,6 @@ var CodexCliLanguageModel = class {
612
618
  this.logger.warn(`[codex-cli] Failed to write image to temp file: ${String(e)}`);
613
619
  }
614
620
  }
615
- args.push(promptText);
616
621
  const env = {
617
622
  ...process.env,
618
623
  ...settings.env || {},
@@ -626,6 +631,10 @@ var CodexCliLanguageModel = class {
626
631
  lastMessageIsTemp = true;
627
632
  }
628
633
  args.push("--output-last-message", lastMessagePath);
634
+ if (tempImagePaths.length > 0) {
635
+ args.push("--");
636
+ }
637
+ args.push(promptText);
629
638
  return {
630
639
  cmd: base.cmd,
631
640
  args,
@@ -993,7 +1002,7 @@ var CodexCliLanguageModel = class {
993
1002
  );
994
1003
  let text = "";
995
1004
  let usage = createEmptyCodexUsage();
996
- let finishReason = mapCodexCliFinishReason(void 0);
1005
+ const finishReason = mapCodexCliFinishReason(void 0);
997
1006
  const startTime = Date.now();
998
1007
  const child = spawn(cmd, args, { env, cwd, stdio: ["ignore", "pipe", "pipe"] });
999
1008
  let onAbort;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-sdk-provider-codex-cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "AI SDK v6 provider for OpenAI Codex CLI (use ChatGPT Plus/Pro subscription)",
5
5
  "keywords": [
6
6
  "ai-sdk",