rentabots-sdk 1.7.36 → 1.7.37
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/index.js +1 -1
- package/init.js +25 -3
- package/init_templates.js +25 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -71,7 +71,7 @@ exports.MessageSchema = zod_1.z.object({
|
|
|
71
71
|
})
|
|
72
72
|
});
|
|
73
73
|
// --- CORE SDK ENGINE ---
|
|
74
|
-
let SDK_VERSION = '1.7.
|
|
74
|
+
let SDK_VERSION = '1.7.37'; // fallback when package.json is unavailable
|
|
75
75
|
try {
|
|
76
76
|
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'));
|
|
77
77
|
SDK_VERSION = pkg.version;
|
package/init.js
CHANGED
|
@@ -353,6 +353,22 @@ async function main() {
|
|
|
353
353
|
'openclaw sessions_spawn --task ' + taskArg,
|
|
354
354
|
];
|
|
355
355
|
|
|
356
|
+
const countMeaningfulFiles = () => {
|
|
357
|
+
const skip = new Set(['ACCEPTANCE.json', 'DELIVERY_SUMMARY.md', 'FAILSAFE_REPORT.md']);
|
|
358
|
+
const files = [];
|
|
359
|
+
const walk = (dir) => {
|
|
360
|
+
if (!fs.existsSync(dir)) return;
|
|
361
|
+
for (const item of fs.readdirSync(dir)) {
|
|
362
|
+
if (item === 'node_modules' || item === '.git' || item.startsWith('.') || skip.has(item)) continue;
|
|
363
|
+
const full = path.join(dir, item);
|
|
364
|
+
if (fs.statSync(full).isDirectory()) walk(full);
|
|
365
|
+
else files.push(full);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
walk(workDir);
|
|
369
|
+
return files.length;
|
|
370
|
+
};
|
|
371
|
+
|
|
356
372
|
let beat = 0;
|
|
357
373
|
const heartbeat = setInterval(async () => {
|
|
358
374
|
try {
|
|
@@ -377,6 +393,7 @@ async function main() {
|
|
|
377
393
|
let output = '';
|
|
378
394
|
|
|
379
395
|
for (let attempt = 1; attempt <= 3; attempt++) {
|
|
396
|
+
const beforeCount = countMeaningfulFiles();
|
|
380
397
|
const result = await agent.execute(job.id, cmd, { timeout: 1200000, shell: true }); // 20m
|
|
381
398
|
exitCode = result.exitCode;
|
|
382
399
|
output = result.output || '';
|
|
@@ -385,9 +402,14 @@ async function main() {
|
|
|
385
402
|
const low = (output || '').toLowerCase();
|
|
386
403
|
const pseudoSuccess = low.includes('usage: openclaw') || low.includes('pass --to') || low.includes('unknown command');
|
|
387
404
|
if (!pseudoSuccess) {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
405
|
+
await new Promise(r => setTimeout(r, 1200));
|
|
406
|
+
const afterCount = countMeaningfulFiles();
|
|
407
|
+
if (afterCount > beforeCount) {
|
|
408
|
+
overallSuccess = true;
|
|
409
|
+
lastOutput = output;
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
await agent.sendMessage(job.id, '⚠️ OpenClaw returned but no new implementation files were created. Forcing file-creation repair pass.');
|
|
391
413
|
}
|
|
392
414
|
}
|
|
393
415
|
|
package/init_templates.js
CHANGED
|
@@ -337,6 +337,22 @@ async function main() {
|
|
|
337
337
|
'openclaw sessions_spawn --task ' + taskArg,
|
|
338
338
|
];
|
|
339
339
|
|
|
340
|
+
const countMeaningfulFiles = () => {
|
|
341
|
+
const skip = new Set(['ACCEPTANCE.json', 'DELIVERY_SUMMARY.md', 'FAILSAFE_REPORT.md']);
|
|
342
|
+
const files = [];
|
|
343
|
+
const walk = (dir) => {
|
|
344
|
+
if (!fs.existsSync(dir)) return;
|
|
345
|
+
for (const item of fs.readdirSync(dir)) {
|
|
346
|
+
if (item === 'node_modules' || item === '.git' || item.startsWith('.') || skip.has(item)) continue;
|
|
347
|
+
const full = path.join(dir, item);
|
|
348
|
+
if (fs.statSync(full).isDirectory()) walk(full);
|
|
349
|
+
else files.push(full);
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
walk(workDir);
|
|
353
|
+
return files.length;
|
|
354
|
+
};
|
|
355
|
+
|
|
340
356
|
let beat = 0;
|
|
341
357
|
const heartbeat = setInterval(async () => {
|
|
342
358
|
try {
|
|
@@ -361,6 +377,7 @@ async function main() {
|
|
|
361
377
|
let output = '';
|
|
362
378
|
|
|
363
379
|
for (let attempt = 1; attempt <= 3; attempt++) {
|
|
380
|
+
const beforeCount = countMeaningfulFiles();
|
|
364
381
|
const result = await agent.execute(job.id, cmd, { timeout: 1200000, shell: true }); // 20m
|
|
365
382
|
exitCode = result.exitCode;
|
|
366
383
|
output = result.output || '';
|
|
@@ -369,9 +386,14 @@ async function main() {
|
|
|
369
386
|
const low = (output || '').toLowerCase();
|
|
370
387
|
const pseudoSuccess = low.includes('usage: openclaw') || low.includes('pass --to') || low.includes('unknown command');
|
|
371
388
|
if (!pseudoSuccess) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
389
|
+
await new Promise(r => setTimeout(r, 1200));
|
|
390
|
+
const afterCount = countMeaningfulFiles();
|
|
391
|
+
if (afterCount > beforeCount) {
|
|
392
|
+
overallSuccess = true;
|
|
393
|
+
lastOutput = output;
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
await agent.sendMessage(job.id, '⚠️ OpenClaw returned but no new implementation files were created. Forcing file-creation repair pass.');
|
|
375
397
|
}
|
|
376
398
|
}
|
|
377
399
|
|