ai-sdk-provider-codex-cli 1.0.4 → 1.0.5
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.cjs +10 -6
- package/dist/index.js +10 -6
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -539,7 +539,7 @@ var CodexCliLanguageModel = class {
|
|
|
539
539
|
const current = typeof data.type === "string" ? data.type : void 0;
|
|
540
540
|
return legacy ?? current;
|
|
541
541
|
}
|
|
542
|
-
buildArgs(
|
|
542
|
+
buildArgs(images = [], responseFormat, settings = this.settings) {
|
|
543
543
|
const base = resolveCodexPath(settings.codexPath, settings.allowNpx);
|
|
544
544
|
const args = [...base.args, "exec", "--experimental-json"];
|
|
545
545
|
if (settings.fullAuto) {
|
|
@@ -637,7 +637,7 @@ var CodexCliLanguageModel = class {
|
|
|
637
637
|
if (tempImagePaths.length > 0) {
|
|
638
638
|
args.push("--");
|
|
639
639
|
}
|
|
640
|
-
args.push(
|
|
640
|
+
args.push("-");
|
|
641
641
|
return {
|
|
642
642
|
cmd: base.cmd,
|
|
643
643
|
args,
|
|
@@ -999,7 +999,7 @@ var CodexCliLanguageModel = class {
|
|
|
999
999
|
});
|
|
1000
1000
|
const effectiveSettings = this.mergeSettings(providerOptions);
|
|
1001
1001
|
const responseFormat = options.responseFormat?.type === "json" ? { type: "json", schema: options.responseFormat.schema } : void 0;
|
|
1002
|
-
const { cmd, args, env, cwd, lastMessagePath, lastMessageIsTemp, schemaPath, tempImagePaths } = this.buildArgs(
|
|
1002
|
+
const { cmd, args, env, cwd, lastMessagePath, lastMessageIsTemp, schemaPath, tempImagePaths } = this.buildArgs(images, responseFormat, effectiveSettings);
|
|
1003
1003
|
this.logger.debug(
|
|
1004
1004
|
`[codex-cli] Executing Codex CLI: ${cmd} with ${args.length} arguments, cwd: ${cwd ?? "default"}`
|
|
1005
1005
|
);
|
|
@@ -1007,7 +1007,9 @@ var CodexCliLanguageModel = class {
|
|
|
1007
1007
|
let usage = createEmptyCodexUsage();
|
|
1008
1008
|
const finishReason = mapCodexCliFinishReason(void 0);
|
|
1009
1009
|
const startTime = Date.now();
|
|
1010
|
-
const child = child_process.spawn(cmd, args, { env, cwd, stdio: ["
|
|
1010
|
+
const child = child_process.spawn(cmd, args, { env, cwd, stdio: ["pipe", "pipe", "pipe"] });
|
|
1011
|
+
child.stdin.write(promptText);
|
|
1012
|
+
child.stdin.end();
|
|
1011
1013
|
let onAbort;
|
|
1012
1014
|
if (options.abortSignal) {
|
|
1013
1015
|
if (options.abortSignal.aborted) {
|
|
@@ -1165,14 +1167,16 @@ var CodexCliLanguageModel = class {
|
|
|
1165
1167
|
});
|
|
1166
1168
|
const effectiveSettings = this.mergeSettings(providerOptions);
|
|
1167
1169
|
const responseFormat = options.responseFormat?.type === "json" ? { type: "json", schema: options.responseFormat.schema } : void 0;
|
|
1168
|
-
const { cmd, args, env, cwd, lastMessagePath, lastMessageIsTemp, schemaPath, tempImagePaths } = this.buildArgs(
|
|
1170
|
+
const { cmd, args, env, cwd, lastMessagePath, lastMessageIsTemp, schemaPath, tempImagePaths } = this.buildArgs(images, responseFormat, effectiveSettings);
|
|
1169
1171
|
this.logger.debug(
|
|
1170
1172
|
`[codex-cli] Executing Codex CLI for streaming: ${cmd} with ${args.length} arguments`
|
|
1171
1173
|
);
|
|
1172
1174
|
const stream = new ReadableStream({
|
|
1173
1175
|
start: (controller) => {
|
|
1174
1176
|
const startTime = Date.now();
|
|
1175
|
-
const child = child_process.spawn(cmd, args, { env, cwd, stdio: ["
|
|
1177
|
+
const child = child_process.spawn(cmd, args, { env, cwd, stdio: ["pipe", "pipe", "pipe"] });
|
|
1178
|
+
child.stdin.write(promptText);
|
|
1179
|
+
child.stdin.end();
|
|
1176
1180
|
controller.enqueue({ type: "stream-start", warnings });
|
|
1177
1181
|
let stderr = "";
|
|
1178
1182
|
let accumulatedText = "";
|
package/dist/index.js
CHANGED
|
@@ -536,7 +536,7 @@ var CodexCliLanguageModel = class {
|
|
|
536
536
|
const current = typeof data.type === "string" ? data.type : void 0;
|
|
537
537
|
return legacy ?? current;
|
|
538
538
|
}
|
|
539
|
-
buildArgs(
|
|
539
|
+
buildArgs(images = [], responseFormat, settings = this.settings) {
|
|
540
540
|
const base = resolveCodexPath(settings.codexPath, settings.allowNpx);
|
|
541
541
|
const args = [...base.args, "exec", "--experimental-json"];
|
|
542
542
|
if (settings.fullAuto) {
|
|
@@ -634,7 +634,7 @@ var CodexCliLanguageModel = class {
|
|
|
634
634
|
if (tempImagePaths.length > 0) {
|
|
635
635
|
args.push("--");
|
|
636
636
|
}
|
|
637
|
-
args.push(
|
|
637
|
+
args.push("-");
|
|
638
638
|
return {
|
|
639
639
|
cmd: base.cmd,
|
|
640
640
|
args,
|
|
@@ -996,7 +996,7 @@ var CodexCliLanguageModel = class {
|
|
|
996
996
|
});
|
|
997
997
|
const effectiveSettings = this.mergeSettings(providerOptions);
|
|
998
998
|
const responseFormat = options.responseFormat?.type === "json" ? { type: "json", schema: options.responseFormat.schema } : void 0;
|
|
999
|
-
const { cmd, args, env, cwd, lastMessagePath, lastMessageIsTemp, schemaPath, tempImagePaths } = this.buildArgs(
|
|
999
|
+
const { cmd, args, env, cwd, lastMessagePath, lastMessageIsTemp, schemaPath, tempImagePaths } = this.buildArgs(images, responseFormat, effectiveSettings);
|
|
1000
1000
|
this.logger.debug(
|
|
1001
1001
|
`[codex-cli] Executing Codex CLI: ${cmd} with ${args.length} arguments, cwd: ${cwd ?? "default"}`
|
|
1002
1002
|
);
|
|
@@ -1004,7 +1004,9 @@ var CodexCliLanguageModel = class {
|
|
|
1004
1004
|
let usage = createEmptyCodexUsage();
|
|
1005
1005
|
const finishReason = mapCodexCliFinishReason(void 0);
|
|
1006
1006
|
const startTime = Date.now();
|
|
1007
|
-
const child = spawn(cmd, args, { env, cwd, stdio: ["
|
|
1007
|
+
const child = spawn(cmd, args, { env, cwd, stdio: ["pipe", "pipe", "pipe"] });
|
|
1008
|
+
child.stdin.write(promptText);
|
|
1009
|
+
child.stdin.end();
|
|
1008
1010
|
let onAbort;
|
|
1009
1011
|
if (options.abortSignal) {
|
|
1010
1012
|
if (options.abortSignal.aborted) {
|
|
@@ -1162,14 +1164,16 @@ var CodexCliLanguageModel = class {
|
|
|
1162
1164
|
});
|
|
1163
1165
|
const effectiveSettings = this.mergeSettings(providerOptions);
|
|
1164
1166
|
const responseFormat = options.responseFormat?.type === "json" ? { type: "json", schema: options.responseFormat.schema } : void 0;
|
|
1165
|
-
const { cmd, args, env, cwd, lastMessagePath, lastMessageIsTemp, schemaPath, tempImagePaths } = this.buildArgs(
|
|
1167
|
+
const { cmd, args, env, cwd, lastMessagePath, lastMessageIsTemp, schemaPath, tempImagePaths } = this.buildArgs(images, responseFormat, effectiveSettings);
|
|
1166
1168
|
this.logger.debug(
|
|
1167
1169
|
`[codex-cli] Executing Codex CLI for streaming: ${cmd} with ${args.length} arguments`
|
|
1168
1170
|
);
|
|
1169
1171
|
const stream = new ReadableStream({
|
|
1170
1172
|
start: (controller) => {
|
|
1171
1173
|
const startTime = Date.now();
|
|
1172
|
-
const child = spawn(cmd, args, { env, cwd, stdio: ["
|
|
1174
|
+
const child = spawn(cmd, args, { env, cwd, stdio: ["pipe", "pipe", "pipe"] });
|
|
1175
|
+
child.stdin.write(promptText);
|
|
1176
|
+
child.stdin.end();
|
|
1173
1177
|
controller.enqueue({ type: "stream-start", warnings });
|
|
1174
1178
|
let stderr = "";
|
|
1175
1179
|
let accumulatedText = "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-sdk-provider-codex-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "AI SDK v6 provider for OpenAI Codex CLI (use ChatGPT Plus/Pro subscription)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-sdk",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"jsonc-parser": "^3.3.1"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
-
"@openai/codex": "^0.
|
|
67
|
+
"@openai/codex": "^0.87.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@eslint/js": "^9.14.0",
|