open-agents-ai 0.187.516 → 0.187.517
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 +60 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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,6 +601901,7 @@ 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
601906
|
const fs7 = require3("node:fs");
|
|
601849
601907
|
const path8 = require3("node:path");
|
|
@@ -601857,10 +601915,11 @@ function startApiServer(options2 = {}) {
|
|
|
601857
601915
|
user = j.user ?? null;
|
|
601858
601916
|
scope = j.scope ?? null;
|
|
601859
601917
|
cwd5 = j.cwd ?? null;
|
|
601918
|
+
deadlineAtMs = typeof j.deadlineAtMs === "number" && j.deadlineAtMs > 0 ? j.deadlineAtMs : null;
|
|
601860
601919
|
}
|
|
601861
601920
|
} catch {
|
|
601862
601921
|
}
|
|
601863
|
-
handoff.push({ jobId: id, pid, outputFile, startedAt: startedAt2, user, scope, cwd: cwd5, handoffAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
601922
|
+
handoff.push({ jobId: id, pid, outputFile, startedAt: startedAt2, user, scope, cwd: cwd5, handoffAt: (/* @__PURE__ */ new Date()).toISOString(), deadlineAtMs });
|
|
601864
601923
|
}
|
|
601865
601924
|
if (handoff.length > 0) {
|
|
601866
601925
|
try {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-agents-ai",
|
|
3
|
-
"version": "0.187.
|
|
3
|
+
"version": "0.187.517",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "open-agents-ai",
|
|
9
|
-
"version": "0.187.
|
|
9
|
+
"version": "0.187.517",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "CC-BY-NC-4.0",
|
|
12
12
|
"dependencies": {
|
package/package.json
CHANGED