@ducci/jarvis 1.0.49 → 1.0.51

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.
@@ -25,6 +25,16 @@ Only the most recent messages are included in your context (sliding window). Old
25
25
 
26
26
  Use `create_cron` when the user wants something scheduled — even without the word "cron". Common triggers: "every night", "every 2 hours", "remind me at 3pm", "notify me in 2 hours", "check X every Monday". See the `create_cron` and `get_current_time` tool descriptions for how to construct the schedule and prompt correctly.
27
27
 
28
+ ## Subagents
29
+
30
+ Use `spawn_subagent` when a task involves multiple independent items that can be processed in parallel. Common triggers: "check all emails", "process these files", "summarize each of these URLs", "do X for every Y".
31
+
32
+ Rules:
33
+ - Spawn **all subagents in a single response** — never one at a time. They run in parallel; waiting defeats the purpose.
34
+ - Each subagent must receive a **fully self-contained prompt** with all context it needs (item content, goal, expected output format).
35
+ - Use subagents to **avoid context overflow**: processing 10+ items serially in one session bloats the context and risks hitting limits. Offload to subagents instead.
36
+ - After all subagents return, **aggregate their results** yourself and decide on the next step — whether that means further tool calls, a follow-up action, or reporting back to the user.
37
+
28
38
  ## Skills
29
39
 
30
40
  Skills are predefined workflows that guide how you approach specific tasks. When a task matches a skill, load its full instructions with the `read_skill` tool before proceeding — do not guess the workflow from the description alone.
@@ -54,8 +64,8 @@ Never include markdown code fences, preamble, or any text outside this JSON obje
54
64
  You have access to a set of tools. Each tool has a name and description that tells you what it does and when to use it — read those descriptions carefully.
55
65
 
56
66
  - Always use a tool to perform an action. Never claim to have done something without actually calling the relevant tool.
57
- - Call tools one at a time. You will receive the result before deciding on the next step.
58
- - After a tool call, verify the result before declaring the task done. Always communicate what you did and why — don't just report success, briefly explain the action taken.
67
+ - Call tools one at a time. You will receive the result before deciding on the next step. Exception: when using `spawn_subagent` for bulk tasks (e.g. N emails, files, or items), spawn all subagents in a single response so they run in parallel — do not wait for one to finish before spawning the next.
68
+ - After a tool call, verify the result before proceeding. In your final response, explain what was done and why — do not just report success without evidence.
59
69
  - Stop as soon as the task is complete and verified. Do not do extra work that was not asked for.
60
70
  - If a tool fails, record the error in `logSummary` and decide whether to retry with a corrected call or explain the failure to the user.
61
71
  - Proactively save user facts with `save_user_info` when the user shares personal details (name, timezone, preferences) — even if not asked.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ducci/jarvis",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
4
4
  "description": "A fully automated agent system that lives on a server.",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -4,24 +4,9 @@ import fs from 'fs';
4
4
  import path from 'path';
5
5
  import os from 'os';
6
6
  import { spawnSync } from 'child_process';
7
- import { createRequire } from 'module';
8
7
  import inquirer from 'inquirer';
9
8
  import chalk from 'chalk';
10
9
 
11
- // Resolve pm2 CLI from local node_modules so it works even when pm2 is not in PATH
12
- // (e.g. when Node is managed by NVM and the shell is not initialised with it).
13
- const _require = createRequire(import.meta.url);
14
- let PM2_BIN;
15
- try {
16
- PM2_BIN = _require.resolve('pm2/bin/pm2');
17
- } catch {
18
- PM2_BIN = null; // will fall back gracefully
19
- }
20
- function pm2(...args) {
21
- if (!PM2_BIN) return { status: 1, error: new Error('pm2 binary not found') };
22
- return spawnSync(process.execPath, [PM2_BIN, ...args], { stdio: 'inherit' });
23
- }
24
-
25
10
  const jarvisDir = path.join(os.homedir(), '.jarvis');
26
11
  const envFile = path.join(jarvisDir, '.env');
27
12
  const configDir = path.join(jarvisDir, 'data', 'config');
@@ -436,7 +421,13 @@ async function run() {
436
421
  }
437
422
  }
438
423
 
439
- // --- LOG ROTATION STEP ---
424
+ // --- PM2 + LOG ROTATION STEP ---
425
+ const pm2Check = spawnSync('pm2', ['--version'], { stdio: 'pipe' });
426
+ if (pm2Check.status !== 0) {
427
+ console.log(chalk.blue('Installing pm2 globally...'));
428
+ spawnSync('npm', ['install', '-g', 'pm2'], { stdio: 'inherit' });
429
+ }
430
+
440
431
  const logrotateModuleDir = path.join(os.homedir(), '.pm2', 'modules', 'pm2-logrotate');
441
432
  const logrotateInstalled = fs.existsSync(logrotateModuleDir);
442
433
 
@@ -454,14 +445,14 @@ async function run() {
454
445
 
455
446
  if (setupLogrotate) {
456
447
  console.log(chalk.blue('Installing pm2-logrotate...'));
457
- const install = pm2('install', 'pm2-logrotate');
448
+ const install = spawnSync('pm2', ['install', 'pm2-logrotate'], { stdio: 'inherit' });
458
449
  if (install.status !== 0) {
459
- console.log(chalk.yellow('Installation failed — try running `pm2 install pm2-logrotate` manually.'));
450
+ console.log(chalk.yellow('Installation failed — make sure pm2 is installed globally (`npm install -g pm2`) and try again.'));
460
451
  } else {
461
- pm2('set', 'pm2-logrotate:max_size', '10M');
462
- pm2('set', 'pm2-logrotate:retain', '5');
463
- pm2('set', 'pm2-logrotate:compress', 'true');
464
- pm2('set', 'pm2-logrotate:rotateInterval', '0 0 * * *');
452
+ spawnSync('pm2', ['set', 'pm2-logrotate:max_size', '10M'], { stdio: 'inherit' });
453
+ spawnSync('pm2', ['set', 'pm2-logrotate:retain', '5'], { stdio: 'inherit' });
454
+ spawnSync('pm2', ['set', 'pm2-logrotate:compress', 'true'], { stdio: 'inherit' });
455
+ spawnSync('pm2', ['set', 'pm2-logrotate:rotateInterval', '0 0 * * *'], { stdio: 'inherit' });
465
456
  console.log(chalk.green('pm2-logrotate installed: 10 MB max, 5 rotated files kept, daily rotation.'));
466
457
  }
467
458
  }