rentabots-sdk 1.7.27 → 1.7.29

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 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.27'; // fallback when package.json is unavailable
74
+ let SDK_VERSION = '1.7.29'; // 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
@@ -148,6 +148,13 @@ async function main() {
148
148
  queen.workers.delete(job.id);
149
149
  try { fs.unlinkSync(jobDataPath); } catch {}
150
150
  await pushLog('WARN', 'Worker exited for mission ' + job.id + ' (code=' + code + ', signal=' + (signal || 'none') + ')');
151
+
152
+ if (code === 42 && queen.activeMissions.has(job.id) && !queen.workers.has(job.id)) {
153
+ await pushLog('INFO', 'Worker requested controlled restart for ' + job.id + '; respawning...');
154
+ setTimeout(() => {
155
+ spawnMissionWorker(job, 'controlled-restart').catch(() => {});
156
+ }, 1200);
157
+ }
151
158
  });
152
159
 
153
160
  worker.on('error', async (err) => {
@@ -245,7 +252,8 @@ const job = JSON.parse(fs.readFileSync(jobDataPath, 'utf8'));
245
252
 
246
253
  function inferContract(job) {
247
254
  const text = ((job.title || '') + ' ' + (job.description || '')).toLowerCase();
248
- const adapter = text.includes('api') ? 'api' : text.includes('csv') || text.includes('dataset') || text.includes('etl') ? 'data' : text.includes('landing page') || text.includes('frontend') || text.includes('ui') || text.includes('web') ? 'web' : text.includes('docs') || text.includes('documentation') ? 'docs' : 'script';
255
+ const hasApiWord = /(^|[^a-z0-9])api([^a-z0-9]|$)/i.test(text) || /endpoint|rest\b|graphql\b/.test(text);
256
+ const adapter = hasApiWord ? 'api' : text.includes('csv') || text.includes('dataset') || text.includes('etl') ? 'data' : text.includes('landing page') || text.includes('frontend') || text.includes('ui') || text.includes('web') ? 'web' : text.includes('docs') || text.includes('documentation') ? 'docs' : 'script';
249
257
  const contract = {
250
258
  adapter,
251
259
  taskType: adapter,
@@ -456,7 +464,13 @@ async function main() {
456
464
  issues.push('whitespace cleanup requirement not reflected in output');
457
465
  }
458
466
  for (const d of contract.deliverables || []) {
459
- if (!hasFile((f) => f.toLowerCase() === String(d).toLowerCase())) {
467
+ const dl = String(d).toLowerCase();
468
+ let ok = false;
469
+ if (dl === 'readme.md') ok = hasFile((f) => /^readme(\..+)?\.md$/i.test(f) || /^readme\.md$/i.test(f));
470
+ else if (dl === 'solution.py') ok = hasFile((f) => f.toLowerCase().endsWith('.py'));
471
+ else if (dl === 'openapi-or-endpoint-docs.md') ok = hasFile((f) => /openapi|endpoint|api.*doc/i.test(f));
472
+ else ok = hasFile((f) => f.toLowerCase() === dl);
473
+ if (!ok) {
460
474
  issues.push('missing contract deliverable: ' + d);
461
475
  }
462
476
  }
@@ -532,8 +546,8 @@ async function main() {
532
546
  if (r.exitCode === 0 && !pseudo) break;
533
547
  }
534
548
 
535
- await agent.sendMessage(job.id, '🔁 OpenClaw repair pass complete. Re-validating now.');
536
- return main();
549
+ await agent.sendMessage(job.id, '🔁 OpenClaw repair pass complete. Re-queueing worker validation pass now.');
550
+ process.exit(42);
537
551
  }
538
552
 
539
553
  if (fallbackGenerated) {
@@ -657,9 +671,9 @@ async function main() {
657
671
 
658
672
  if (fails <= 5) {
659
673
  await agent.setProgress(job.id, 25);
660
- await agent.sendMessage(job.id, '⚠️ OpenClaw run failed (attempt ' + fails + '). Auto-retrying with OpenClaw only...');
674
+ await agent.sendMessage(job.id, '⚠️ OpenClaw run failed (attempt ' + fails + '). Re-queueing OpenClaw-only retry...');
661
675
  await new Promise(r => setTimeout(r, 5000));
662
- return main();
676
+ process.exit(42);
663
677
  }
664
678
 
665
679
  // Fail-safe report only after OpenClaw retry budget exhausted
package/init_templates.js CHANGED
@@ -117,6 +117,13 @@ async function main() {
117
117
  queen.workers.delete(job.id);
118
118
  try { fs.unlinkSync(jobDataPath); } catch {}
119
119
  await pushLog('WARN', 'Worker exited for mission ' + job.id + ' (code=' + code + ', signal=' + (signal || 'none') + ')');
120
+
121
+ if (code === 42 && queen.activeMissions.has(job.id) && !queen.workers.has(job.id)) {
122
+ await pushLog('INFO', 'Worker requested controlled restart for ' + job.id + '; respawning...');
123
+ setTimeout(() => {
124
+ spawnMissionWorker(job, 'controlled-restart').catch(() => {});
125
+ }, 1200);
126
+ }
120
127
  });
121
128
 
122
129
  worker.on('error', async (err) => {
@@ -221,7 +228,8 @@ const job = JSON.parse(fs.readFileSync(jobDataPath, 'utf8'));
221
228
 
222
229
  function inferContract(job) {
223
230
  const text = ((job.title || '') + ' ' + (job.description || '')).toLowerCase();
224
- const adapter = text.includes('api') ? 'api' : text.includes('csv') || text.includes('dataset') || text.includes('etl') ? 'data' : text.includes('landing page') || text.includes('frontend') || text.includes('ui') || text.includes('web') ? 'web' : text.includes('docs') || text.includes('documentation') ? 'docs' : 'script';
231
+ const hasApiWord = /(^|[^a-z0-9])api([^a-z0-9]|$)/i.test(text) || /endpoint|rest\b|graphql\b/.test(text);
232
+ const adapter = hasApiWord ? 'api' : text.includes('csv') || text.includes('dataset') || text.includes('etl') ? 'data' : text.includes('landing page') || text.includes('frontend') || text.includes('ui') || text.includes('web') ? 'web' : text.includes('docs') || text.includes('documentation') ? 'docs' : 'script';
225
233
  const contract = {
226
234
  adapter,
227
235
  taskType: adapter,
@@ -441,7 +449,13 @@ async function main() {
441
449
  issues.push('whitespace cleanup requirement not reflected in output');
442
450
  }
443
451
  for (const d of contract.deliverables || []) {
444
- if (!hasFile((f) => f.toLowerCase() === String(d).toLowerCase())) {
452
+ const dl = String(d).toLowerCase();
453
+ let ok = false;
454
+ if (dl === 'readme.md') ok = hasFile((f) => /^readme(\..+)?\.md$/i.test(f) || /^readme\.md$/i.test(f));
455
+ else if (dl === 'solution.py') ok = hasFile((f) => f.toLowerCase().endsWith('.py'));
456
+ else if (dl === 'openapi-or-endpoint-docs.md') ok = hasFile((f) => /openapi|endpoint|api.*doc/i.test(f));
457
+ else ok = hasFile((f) => f.toLowerCase() === dl);
458
+ if (!ok) {
445
459
  issues.push('missing contract deliverable: ' + d);
446
460
  }
447
461
  }
@@ -517,8 +531,8 @@ async function main() {
517
531
  if (r.exitCode === 0 && !pseudo) break;
518
532
  }
519
533
 
520
- await agent.sendMessage(job.id, '🔁 OpenClaw repair pass complete. Re-validating now.');
521
- return main();
534
+ await agent.sendMessage(job.id, '🔁 OpenClaw repair pass complete. Re-queueing worker validation pass now.');
535
+ process.exit(42);
522
536
  }
523
537
 
524
538
  if (fallbackGenerated) {
@@ -642,9 +656,9 @@ async function main() {
642
656
 
643
657
  if (fails <= 5) {
644
658
  await agent.setProgress(job.id, 25);
645
- await agent.sendMessage(job.id, '⚠️ OpenClaw run failed (attempt ' + fails + '). Auto-retrying with OpenClaw only...');
659
+ await agent.sendMessage(job.id, '⚠️ OpenClaw run failed (attempt ' + fails + '). Re-queueing OpenClaw-only retry...');
646
660
  await new Promise(r => setTimeout(r, 5000));
647
- return main();
661
+ process.exit(42);
648
662
  }
649
663
 
650
664
  // Fail-safe report only after OpenClaw retry budget exhausted
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rentabots-sdk",
3
- "version": "1.7.27",
3
+ "version": "1.7.29",
4
4
  "description": "Official SDK for RentaBots AI Agent Marketplace",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",