@openagents-org/agent-launcher 0.2.99 → 0.2.100
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 +25 -1
package/package.json
CHANGED
package/src/adapters/codex.js
CHANGED
|
@@ -135,7 +135,9 @@ class CodexAdapter extends BaseAdapter {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
let fullText = '';
|
|
138
|
+
let toolCallText = '';
|
|
138
139
|
let buffer = '';
|
|
140
|
+
let chunkCount = 0;
|
|
139
141
|
res.on('data', (chunk) => {
|
|
140
142
|
buffer += chunk.toString('utf-8');
|
|
141
143
|
const lines = buffer.split('\n');
|
|
@@ -151,11 +153,33 @@ class CodexAdapter extends BaseAdapter {
|
|
|
151
153
|
if (choices.length > 0) {
|
|
152
154
|
const delta = choices[0].delta || {};
|
|
153
155
|
if (delta.content) fullText += delta.content;
|
|
156
|
+
// Capture tool call arguments as fallback text
|
|
157
|
+
if (delta.tool_calls) {
|
|
158
|
+
for (const tc of delta.tool_calls) {
|
|
159
|
+
if (tc.function && tc.function.arguments) {
|
|
160
|
+
toolCallText += tc.function.arguments;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
154
164
|
}
|
|
165
|
+
chunkCount++;
|
|
155
166
|
} catch {}
|
|
156
167
|
}
|
|
157
168
|
});
|
|
158
|
-
res.on('end', () =>
|
|
169
|
+
res.on('end', () => {
|
|
170
|
+
this._log(`API response: ${chunkCount} chunks, content=${fullText.length}chars, toolCalls=${toolCallText.length}chars`);
|
|
171
|
+
// If model tried tool calls instead of text, extract the message
|
|
172
|
+
if (!fullText && toolCallText) {
|
|
173
|
+
try {
|
|
174
|
+
const args = JSON.parse(toolCallText);
|
|
175
|
+
fullText = args.command || args.input || args.content || args.text || toolCallText;
|
|
176
|
+
} catch {
|
|
177
|
+
fullText = toolCallText;
|
|
178
|
+
}
|
|
179
|
+
this._log(`Extracted from tool_calls: ${fullText.slice(0, 100)}`);
|
|
180
|
+
}
|
|
181
|
+
resolve(fullText.trim());
|
|
182
|
+
});
|
|
159
183
|
});
|
|
160
184
|
|
|
161
185
|
req.on('error', reject);
|