rentabots-sdk 1.7.34 → 1.7.36
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 +23 -6
- package/init_templates.js +23 -6
- 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.36'; // 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
|
@@ -234,7 +234,21 @@ async function main() {
|
|
|
234
234
|
fs.writeFileSync(markerPath, JSON.stringify({ at: Date.now(), content: msg.content || '' }));
|
|
235
235
|
} catch (_) {}
|
|
236
236
|
|
|
237
|
-
|
|
237
|
+
const replyPrompt = JSON.stringify([
|
|
238
|
+
'You are mission assistant. Reply briefly to the human and confirm implementation has started.',
|
|
239
|
+
'Return only the reply message text.',
|
|
240
|
+
'HUMAN MESSAGE: ' + (msg.content || ''),
|
|
241
|
+
'MISSION TITLE: ' + (job.title || ''),
|
|
242
|
+
].join('\n'));
|
|
243
|
+
let autoReply = '🧠 Got it. I am applying your instruction now and will deliver updated output shortly.';
|
|
244
|
+
for (const c of ['openclaw sessions spawn --task ' + replyPrompt, 'openclaw sessions_spawn --task ' + replyPrompt]) {
|
|
245
|
+
const r = await queen.execute(msg.jobId, c, { timeout: 120000, shell: true });
|
|
246
|
+
const out = (r.output || '').trim();
|
|
247
|
+
if (r.exitCode === 0 && out && !/unknown command|usage: openclaw/i.test(out)) { autoReply = out.slice(-500); break; }
|
|
248
|
+
if (!/unknown command/i.test(out)) break;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
await queen.sendMessage(msg.jobId, autoReply);
|
|
238
252
|
await spawnMissionWorker(job, 'human-followup', { watchAfterClarification: true, baselineFiles });
|
|
239
253
|
});
|
|
240
254
|
|
|
@@ -257,7 +271,7 @@ const job = JSON.parse(fs.readFileSync(jobDataPath, 'utf8'));
|
|
|
257
271
|
function inferContract(job) {
|
|
258
272
|
const text = ((job.title || '') + ' ' + (job.description || '')).toLowerCase();
|
|
259
273
|
const hasApiWord = /(^|[^a-z0-9])api([^a-z0-9]|$)/i.test(text) || /endpoint|rest\b|graphql\b/.test(text);
|
|
260
|
-
const adapter = hasApiWord ? 'api' : text.includes('
|
|
274
|
+
const adapter = hasApiWord ? 'api' : text.includes('dataset') || text.includes('etl') || text.includes('data pipeline') || text.includes('data analysis') ? 'data' : text.includes('landing page') || text.includes('frontend') || text.includes('ui') || text.includes('web') ? 'web' : text.includes('docs') || text.includes('documentation') ? 'docs' : 'script';
|
|
261
275
|
const contract = {
|
|
262
276
|
adapter,
|
|
263
277
|
taskType: adapter,
|
|
@@ -511,7 +525,7 @@ async function main() {
|
|
|
511
525
|
} else if (contract.adapter === 'docs') {
|
|
512
526
|
const hasDocFile = hasFile((f) => f.toLowerCase().endsWith('.md'));
|
|
513
527
|
const hasSections = /(##\s+overview|##\s+setup|##\s+usage|table of contents|getting started)/i.test(combinedText);
|
|
514
|
-
const hasExamples = /(example|sample|command|curl|code block
|
|
528
|
+
const hasExamples = /(example|sample|command|curl|code block)/i.test(combinedText);
|
|
515
529
|
if (!hasDocFile) issues.push('docs adapter: missing markdown documentation');
|
|
516
530
|
if (!hasSections) issues.push('docs adapter: missing core documentation sections');
|
|
517
531
|
if (!hasExamples) issues.push('docs adapter: missing usage examples');
|
|
@@ -536,8 +550,9 @@ async function main() {
|
|
|
536
550
|
fs.writeFileSync(repairPath, String(repairCount));
|
|
537
551
|
|
|
538
552
|
if (repairCount > 6) {
|
|
539
|
-
await agent.sendMessage(job.id, '
|
|
540
|
-
|
|
553
|
+
await agent.sendMessage(job.id, '🔁 OpenClaw repair limit exceeded; continuing autonomous deep-repair cycle.');
|
|
554
|
+
repairCount = 3;
|
|
555
|
+
fs.writeFileSync(repairPath, String(repairCount));
|
|
541
556
|
}
|
|
542
557
|
|
|
543
558
|
const repairPrompt = [
|
|
@@ -705,7 +720,9 @@ async function main() {
|
|
|
705
720
|
|
|
706
721
|
// Fail-safe report only after OpenClaw retry budget exhausted
|
|
707
722
|
await agent.setProgress(job.id, 25);
|
|
708
|
-
await agent.sendMessage(job.id, "
|
|
723
|
+
await agent.sendMessage(job.id, "🔁 OpenClaw execution still failing after retries. Continuing autonomous retries with adjusted strategy.");
|
|
724
|
+
await new Promise(r => setTimeout(r, 8000));
|
|
725
|
+
process.exit(42);
|
|
709
726
|
|
|
710
727
|
try {
|
|
711
728
|
const repoRes = await agent.getRepo(job.id);
|
package/init_templates.js
CHANGED
|
@@ -203,7 +203,21 @@ async function main() {
|
|
|
203
203
|
fs.writeFileSync(markerPath, JSON.stringify({ at: Date.now(), content: msg.content || '' }));
|
|
204
204
|
} catch (_) {}
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
const replyPrompt = JSON.stringify([
|
|
207
|
+
'You are mission assistant. Reply briefly to the human and confirm implementation has started.',
|
|
208
|
+
'Return only the reply message text.',
|
|
209
|
+
'HUMAN MESSAGE: ' + (msg.content || ''),
|
|
210
|
+
'MISSION TITLE: ' + (job.title || ''),
|
|
211
|
+
].join('\n'));
|
|
212
|
+
let autoReply = '🧠 Got it. I am applying your instruction now and will deliver updated output shortly.';
|
|
213
|
+
for (const c of ['openclaw sessions spawn --task ' + replyPrompt, 'openclaw sessions_spawn --task ' + replyPrompt]) {
|
|
214
|
+
const r = await queen.execute(msg.jobId, c, { timeout: 120000, shell: true });
|
|
215
|
+
const out = (r.output || '').trim();
|
|
216
|
+
if (r.exitCode === 0 && out && !/unknown command|usage: openclaw/i.test(out)) { autoReply = out.slice(-500); break; }
|
|
217
|
+
if (!/unknown command/i.test(out)) break;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
await queen.sendMessage(msg.jobId, autoReply);
|
|
207
221
|
await spawnMissionWorker(job, 'human-followup', { watchAfterClarification: true, baselineFiles });
|
|
208
222
|
});
|
|
209
223
|
|
|
@@ -233,7 +247,7 @@ const job = JSON.parse(fs.readFileSync(jobDataPath, 'utf8'));
|
|
|
233
247
|
function inferContract(job) {
|
|
234
248
|
const text = ((job.title || '') + ' ' + (job.description || '')).toLowerCase();
|
|
235
249
|
const hasApiWord = /(^|[^a-z0-9])api([^a-z0-9]|$)/i.test(text) || /endpoint|rest\b|graphql\b/.test(text);
|
|
236
|
-
const adapter = hasApiWord ? 'api' : text.includes('
|
|
250
|
+
const adapter = hasApiWord ? 'api' : text.includes('dataset') || text.includes('etl') || text.includes('data pipeline') || text.includes('data analysis') ? 'data' : text.includes('landing page') || text.includes('frontend') || text.includes('ui') || text.includes('web') ? 'web' : text.includes('docs') || text.includes('documentation') ? 'docs' : 'script';
|
|
237
251
|
const contract = {
|
|
238
252
|
adapter,
|
|
239
253
|
taskType: adapter,
|
|
@@ -496,7 +510,7 @@ async function main() {
|
|
|
496
510
|
} else if (contract.adapter === 'docs') {
|
|
497
511
|
const hasDocFile = hasFile((f) => f.toLowerCase().endsWith('.md'));
|
|
498
512
|
const hasSections = /(##\s+overview|##\s+setup|##\s+usage|table of contents|getting started)/i.test(combinedText);
|
|
499
|
-
const hasExamples = /(example|sample|command|curl|code block
|
|
513
|
+
const hasExamples = /(example|sample|command|curl|code block)/i.test(combinedText);
|
|
500
514
|
if (!hasDocFile) issues.push('docs adapter: missing markdown documentation');
|
|
501
515
|
if (!hasSections) issues.push('docs adapter: missing core documentation sections');
|
|
502
516
|
if (!hasExamples) issues.push('docs adapter: missing usage examples');
|
|
@@ -521,8 +535,9 @@ async function main() {
|
|
|
521
535
|
fs.writeFileSync(repairPath, String(repairCount));
|
|
522
536
|
|
|
523
537
|
if (repairCount > 6) {
|
|
524
|
-
await agent.sendMessage(job.id, '
|
|
525
|
-
|
|
538
|
+
await agent.sendMessage(job.id, '🔁 OpenClaw repair limit exceeded; continuing autonomous deep-repair cycle.');
|
|
539
|
+
repairCount = 3;
|
|
540
|
+
fs.writeFileSync(repairPath, String(repairCount));
|
|
526
541
|
}
|
|
527
542
|
|
|
528
543
|
const repairPrompt = [
|
|
@@ -690,7 +705,9 @@ async function main() {
|
|
|
690
705
|
|
|
691
706
|
// Fail-safe report only after OpenClaw retry budget exhausted
|
|
692
707
|
await agent.setProgress(job.id, 25);
|
|
693
|
-
await agent.sendMessage(job.id, "
|
|
708
|
+
await agent.sendMessage(job.id, "🔁 OpenClaw execution still failing after retries. Continuing autonomous retries with adjusted strategy.");
|
|
709
|
+
await new Promise(r => setTimeout(r, 8000));
|
|
710
|
+
process.exit(42);
|
|
694
711
|
|
|
695
712
|
try {
|
|
696
713
|
const repoRes = await agent.getRepo(job.id);
|