rentabots-sdk 1.7.42 → 1.8.0

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/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * 🦀 RENTABOTS MASTER CONTROLLER (v1.7.0)
4
+ * 🦀 RENTABOTS MASTER CONTROLLER (v1.8.0)
5
5
  * The all-in-one CLI for managing autonomous agents.
6
6
  * Cross-Platform Support: Windows, Linux, Mac
7
7
  *
@@ -351,7 +351,7 @@ async function main() {
351
351
 
352
352
  default:
353
353
  console.log(`
354
- 🦀 RENTABOTS MASTER CLI v1.7.0 (Universal)
354
+ 🦀 RENTABOTS MASTER CLI v1.8.0 (Universal)
355
355
  ------------------------------
356
356
  Usage:
357
357
  npx rentabots-sdk init - Interactive setup wizard
package/dist/index.d.ts CHANGED
@@ -63,7 +63,7 @@ export interface AutopilotOptions {
63
63
  bidTemplate?: string;
64
64
  }
65
65
  /**
66
- * 🦀 RENTABOTS MASTER SDK (v1.5.7)
66
+ * 🦀 RENTABOTS MASTER SDK (v1.8.0)
67
67
  * Robust, production-grade autonomous agent runtime.
68
68
  * UPDATES:
69
69
  * - Agent Isolation Protocol (Private workspaces).
package/dist/index.js CHANGED
@@ -71,14 +71,14 @@ exports.MessageSchema = zod_1.z.object({
71
71
  }).optional()
72
72
  });
73
73
  // --- CORE SDK ENGINE ---
74
- let SDK_VERSION = '1.7.42'; // fallback when package.json is unavailable
74
+ let SDK_VERSION = '1.8.0'; // 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;
78
78
  }
79
79
  catch (e) { }
80
80
  /**
81
- * 🦀 RENTABOTS MASTER SDK (v1.5.7)
81
+ * 🦀 RENTABOTS MASTER SDK (v1.8.0)
82
82
  * Robust, production-grade autonomous agent runtime.
83
83
  * UPDATES:
84
84
  * - Agent Isolation Protocol (Private workspaces).
package/init_templates.js CHANGED
@@ -195,7 +195,17 @@ async function main() {
195
195
  console.log("🎯 Mission Secured:", job.title);
196
196
  updateStatus(queen, "Mission Secured: " + job.title);
197
197
  await pushLog('SUCCESS', 'Mission secured: ' + job.title + ' (' + job.id + ')');
198
- await spawnMissionWorker(job, 'assignment');
198
+
199
+ // Create Revision Ledger
200
+ const localWorkDir = path.join(__dirname, 'workspace', job.id);
201
+ fs.mkdirSync(localWorkDir, { recursive: true });
202
+ const ledgerPath = path.join(localWorkDir, 'revision_ledger.md');
203
+ if (!fs.existsSync(ledgerPath)) {
204
+ fs.writeFileSync(ledgerPath, '# Revision Ledger\\nTracked human feedback and QA pivots for this mission.\\n');
205
+ }
206
+
207
+ // IMMEDIATE STARTUP: Start with PLAN phase.
208
+ await spawnMissionWorker(job, 'PLAN');
199
209
  });
200
210
 
201
211
  queen.on('message', async (msg) => {
@@ -219,35 +229,19 @@ async function main() {
219
229
  queen.workers.delete(msg.jobId);
220
230
  }
221
231
 
222
- const baselineFiles = await getRepoFileCount(msg.jobId);
223
232
  try {
233
+ const ledgerPath = path.join(__dirname, 'workspace', msg.jobId, 'revision_ledger.md');
234
+ const entry = \`\\n### Revision [\${new Date().toISOString()}]\\n**Human:** \${msg.content || ''}\\n\`;
235
+ fs.appendFileSync(ledgerPath, entry);
236
+
224
237
  const markerPath = path.join(__dirname, 'workspace', '_clarification_' + msg.jobId + '.json');
225
- fs.mkdirSync(path.dirname(markerPath), { recursive: true });
226
238
  fs.writeFileSync(markerPath, JSON.stringify({ at: Date.now(), content: msg.content || '' }));
227
239
  } catch (_) {}
228
240
 
229
241
  // Immediate human ack so chat never feels ignored
230
- await queen.sendMessage(msg.jobId, '🧠 Got it — applying your instruction now.');
231
-
232
- try {
233
- const replyPrompt = JSON.stringify([
234
- 'You are mission assistant. Reply briefly to the human and confirm what will be changed next.',
235
- 'Return only one short reply message text.',
236
- 'HUMAN MESSAGE: ' + (msg.content || ''),
237
- 'MISSION TITLE: ' + (job.title || ''),
238
- ].join('\\n'));
239
- for (const c of ['openclaw sessions spawn --task ' + replyPrompt, 'openclaw sessions_spawn --task ' + replyPrompt]) {
240
- const r = await queen.execute(msg.jobId, c, { timeout: 45000, shell: true });
241
- const out = (r.output || '').trim();
242
- if (r.exitCode === 0 && out && !/unknown command|usage: openclaw/i.test(out)) {
243
- await queen.sendMessage(msg.jobId, out.slice(-500));
244
- break;
245
- }
246
- if (!/unknown command/i.test(out)) break;
247
- }
248
- } catch (_) {}
242
+ await queen.sendMessage(msg.jobId, '🧠 Got it — updating my plan and applying your instruction now.');
249
243
 
250
- await spawnMissionWorker(job, 'human-followup', { watchAfterClarification: true, baselineFiles });
244
+ await spawnMissionWorker(job, 'BUILDER');
251
245
  });
252
246
 
253
247
  queen.startAutopilot({
@@ -275,27 +269,15 @@ const job = JSON.parse(fs.readFileSync(jobDataPath, 'utf8'));
275
269
 
276
270
  function inferContract(job) {
277
271
  const text = ((job.title || '') + ' ' + (job.description || '')).toLowerCase();
278
- const hasApiWord = /(^|[^a-z0-9])api([^a-z0-9]|$)/i.test(text) || /endpoint|rest\b|graphql\b/.test(text);
279
- 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';
280
- const contract = {
272
+ const adapter = text.includes('api') || text.includes('endpoint') ? 'api' :
273
+ text.includes('web') || text.includes('ui') || text.includes('landing page') ? 'web' :
274
+ text.includes('data') || text.includes('scraping') ? 'data' : 'task';
275
+
276
+ return {
281
277
  adapter,
282
278
  taskType: adapter,
283
- language: text.includes('python') ? 'python' : text.includes('javascript') || text.includes('node') ? 'javascript' : 'unspecified',
284
- requires: [],
285
- deliverables: ['README.md'],
286
- acceptance: []
279
+ deliverables: ['README.md', 'job_plan.md']
287
280
  };
288
-
289
- if (text.includes('csv')) contract.requires.push('csv');
290
- if (text.includes('blank') || text.includes('whitespace') || text.includes('trim')) contract.requires.push('trim');
291
- if (contract.language === 'python') contract.deliverables.push('solution.py');
292
- if (adapter === 'api') contract.deliverables.push('openapi-or-endpoint-docs.md');
293
- if (adapter === 'web') contract.deliverables.push('index.html');
294
- if (adapter === 'data') contract.deliverables.push('data_dictionary.md');
295
- if (adapter === 'docs') contract.deliverables.push('DOCUMENTATION.md');
296
- contract.acceptance.push('output reflects mission title and description');
297
- contract.acceptance.push('at least one non-template implementation file');
298
- return contract;
299
281
  }
300
282
 
301
283
  function generateAdapterFallbackFiles(workDir, job, contract) {
@@ -342,22 +324,24 @@ async function main() {
342
324
 
343
325
  await agent.connect();
344
326
 
345
- // Announce arrival in the mission channel
346
- await agent.sendMessage(job.id, "👷 Worker Unit [PID " + process.pid + "] deployed to workspace. Analyzing requirements...");
327
+ const ROLE = process.argv[3] || 'BUILDER';
328
+
329
+ // Announce arrival
330
+ await agent.sendMessage(job.id, "👷 Worker Unit [PID " + process.pid + "] deployed for " + ROLE + " phase.");
347
331
 
348
- const contract = inferContract(job);
349
332
  const workDir = path.join(agent.workspaceRoot, job.id);
350
333
  fs.mkdirSync(workDir, { recursive: true });
351
- fs.writeFileSync(path.join(workDir, 'ACCEPTANCE.json'), JSON.stringify(contract, null, 2));
352
- await agent.sendMessage(job.id, '📋 Contract parsed: ' + contract.taskType + ' / ' + contract.language + '. Deliverables: ' + contract.deliverables.join(', '));
353
-
354
- // Remove stale adapter artifacts from older retries/runs
355
- try { if (contract.adapter !== 'api') fs.unlinkSync(path.join(workDir, 'openapi-or-endpoint-docs.md')); } catch (_) {}
356
- try { if (contract.adapter !== 'data') fs.unlinkSync(path.join(workDir, 'data_dictionary.md')); } catch (_) {}
357
- try { if (contract.adapter !== 'docs') fs.unlinkSync(path.join(workDir, 'DOCUMENTATION.md')); } catch (_) {}
358
334
 
359
- // Construct the prompt for the autonomous brain
360
- const task = \`PROJECT: \${job.title}. BRIEF: \${job.description}. CONTRACT: \${JSON.stringify(contract)}. WORKDIR: \${workDir}. MANDATORY OUTPUT FILES: \${contract.deliverables.join(', ')}. INSTRUCTION: Work ONLY in WORKDIR. Create/modify the mandatory files there with real implementation (not placeholders), then include run/test notes in README.\`;
335
+ if (ROLE === 'PLAN') {
336
+ const prompt = "You are a Project Architect. Mission: " + job.title + ". " + job.description + ". Output a professional execution plan in job_plan.md. Be stack-agnostic.";
337
+ await agent.execute(job.id, 'openclaw sessions spawn --task ' + JSON.stringify(prompt));
338
+ } else if (ROLE === 'BUILDER') {
339
+ const task = "You are a Solution Engineer. Mission: " + job.title + ". WORKDIR: " + workDir + ". Use the job_plan.md and revision_ledger.md to build the project. Choose the best agnostic tech stack.";
340
+ await agent.execute(job.id, 'openclaw sessions spawn --task ' + JSON.stringify(task));
341
+ } else if (ROLE === 'QA') {
342
+ const qa = "You are an Auditor. Verify that the files in " + workDir + " satisfy the Mission: " + job.title + ". Output status: PASS or FAIL.";
343
+ await agent.execute(job.id, 'openclaw sessions spawn --task ' + JSON.stringify(qa));
344
+ }
361
345
 
362
346
  // --- 🦞 EXECUTE VIA OPENCLAW BRAIN ---
363
347
  const taskArg = JSON.stringify(task);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rentabots-sdk",
3
- "version": "1.7.42",
3
+ "version": "1.8.0",
4
4
  "description": "Official SDK for RentaBots AI Agent Marketplace",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",