@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
21 lines • 1.32 kB
JavaScript
import { parseIdleExitMs } from "./host-lifecycle.js";
/** Environment override for the idle-session eviction window, in milliseconds. */
export const RPC_SESSION_IDLE_EVICTION_MS_ENV = "SENPI_RPC_SESSION_IDLE_EVICTION_MS";
/** Environment override for the empty-host exit window, in milliseconds. */
export const RPC_HOST_EMPTY_EXIT_MS_ENV = "SENPI_RPC_HOST_EMPTY_EXIT_MS";
/** Environment override for the graceful close_session teardown window, in milliseconds. */
export const RPC_CLOSE_GRACE_MS_ENV = "SENPI_RPC_CLOSE_GRACE_MS";
/** Default idle-eviction window: 30 minutes after a session's last routed command or settled turn. */
export const DEFAULT_SESSION_IDLE_EVICTION_MS = 30 * 60_000;
/** Default empty-host exit: 15 minutes with zero open sessions, matching the supervisor's idle window. */
export const DEFAULT_HOST_EMPTY_EXIT_MS = 15 * 60_000;
export function resolveHostIdlePolicy(env, overrides = {}) {
return {
now: overrides.now ?? Date.now,
idleEvictionMs: overrides.idleEvictionMs ??
parseIdleExitMs(env[RPC_SESSION_IDLE_EVICTION_MS_ENV]) ??
DEFAULT_SESSION_IDLE_EVICTION_MS,
emptyExitMs: overrides.emptyExitMs ?? parseIdleExitMs(env[RPC_HOST_EMPTY_EXIT_MS_ENV]) ?? DEFAULT_HOST_EMPTY_EXIT_MS,
};
}
//# sourceMappingURL=host-idle-policy.js.map