@0perator/operator 0.1.348 → 0.1.349
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/idle/policy.js +5 -3
- package/package.json +1 -1
package/dist/idle/policy.js
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
// absolute — the session has lived `absoluteMs` whatever it did → end it (a hard cap an activity bump can't push past)
|
|
4
4
|
// A session that is DOING something (a turn, a background job or agent, a connected remote) is never idle: Jupyter's
|
|
5
5
|
// `cull_busy=false`. The monitor (monitor.ts) and the external reaper (reaper.ts) both call `evaluateIdle`, so they cannot disagree.
|
|
6
|
+
// Both clocks are OFF by default (2026-11-02): an Operator session never ends itself; an owner opts in per clock.
|
|
6
7
|
export const DEFAULT_IDLE_POLICY = {
|
|
7
8
|
enabled: true,
|
|
8
|
-
idleMs:
|
|
9
|
+
idleMs: 0,
|
|
9
10
|
warnMs: 5 * 60_000,
|
|
10
|
-
absoluteMs:
|
|
11
|
+
absoluteMs: 0,
|
|
11
12
|
graceMs: 10_000,
|
|
12
13
|
};
|
|
13
14
|
const num = (v) => {
|
|
@@ -24,11 +25,12 @@ export function resolveIdlePolicy(raw, env = process.env) {
|
|
|
24
25
|
const grace = num(s.graceSeconds);
|
|
25
26
|
const off = env.KODE_IDLE === "0" || s.enabled === false;
|
|
26
27
|
const idleMs = minutes === undefined ? d.idleMs : minutes * 60_000;
|
|
28
|
+
const warnMs = warn === undefined ? d.warnMs : warn * 60_000;
|
|
27
29
|
return {
|
|
28
30
|
enabled: !off,
|
|
29
31
|
idleMs,
|
|
30
32
|
// a warning longer than the idle window would fire before the idle clock even started
|
|
31
|
-
warnMs:
|
|
33
|
+
warnMs: idleMs > 0 ? Math.min(warnMs, idleMs) : warnMs,
|
|
32
34
|
absoluteMs: hours === undefined ? d.absoluteMs : hours * 3_600_000,
|
|
33
35
|
graceMs: grace === undefined ? d.graceMs : grace * 1000,
|
|
34
36
|
};
|