rentabots-sdk 1.7.13 → 1.7.14
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 +49 -1
- package/init_templates.js +49 -1
- 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.14'; // 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
|
@@ -242,8 +242,56 @@ async function main() {
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
if (overallSuccess) {
|
|
245
|
+
// Verify actual deliverables exist before claiming success
|
|
246
|
+
const workDir = path.join(agent.workspaceRoot, job.id);
|
|
247
|
+
const files = [];
|
|
248
|
+
const walk = (dir, rel = '') => {
|
|
249
|
+
if (!fs.existsSync(dir)) return;
|
|
250
|
+
for (const item of fs.readdirSync(dir)) {
|
|
251
|
+
if (item === 'node_modules' || item === '.git') continue;
|
|
252
|
+
const full = path.join(dir, item);
|
|
253
|
+
const relPath = rel ? path.join(rel, item) : item;
|
|
254
|
+
if (fs.statSync(full).isDirectory()) walk(full, relPath);
|
|
255
|
+
else files.push(relPath);
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
walk(workDir);
|
|
259
|
+
|
|
260
|
+
if (files.length === 0) {
|
|
261
|
+
await agent.setProgress(job.id, 40);
|
|
262
|
+
await agent.sendMessage(job.id, "⚠️ I did not generate deliverable files yet. Please clarify expected output (files/format), and I will continue.");
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const repoRes = await agent.getRepo(job.id);
|
|
267
|
+
const repo = (!repoRes.success || !repoRes.exists)
|
|
268
|
+
? (await agent.createRepo(job.id, 'mission-' + job.id.slice(0, 8))).repo
|
|
269
|
+
: repoRes.repo;
|
|
270
|
+
|
|
271
|
+
let uploaded = 0;
|
|
272
|
+
for (const rel of files) {
|
|
273
|
+
try {
|
|
274
|
+
const full = path.join(workDir, rel);
|
|
275
|
+
const buf = fs.readFileSync(full);
|
|
276
|
+
const isBlob = !['.js','.ts','.tsx','.jsx','.json','.md','.txt','.py','.yml','.yaml','.html','.css','.csv'].includes(path.extname(rel).toLowerCase());
|
|
277
|
+
const content = isBlob ? buf : buf.toString('utf8');
|
|
278
|
+
const up = await agent.uploadRepoFile(job.id, rel, content, isBlob);
|
|
279
|
+
if (up.success) uploaded += 1;
|
|
280
|
+
} catch (_) {}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
if (uploaded === 0) {
|
|
284
|
+
await agent.setProgress(job.id, 50);
|
|
285
|
+
await agent.sendMessage(job.id, "⚠️ I produced files locally but failed to upload them to mission repository. Please retry or send guidance.");
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
|
|
245
289
|
await agent.setProgress(job.id, 100);
|
|
246
|
-
|
|
290
|
+
if (repo?.id) {
|
|
291
|
+
await agent.sendMessage(job.id, "✅ Execution complete. Deliverables uploaded: " + uploaded + " files. Repo: https://rentabots.com/repos/" + repo.id);
|
|
292
|
+
} else {
|
|
293
|
+
await agent.sendMessage(job.id, "✅ Execution complete. Deliverables uploaded: " + uploaded + " files to mission repository.");
|
|
294
|
+
}
|
|
247
295
|
if (process.send) process.send({ event: 'phase_complete', phase: 'BUILDER' });
|
|
248
296
|
} else {
|
|
249
297
|
const snippet = lastOutput.slice(-500) || 'No output captured';
|
package/init_templates.js
CHANGED
|
@@ -226,8 +226,56 @@ async function main() {
|
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
if (overallSuccess) {
|
|
229
|
+
// Verify actual deliverables exist before claiming success
|
|
230
|
+
const workDir = path.join(agent.workspaceRoot, job.id);
|
|
231
|
+
const files = [];
|
|
232
|
+
const walk = (dir, rel = '') => {
|
|
233
|
+
if (!fs.existsSync(dir)) return;
|
|
234
|
+
for (const item of fs.readdirSync(dir)) {
|
|
235
|
+
if (item === 'node_modules' || item === '.git') continue;
|
|
236
|
+
const full = path.join(dir, item);
|
|
237
|
+
const relPath = rel ? path.join(rel, item) : item;
|
|
238
|
+
if (fs.statSync(full).isDirectory()) walk(full, relPath);
|
|
239
|
+
else files.push(relPath);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
walk(workDir);
|
|
243
|
+
|
|
244
|
+
if (files.length === 0) {
|
|
245
|
+
await agent.setProgress(job.id, 40);
|
|
246
|
+
await agent.sendMessage(job.id, "⚠️ I did not generate deliverable files yet. Please clarify expected output (files/format), and I will continue.");
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const repoRes = await agent.getRepo(job.id);
|
|
251
|
+
const repo = (!repoRes.success || !repoRes.exists)
|
|
252
|
+
? (await agent.createRepo(job.id, 'mission-' + job.id.slice(0, 8))).repo
|
|
253
|
+
: repoRes.repo;
|
|
254
|
+
|
|
255
|
+
let uploaded = 0;
|
|
256
|
+
for (const rel of files) {
|
|
257
|
+
try {
|
|
258
|
+
const full = path.join(workDir, rel);
|
|
259
|
+
const buf = fs.readFileSync(full);
|
|
260
|
+
const isBlob = !['.js','.ts','.tsx','.jsx','.json','.md','.txt','.py','.yml','.yaml','.html','.css','.csv'].includes(path.extname(rel).toLowerCase());
|
|
261
|
+
const content = isBlob ? buf : buf.toString('utf8');
|
|
262
|
+
const up = await agent.uploadRepoFile(job.id, rel, content, isBlob);
|
|
263
|
+
if (up.success) uploaded += 1;
|
|
264
|
+
} catch (_) {}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (uploaded === 0) {
|
|
268
|
+
await agent.setProgress(job.id, 50);
|
|
269
|
+
await agent.sendMessage(job.id, "⚠️ I produced files locally but failed to upload them to mission repository. Please retry or send guidance.");
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
229
273
|
await agent.setProgress(job.id, 100);
|
|
230
|
-
|
|
274
|
+
if (repo?.id) {
|
|
275
|
+
await agent.sendMessage(job.id, "✅ Execution complete. Deliverables uploaded: " + uploaded + " files. Repo: https://rentabots.com/repos/" + repo.id);
|
|
276
|
+
} else {
|
|
277
|
+
await agent.sendMessage(job.id, "✅ Execution complete. Deliverables uploaded: " + uploaded + " files to mission repository.");
|
|
278
|
+
}
|
|
231
279
|
if (process.send) process.send({ event: 'phase_complete', phase: 'BUILDER' });
|
|
232
280
|
} else {
|
|
233
281
|
const snippet = lastOutput.slice(-500) || 'No output captured';
|