clawmoney 0.10.9 → 0.10.10
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/hub/executor.js +32 -0
- package/package.json +1 -1
package/dist/hub/executor.js
CHANGED
|
@@ -111,6 +111,20 @@ function parseCodexOutput(raw) {
|
|
|
111
111
|
}
|
|
112
112
|
return texts.join("\n");
|
|
113
113
|
}
|
|
114
|
+
// ── Gemini JSON parser ──
|
|
115
|
+
function parseGeminiOutput(raw) {
|
|
116
|
+
// Gemini -o json wraps result in { session_id, response, stats }
|
|
117
|
+
try {
|
|
118
|
+
const obj = JSON.parse(raw);
|
|
119
|
+
if (typeof obj.response === "string") {
|
|
120
|
+
return obj.response;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
// not a single JSON object — return raw
|
|
125
|
+
}
|
|
126
|
+
return raw;
|
|
127
|
+
}
|
|
114
128
|
function parseOpenClawResponse(raw) {
|
|
115
129
|
const files = [];
|
|
116
130
|
let result = raw;
|
|
@@ -278,6 +292,17 @@ export class Executor {
|
|
|
278
292
|
url = (codexParsed.issue_url ?? codexParsed.pr_url ?? null);
|
|
279
293
|
}
|
|
280
294
|
}
|
|
295
|
+
else if (command === "gemini") {
|
|
296
|
+
// Parse Gemini JSON wrapper
|
|
297
|
+
const geminiText = parseGeminiOutput(stdout);
|
|
298
|
+
const geminiParsed = parseJsonOutput(geminiText);
|
|
299
|
+
content = geminiParsed
|
|
300
|
+
? JSON.stringify(geminiParsed, null, 2)
|
|
301
|
+
: geminiText.slice(0, 10000);
|
|
302
|
+
if (geminiParsed) {
|
|
303
|
+
url = (geminiParsed.issue_url ?? geminiParsed.pr_url ?? null);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
281
306
|
else {
|
|
282
307
|
content = parsed
|
|
283
308
|
? JSON.stringify(parsed, null, 2)
|
|
@@ -459,6 +484,13 @@ export class Executor {
|
|
|
459
484
|
output = codexParsed ?? { result: codexText.slice(0, 5000) };
|
|
460
485
|
output = await replaceLocalPaths(output, this.config);
|
|
461
486
|
}
|
|
487
|
+
else if (command === "gemini") {
|
|
488
|
+
// Parse Gemini JSON wrapper: { session_id, response, stats }
|
|
489
|
+
const geminiText = parseGeminiOutput(stdout);
|
|
490
|
+
const geminiParsed = parseJsonOutput(geminiText);
|
|
491
|
+
output = geminiParsed ?? { result: geminiText.slice(0, 5000) };
|
|
492
|
+
output = await replaceLocalPaths(output, this.config);
|
|
493
|
+
}
|
|
462
494
|
else {
|
|
463
495
|
output = parsed ?? { result: stdout.trim().slice(0, 5000) };
|
|
464
496
|
// Upload local files via generic path replacement
|