open-agents-ai 0.187.516 → 0.187.518

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
@@ -596035,8 +596035,8 @@ function adoptHandoffRuns() {
596035
596035
  } catch {
596036
596036
  alive = false;
596037
596037
  }
596038
- const jobsDir3 = path8.join(home, ".open-agents", "jobs");
596039
- const jobFile = path8.join(jobsDir3, `${r2.jobId}.json`);
596038
+ const dirJobs = jobsDir();
596039
+ const jobFile = path8.join(dirJobs, `${r2.jobId}.json`);
596040
596040
  let job = null;
596041
596041
  try {
596042
596042
  if (fs7.existsSync(jobFile)) job = JSON.parse(fs7.readFileSync(jobFile, "utf-8"));
@@ -596099,6 +596099,58 @@ function adoptHandoffRuns() {
596099
596099
  } catch {
596100
596100
  }
596101
596101
  }
596102
+ if (r2.deadlineAtMs && r2.deadlineAtMs > 0 && process.env["OA_DISABLE_DAEMON_TIMEOUT_KILL"] !== "1") {
596103
+ const remainingMs = r2.deadlineAtMs - Date.now();
596104
+ const adoptedPid = r2.pid;
596105
+ const adoptedJobId = r2.jobId;
596106
+ const fireTimeout = () => {
596107
+ try {
596108
+ if (!fs7.existsSync(jobFile)) return;
596109
+ const cur = JSON.parse(fs7.readFileSync(jobFile, "utf-8"));
596110
+ if (cur.status !== "running") return;
596111
+ cur.status = "timeout";
596112
+ cur.completedAt = (/* @__PURE__ */ new Date()).toISOString();
596113
+ fs7.writeFileSync(jobFile, JSON.stringify(cur, null, 2), "utf-8");
596114
+ } catch {
596115
+ }
596116
+ try {
596117
+ process.kill(-adoptedPid, "SIGTERM");
596118
+ } catch {
596119
+ }
596120
+ try {
596121
+ process.kill(adoptedPid, "SIGTERM");
596122
+ } catch {
596123
+ }
596124
+ setTimeout(() => {
596125
+ try {
596126
+ process.kill(-adoptedPid, "SIGKILL");
596127
+ } catch {
596128
+ }
596129
+ try {
596130
+ process.kill(adoptedPid, "SIGKILL");
596131
+ } catch {
596132
+ }
596133
+ }, 3e4).unref();
596134
+ try {
596135
+ publishEvent(
596136
+ "run.timeout",
596137
+ { run_id: adoptedJobId, source: "adopted-rearm" },
596138
+ { subject: r2.user || "anonymous", aimsControl: "A.6.2.6" }
596139
+ );
596140
+ } catch {
596141
+ }
596142
+ process.stderr.write(` RCA-1 re-armed deadline fired for adopted run ${adoptedJobId} (pid=${adoptedPid})
596143
+ `);
596144
+ };
596145
+ if (remainingMs <= 0) {
596146
+ process.stderr.write(` Adopted run ${adoptedJobId} is past its deadline by ${-remainingMs}ms — firing SIGTERM now.
596147
+ `);
596148
+ setImmediate(fireTimeout);
596149
+ } else {
596150
+ const t2 = setTimeout(fireTimeout, remainingMs);
596151
+ t2.unref();
596152
+ }
596153
+ }
596102
596154
  const pollHandle = setInterval(() => {
596103
596155
  let stillAlive = false;
596104
596156
  try {
@@ -598032,6 +598084,11 @@ async function handleV1Run(req2, res) {
598032
598084
  let _rca1DeadlineFired = false;
598033
598085
  const _rca1KillSwitch = process.env["OA_DISABLE_DAEMON_TIMEOUT_KILL"] === "1";
598034
598086
  const _rca1EffectiveTimeoutS = timeout2 && timeout2 > 0 ? timeout2 : activeProfile?.limits?.timeout_s && activeProfile.limits.timeout_s > 0 ? activeProfile.limits.timeout_s : 1800;
598087
+ const _rca1DeadlineAtMs = Date.now() + (_rca1EffectiveTimeoutS + 60) * 1e3;
598088
+ if (!_rca1KillSwitch) {
598089
+ job.deadlineAtMs = _rca1DeadlineAtMs;
598090
+ atomicJobWrite(dir, id, job);
598091
+ }
598035
598092
  const _rca1Deadline = _rca1KillSwitch ? null : setTimeout(() => {
598036
598093
  if (job.status !== "running") return;
598037
598094
  _rca1DeadlineFired = true;
@@ -601844,23 +601901,24 @@ function startApiServer(options2 = {}) {
601844
601901
  let user = null;
601845
601902
  let scope = null;
601846
601903
  let cwd5 = null;
601904
+ let deadlineAtMs = null;
601847
601905
  try {
601848
- const fs7 = require3("node:fs");
601906
+ const dir = jobsDir();
601849
601907
  const path8 = require3("node:path");
601850
- const home = require3("node:os").homedir();
601851
- const jobsDir3 = path8.join(home, ".open-agents", "jobs");
601852
- const jobFile = path8.join(jobsDir3, `${id}.json`);
601908
+ const fs7 = require3("node:fs");
601909
+ const jobFile = path8.join(dir, `${id}.json`);
601853
601910
  if (fs7.existsSync(jobFile)) {
601854
601911
  const j = JSON.parse(fs7.readFileSync(jobFile, "utf-8"));
601855
- outputFile = j.outputFile ?? path8.join(jobsDir3, `${id}.output`);
601912
+ outputFile = j.outputFile ?? path8.join(dir, `${id}.output`);
601856
601913
  startedAt2 = j.startedAt ?? null;
601857
601914
  user = j.user ?? null;
601858
601915
  scope = j.scope ?? null;
601859
601916
  cwd5 = j.cwd ?? null;
601917
+ deadlineAtMs = typeof j.deadlineAtMs === "number" && j.deadlineAtMs > 0 ? j.deadlineAtMs : null;
601860
601918
  }
601861
601919
  } catch {
601862
601920
  }
601863
- handoff.push({ jobId: id, pid, outputFile, startedAt: startedAt2, user, scope, cwd: cwd5, handoffAt: (/* @__PURE__ */ new Date()).toISOString() });
601921
+ handoff.push({ jobId: id, pid, outputFile, startedAt: startedAt2, user, scope, cwd: cwd5, handoffAt: (/* @__PURE__ */ new Date()).toISOString(), deadlineAtMs });
601864
601922
  }
601865
601923
  if (handoff.length > 0) {
601866
601924
  try {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.516",
3
+ "version": "0.187.518",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "open-agents-ai",
9
- "version": "0.187.516",
9
+ "version": "0.187.518",
10
10
  "hasInstallScript": true,
11
11
  "license": "CC-BY-NC-4.0",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.516",
3
+ "version": "0.187.518",
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",