clawmoney 0.9.12 → 0.9.13
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 +21 -6
- package/package.json +1 -1
package/dist/hub/executor.js
CHANGED
|
@@ -195,16 +195,22 @@ export class Executor {
|
|
|
195
195
|
const dedupKey = `escrow:${task.id}`;
|
|
196
196
|
try {
|
|
197
197
|
// Build prompt for openclaw/claude
|
|
198
|
-
const
|
|
199
|
-
"You received a
|
|
198
|
+
const lines = [
|
|
199
|
+
"You received a paid task via ClawMoney Hub Marketplace.",
|
|
200
200
|
`Title: ${task.title}`,
|
|
201
201
|
`Category: ${task.category}`,
|
|
202
202
|
`Budget: $${task.budget} USDC`,
|
|
203
203
|
`Description: ${task.description}`,
|
|
204
204
|
task.requirements ? `Requirements: ${task.requirements}` : "",
|
|
205
205
|
"",
|
|
206
|
-
"Execute this task thoroughly.
|
|
207
|
-
]
|
|
206
|
+
"Execute this task thoroughly.",
|
|
207
|
+
];
|
|
208
|
+
// For code review tasks, instruct to create a GitHub Issue
|
|
209
|
+
if (task.category?.startsWith("coding/")) {
|
|
210
|
+
lines.push("", "If the task references a GitHub repo, create a GitHub Issue with your findings using `gh issue create`.", "Include the Issue URL in your JSON output as 'issue_url'.");
|
|
211
|
+
}
|
|
212
|
+
lines.push("", "Return the result as JSON with a 'result' field containing your work.");
|
|
213
|
+
const prompt = lines.filter(Boolean).join("\n");
|
|
208
214
|
const command = this.config.provider.cli_command;
|
|
209
215
|
logger.info(`Executing multi task via ${command} (timeout=300s)`);
|
|
210
216
|
const { stdout, stderr, exitCode } = await runCli(command, prompt, 300_000, task.id);
|
|
@@ -212,9 +218,10 @@ export class Executor {
|
|
|
212
218
|
logger.error(`Escrow CLI failed (code=${exitCode}): ${stderr.slice(0, 500)}`);
|
|
213
219
|
return;
|
|
214
220
|
}
|
|
215
|
-
// Extract text result
|
|
221
|
+
// Extract text result and optional URL
|
|
216
222
|
const parsed = parseJsonOutput(stdout);
|
|
217
223
|
let content;
|
|
224
|
+
let url = null;
|
|
218
225
|
if (command === "openclaw" && parsed) {
|
|
219
226
|
const ocResult = parseOpenClawResponse(parsed);
|
|
220
227
|
content = typeof ocResult.result.text === "string"
|
|
@@ -222,20 +229,28 @@ export class Executor {
|
|
|
222
229
|
: typeof ocResult.result.result === "string"
|
|
223
230
|
? ocResult.result.result
|
|
224
231
|
: JSON.stringify(ocResult.result, null, 2);
|
|
232
|
+
// Extract issue_url or pr_url from result
|
|
233
|
+
url = (ocResult.result.issue_url ?? ocResult.result.pr_url ?? null);
|
|
225
234
|
}
|
|
226
235
|
else {
|
|
227
236
|
content = parsed
|
|
228
237
|
? JSON.stringify(parsed, null, 2)
|
|
229
238
|
: stdout.trim().slice(0, 10000);
|
|
239
|
+
if (parsed) {
|
|
240
|
+
url = (parsed.issue_url ?? parsed.pr_url ?? null);
|
|
241
|
+
}
|
|
230
242
|
}
|
|
231
243
|
// Submit to marketplace
|
|
244
|
+
const body = { content };
|
|
245
|
+
if (url)
|
|
246
|
+
body.url = url;
|
|
232
247
|
const resp = await fetch(`${this.config.provider.api_base_url}/hub/escrow/${task.id}/submit`, {
|
|
233
248
|
method: "POST",
|
|
234
249
|
headers: {
|
|
235
250
|
Authorization: `Bearer ${this.config.api_key}`,
|
|
236
251
|
"Content-Type": "application/json",
|
|
237
252
|
},
|
|
238
|
-
body: JSON.stringify(
|
|
253
|
+
body: JSON.stringify(body),
|
|
239
254
|
});
|
|
240
255
|
if (resp.ok) {
|
|
241
256
|
logger.info(`Escrow ${task.id.slice(0, 8)} submitted successfully`);
|