@liriraid/agentflow-ai 1.0.13 → 1.0.15
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/bin/agentflow.mjs +103 -3
- package/orchestrator.js +393 -113
- package/package.json +1 -1
- package/scripts/auto-trigger.js +114 -0
- package/scripts/monitor-check.js +172 -0
- package/src/ink/app.mjs +22 -14
- package/src/ink/index.mjs +23 -2
- package/templates/en/ORCHESTRATOR.md +53 -28
- package/templates/en/orchestrator.config.json +3 -3
- package/templates/es/ORCHESTRATOR.md +61 -22
- package/templates/es/orchestrator.config.json +5 -5
package/bin/agentflow.mjs
CHANGED
|
@@ -71,20 +71,23 @@ function printHelp() {
|
|
|
71
71
|
console.log(`
|
|
72
72
|
agentflow
|
|
73
73
|
|
|
74
|
-
Uso:
|
|
74
|
+
Uso / Usage:
|
|
75
75
|
agentflow init [targetDir] [--project-name <name>] [--backend <path>] [--frontend <path>] [--lang <en|es>] [--force]
|
|
76
76
|
agentflow init-workspace <projectPath> [--workspace-name <name>] [--backend <path>] [--frontend <path>] [--lang <en|es>] [--force]
|
|
77
77
|
agentflow tui [--paused] [--yolo]
|
|
78
78
|
agentflow ink [--paused] [--yolo]
|
|
79
|
+
agentflow schedule [--uninstall]
|
|
79
80
|
agentflow skills:registry
|
|
80
81
|
agentflow openspec:new <change-name>
|
|
81
82
|
agentflow agent-config:init
|
|
82
83
|
|
|
83
|
-
Ejemplos:
|
|
84
|
+
Ejemplos / Examples:
|
|
84
85
|
agentflow init . --project-name "Mi Proyecto" --lang es
|
|
85
86
|
agentflow init-workspace C:/code/mi-proyecto --lang en
|
|
86
87
|
agentflow tui --paused
|
|
87
|
-
agentflow ink
|
|
88
|
+
agentflow ink --yolo
|
|
89
|
+
agentflow schedule
|
|
90
|
+
agentflow schedule --uninstall
|
|
88
91
|
`);
|
|
89
92
|
}
|
|
90
93
|
|
|
@@ -278,6 +281,100 @@ async function initWorkspace(args) {
|
|
|
278
281
|
console.log(TEXT[language].sibling);
|
|
279
282
|
}
|
|
280
283
|
|
|
284
|
+
async function scheduleScripts(args) {
|
|
285
|
+
const {flags} = parseFlags(args);
|
|
286
|
+
const uninstall = Boolean(flags.uninstall);
|
|
287
|
+
const workspace = process.cwd();
|
|
288
|
+
const scriptRoot = PACKAGE_ROOT;
|
|
289
|
+
const autoTrigger = path.join(scriptRoot, 'scripts', 'auto-trigger.js');
|
|
290
|
+
const monitorCheck = path.join(scriptRoot, 'scripts', 'monitor-check.js');
|
|
291
|
+
const nodeExe = process.execPath;
|
|
292
|
+
|
|
293
|
+
if (process.platform !== 'win32') {
|
|
294
|
+
console.log('agentflow schedule only supports Windows Task Scheduler.');
|
|
295
|
+
console.log('For macOS/Linux, add these to crontab manually:');
|
|
296
|
+
console.log(` * * * * * ORCHESTRATOR_WORKSPACE="${workspace}" "${nodeExe}" "${autoTrigger}"`);
|
|
297
|
+
console.log(` */5 * * * * ORCHESTRATOR_WORKSPACE="${workspace}" "${nodeExe}" "${monitorCheck}"`);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const {execSync} = await import('child_process');
|
|
302
|
+
const env = `ORCHESTRATOR_WORKSPACE=${workspace}`;
|
|
303
|
+
|
|
304
|
+
const tasks = [
|
|
305
|
+
{
|
|
306
|
+
name: 'agentflow-auto-trigger',
|
|
307
|
+
script: autoTrigger,
|
|
308
|
+
description: 'agentflow: check INBOX every 60s and trigger Claude',
|
|
309
|
+
repetition: 'PT1M',
|
|
310
|
+
duration: 'PT1M',
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
name: 'agentflow-monitor-check',
|
|
314
|
+
script: monitorCheck,
|
|
315
|
+
description: 'agentflow: Away Mode monitor every 5 minutes',
|
|
316
|
+
repetition: 'PT5M',
|
|
317
|
+
duration: 'PT5M',
|
|
318
|
+
},
|
|
319
|
+
];
|
|
320
|
+
|
|
321
|
+
for (const t of tasks) {
|
|
322
|
+
if (uninstall) {
|
|
323
|
+
try {
|
|
324
|
+
execSync(`schtasks /Delete /TN "${t.name}" /F`, {stdio: 'pipe'});
|
|
325
|
+
console.log(`Removed: ${t.name}`);
|
|
326
|
+
} catch {
|
|
327
|
+
console.log(`Not found (already removed): ${t.name}`);
|
|
328
|
+
}
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
// Delete existing before recreating to avoid duplicates
|
|
332
|
+
try { execSync(`schtasks /Delete /TN "${t.name}" /F`, {stdio: 'pipe'}); } catch {}
|
|
333
|
+
const cmd = [
|
|
334
|
+
'schtasks /Create',
|
|
335
|
+
`/TN "${t.name}"`,
|
|
336
|
+
`/TR "${nodeExe} \\"${t.script}\\""`,
|
|
337
|
+
'/SC MINUTE',
|
|
338
|
+
`/MO ${t.name === 'agentflow-auto-trigger' ? 1 : 5}`,
|
|
339
|
+
'/RU SYSTEM',
|
|
340
|
+
`/F`,
|
|
341
|
+
].join(' ');
|
|
342
|
+
try {
|
|
343
|
+
execSync(cmd, {
|
|
344
|
+
stdio: 'pipe',
|
|
345
|
+
env: {...process.env, ORCHESTRATOR_WORKSPACE: workspace},
|
|
346
|
+
});
|
|
347
|
+
console.log(`Scheduled: ${t.name} (every ${t.name === 'agentflow-auto-trigger' ? '1' : '5'} min)`);
|
|
348
|
+
} catch (err) {
|
|
349
|
+
// schtasks /RU SYSTEM may fail without admin — fallback to current user
|
|
350
|
+
const cmdUser = [
|
|
351
|
+
'schtasks /Create',
|
|
352
|
+
`/TN "${t.name}"`,
|
|
353
|
+
`/TR "cmd /c set ORCHESTRATOR_WORKSPACE=${workspace} && \\"${nodeExe}\\" \\"${t.script}\\""`,
|
|
354
|
+
'/SC MINUTE',
|
|
355
|
+
`/MO ${t.name === 'agentflow-auto-trigger' ? 1 : 5}`,
|
|
356
|
+
'/F',
|
|
357
|
+
].join(' ');
|
|
358
|
+
try {
|
|
359
|
+
execSync(cmdUser, {stdio: 'inherit'});
|
|
360
|
+
console.log(`Scheduled (current user): ${t.name}`);
|
|
361
|
+
} catch (err2) {
|
|
362
|
+
console.error(`Failed to schedule ${t.name}: ${err2.message}`);
|
|
363
|
+
console.error('Run as Administrator or add manually to Task Scheduler.');
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (!uninstall) {
|
|
369
|
+
console.log('');
|
|
370
|
+
console.log(`Workspace: ${workspace}`);
|
|
371
|
+
console.log('auto-trigger.js → every 1 min (checks INBOX, triggers Claude)');
|
|
372
|
+
console.log('monitor-check.js → every 5 min (Away Mode monitor)');
|
|
373
|
+
console.log('');
|
|
374
|
+
console.log('To remove: agentflow schedule --uninstall');
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
281
378
|
function runNodeScript(relativeScript, args = []) {
|
|
282
379
|
const scriptPath = path.join(PACKAGE_ROOT, relativeScript);
|
|
283
380
|
const child = spawn(process.execPath, [scriptPath, ...args], {
|
|
@@ -325,6 +422,9 @@ switch (command) {
|
|
|
325
422
|
case 'agent-config:init':
|
|
326
423
|
runNodeScript(path.join('scripts', 'scaffold-agent-configs.mjs'));
|
|
327
424
|
break;
|
|
425
|
+
case 'schedule':
|
|
426
|
+
await scheduleScripts(argv.slice(1));
|
|
427
|
+
break;
|
|
328
428
|
default:
|
|
329
429
|
console.error(TEXT.es.unknown(command));
|
|
330
430
|
printHelp();
|