open-agents-ai 0.187.316 → 0.187.317

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 CHANGED
@@ -328830,6 +328830,16 @@ function setScheduledEnabled(id, enabled2) {
328830
328830
  } else {
328831
328831
  writeFileSync45(target.file, JSON.stringify({ tasks: arr }, null, 2));
328832
328832
  }
328833
+ if (!enabled2) {
328834
+ try {
328835
+ removeCronByMarker(id);
328836
+ } catch {
328837
+ }
328838
+ try {
328839
+ disableUserTimerById(id);
328840
+ } catch {
328841
+ }
328842
+ }
328833
328843
  return true;
328834
328844
  } catch {
328835
328845
  return false;
@@ -328889,16 +328899,17 @@ function listMatchingProcesses(pattern) {
328889
328899
  try {
328890
328900
  const { execSync: es } = __require("node:child_process");
328891
328901
  const re = new RegExp(pattern, "i");
328892
- const ps = es("ps -eo pid,pcpu,pmem,command", { encoding: "utf8", stdio: "pipe" });
328902
+ const ps = es("ps -eo pid,etimes,pcpu,pmem,command", { encoding: "utf8", stdio: "pipe" });
328893
328903
  for (const line of ps.split("\n")) {
328894
- const m2 = line.trim().match(/^(\d+)\s+([0-9.]+)?\s+([0-9.]+)?\s+(.+)$/);
328904
+ const m2 = line.trim().match(/^(\d+)\s+(\d+)?\s+([0-9.]+)?\s+([0-9.]+)?\s+(.+)$/);
328895
328905
  if (!m2) continue;
328896
328906
  const pid = parseInt(m2[1], 10);
328897
- const cpu = m2[2] ? parseFloat(m2[2]) : null;
328898
- const mem = m2[3] ? parseFloat(m2[3]) : null;
328899
- const cmd = m2[4] || "";
328907
+ const et = m2[2] ? parseInt(m2[2], 10) : void 0;
328908
+ const cpu = m2[3] ? parseFloat(m2[3]) : null;
328909
+ const mem = m2[4] ? parseFloat(m2[4]) : null;
328910
+ const cmd = m2[5] || "";
328900
328911
  if (!isFinite(pid)) continue;
328901
- if (re.test(cmd)) list.push({ pid, cpu, mem, cmd });
328912
+ if (re.test(cmd)) list.push({ pid, cpu, mem, cmd, uptime_s: et });
328902
328913
  }
328903
328914
  } catch {
328904
328915
  }
@@ -329740,6 +329751,23 @@ async function apiServeCommand(opts, config) {
329740
329751
  server.on("close", resolve40);
329741
329752
  });
329742
329753
  }
329754
+ function removeCronByMarker(id) {
329755
+ try {
329756
+ const lines = getCurrentCrontabLines();
329757
+ if (!lines.length) return;
329758
+ const next = lines.filter((l2) => !l2.includes(`${CRON_MARKER2}${id}`));
329759
+ if (next.length !== lines.length) writeCrontabLines(next);
329760
+ } catch {
329761
+ }
329762
+ }
329763
+ function disableUserTimerById(id) {
329764
+ try {
329765
+ const unit = `oa-${id}.timer`;
329766
+ const { execSync: es } = __require("node:child_process");
329767
+ es(`systemctl --user disable --now ${unit}`, { stdio: "pipe" });
329768
+ } catch {
329769
+ }
329770
+ }
329743
329771
  var endpointRegistry, modelRouteMap, endpointUsage, metrics, startedAt, _corsOrigins, _corsLocalOnly, runningProcesses, perKeyUsage, CRON_MARKER2;
329744
329772
  var init_serve = __esm({
329745
329773
  "packages/cli/src/api/serve.ts"() {
@@ -42,10 +42,14 @@ function extractWorkingDir(line) {
42
42
  function stripMarker(cmd) { return cmd.replace(/\s+#\s*OPEN-AGENTS-SCHEDULED:\S+.*/, ''); }
43
43
 
44
44
  function timerSpecFromCron(min, hour, dom, mon, dow) {
45
- // Support only */N minute and * * * * * → map to OnUnitActiveSec. Others return null (skip)
45
+ // Map simple intervals to OnUnitActiveSec
46
46
  if (min === '*' && hour === '*' && dom === '*' && mon === '*' && dow === '*') return { everySec: 60 };
47
47
  const step = (min.startsWith('*/') && hour === '*' && dom === '*' && mon === '*' && dow === '*') ? parseInt(min.slice(2), 10) : NaN;
48
48
  if (!Number.isNaN(step) && step > 0) return { everySec: step * 60 };
49
+ // Hourly at minute 0
50
+ if (min === '0' && hour === '*' && dom === '*' && mon === '*' && dow === '*') return { onCalendar: '*-*-* *:00:00' };
51
+ // Daily at fixed hour
52
+ if (min === '0' && /^\d+$/.test(hour) && dom === '*' && mon === '*' && dow === '*') return { onCalendar: `*-*-* ${hour.padStart ? hour.padStart(2,'0') : hour}:00:00` };
49
53
  return null;
50
54
  }
51
55
 
@@ -71,7 +75,9 @@ function migrate() {
71
75
  const tim = join(unitDir, `${unitBase}.timer`);
72
76
  const execCmd = `/bin/sh -lc ${JSON.stringify(shell)}`;
73
77
  const svcText = `[Unit]\nDescription=Open Agents Scheduled Task ${id}\nAfter=default.target\n\n[Service]\nType=oneshot\nExecStart=${execCmd}\nWorkingDirectory=${wd}\nEnvironment=OA_DAEMON=1\n\n[Install]\nWantedBy=default.target\n`;
74
- const timText = `[Unit]\nDescription=Timer for ${unitBase}\n\n[Timer]\nOnBootSec=30\nOnUnitActiveSec=${spec.everySec}\nPersistent=true\n\n[Install]\nWantedBy=timers.target\n`;
78
+ const timText = spec.onCalendar
79
+ ? `[Unit]\nDescription=Timer for ${unitBase}\n\n[Timer]\nOnCalendar=${spec.onCalendar}\nPersistent=true\n\n[Install]\nWantedBy=timers.target\n`
80
+ : `[Unit]\nDescription=Timer for ${unitBase}\n\n[Timer]\nOnBootSec=30\nOnUnitActiveSec=${spec.everySec}\nPersistent=true\n\n[Install]\nWantedBy=timers.target\n`;
75
81
  try {
76
82
  mkdirSync(unitDir, { recursive: true });
77
83
  writeFileSync(svc, svcText);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.316",
3
+ "version": "0.187.317",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",