@openagents-org/agent-launcher 0.2.101 → 0.2.103
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/package.json +1 -1
- package/src/adapters/codex.js +21 -5
package/package.json
CHANGED
package/src/adapters/codex.js
CHANGED
|
@@ -48,15 +48,31 @@ class CodexAdapter extends BaseAdapter {
|
|
|
48
48
|
);
|
|
49
49
|
this._loadSessions();
|
|
50
50
|
|
|
51
|
-
// Determine mode:
|
|
51
|
+
// Determine mode:
|
|
52
|
+
// - CLI mode: only works with OpenAI's native Responses API (api.openai.com)
|
|
53
|
+
// - Direct API mode: works with any OpenAI-compatible chat completions endpoint
|
|
52
54
|
this._codexBin = this._findCodexBinary();
|
|
53
55
|
this._directMode = false;
|
|
56
|
+
this._useCliMode = false;
|
|
54
57
|
|
|
55
|
-
if (
|
|
58
|
+
// Check if base URL is OpenAI's native API (CLI requires Responses API)
|
|
59
|
+
const isOpenAiNative = !this._directBaseUrl ||
|
|
60
|
+
this._directBaseUrl.includes('api.openai.com');
|
|
61
|
+
|
|
62
|
+
if (this._codexBin && isOpenAiNative) {
|
|
63
|
+
this._useCliMode = true;
|
|
56
64
|
this._log(`CLI mode: ${this._codexBin}`);
|
|
57
65
|
} else if (this._directApiKey && this._directBaseUrl) {
|
|
58
66
|
this._directMode = true;
|
|
59
|
-
|
|
67
|
+
if (this._codexBin) {
|
|
68
|
+
this._log(`Direct LLM mode (non-OpenAI endpoint, CLI requires Responses API): ${this._directBaseUrl} model=${this._directModel || 'gpt-4o'}`);
|
|
69
|
+
} else {
|
|
70
|
+
this._log(`Direct LLM mode: ${this._directBaseUrl} model=${this._directModel || 'gpt-4o'}`);
|
|
71
|
+
}
|
|
72
|
+
} else if (this._codexBin) {
|
|
73
|
+
// CLI binary found, no custom base URL — assume OpenAI
|
|
74
|
+
this._useCliMode = true;
|
|
75
|
+
this._log(`CLI mode: ${this._codexBin}`);
|
|
60
76
|
} else {
|
|
61
77
|
this._log('Warning: No codex CLI binary found and no direct API configured');
|
|
62
78
|
}
|
|
@@ -203,7 +219,7 @@ class CodexAdapter extends BaseAdapter {
|
|
|
203
219
|
await this._autoTitleChannel(msgChannel, content);
|
|
204
220
|
await this.sendStatus(msgChannel, 'thinking...');
|
|
205
221
|
|
|
206
|
-
if (this.
|
|
222
|
+
if (this._useCliMode) {
|
|
207
223
|
await this._handleViaSubprocess(content, msgChannel);
|
|
208
224
|
} else if (this._directMode) {
|
|
209
225
|
await this._handleViaDirectApi(content, msgChannel);
|
|
@@ -237,7 +253,7 @@ class CodexAdapter extends BaseAdapter {
|
|
|
237
253
|
cmd.push('resume', threadId);
|
|
238
254
|
}
|
|
239
255
|
|
|
240
|
-
cmd.push('--json', '--
|
|
256
|
+
cmd.push('--json', '--dangerously-bypass-approvals-and-sandbox', '--skip-git-repo-check');
|
|
241
257
|
|
|
242
258
|
// Model override
|
|
243
259
|
if (this._directModel) {
|