clawmoney 0.10.8 → 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.
@@ -34,9 +34,16 @@ function runCli(command, prompt, timeoutMs, orderId) {
34
34
  let args;
35
35
  if (command === "openclaw") {
36
36
  // openclaw agent --message "..." --session-id <order_id> --json
37
- // Route through Gateway (not --local) so skills like nano-banana-pro are available
38
37
  args = ["agent", "--message", prompt, "--session-id", orderId || "hub-task", "--json"];
39
38
  }
39
+ else if (command === "codex") {
40
+ // codex exec "..." --json
41
+ args = ["exec", prompt, "--json"];
42
+ }
43
+ else if (command === "gemini") {
44
+ // gemini -p "..." -o json --yolo
45
+ args = ["-p", prompt, "-o", "json", "--yolo"];
46
+ }
40
47
  else {
41
48
  // claude -p "..." --output-format json --dangerously-skip-permissions
42
49
  args = ["-p", prompt, "--output-format", "json", "--dangerously-skip-permissions"];
@@ -82,6 +89,42 @@ function parseJsonOutput(raw) {
82
89
  }
83
90
  return null;
84
91
  }
92
+ // ── Codex JSONL parser ──
93
+ function parseCodexOutput(raw) {
94
+ // Codex --json outputs JSONL. Extract text from item.completed events.
95
+ const texts = [];
96
+ for (const line of raw.split("\n")) {
97
+ if (!line.trim())
98
+ continue;
99
+ try {
100
+ const event = JSON.parse(line);
101
+ if (event.type === "item.completed") {
102
+ const item = event.item;
103
+ if (item?.text && typeof item.text === "string") {
104
+ texts.push(item.text);
105
+ }
106
+ }
107
+ }
108
+ catch {
109
+ // skip non-JSON lines
110
+ }
111
+ }
112
+ return texts.join("\n");
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
+ }
85
128
  function parseOpenClawResponse(raw) {
86
129
  const files = [];
87
130
  let result = raw;
@@ -238,6 +281,28 @@ export class Executor {
238
281
  url = (ocResult.result.issue_url ?? ocResult.result.pr_url ?? null);
239
282
  localFiles.push(...ocResult.files);
240
283
  }
284
+ else if (command === "codex") {
285
+ // Parse Codex JSONL output
286
+ const codexText = parseCodexOutput(stdout);
287
+ const codexParsed = parseJsonOutput(codexText);
288
+ content = codexParsed
289
+ ? JSON.stringify(codexParsed, null, 2)
290
+ : codexText.slice(0, 10000);
291
+ if (codexParsed) {
292
+ url = (codexParsed.issue_url ?? codexParsed.pr_url ?? null);
293
+ }
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
+ }
241
306
  else {
242
307
  content = parsed
243
308
  ? JSON.stringify(parsed, null, 2)
@@ -412,6 +477,20 @@ export class Executor {
412
477
  output._meta = ocResult.meta;
413
478
  }
414
479
  }
480
+ else if (command === "codex") {
481
+ // Parse Codex JSONL output
482
+ const codexText = parseCodexOutput(stdout);
483
+ const codexParsed = parseJsonOutput(codexText);
484
+ output = codexParsed ?? { result: codexText.slice(0, 5000) };
485
+ output = await replaceLocalPaths(output, this.config);
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
+ }
415
494
  else {
416
495
  output = parsed ?? { result: stdout.trim().slice(0, 5000) };
417
496
  // Upload local files via generic path replacement
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawmoney",
3
- "version": "0.10.8",
3
+ "version": "0.10.10",
4
4
  "description": "ClawMoney CLI -- Earn rewards with your AI agent",
5
5
  "type": "module",
6
6
  "bin": {