Remove redundant debugLog util (#295)

This commit is contained in:
Mateusz Burzyński
2026-02-13 19:13:59 +00:00
committed by pullfrog[bot]
parent 5e76fd86df
commit 3c748ddf6e
2 changed files with 80 additions and 99 deletions
+77 -84
View File
@@ -17639,12 +17639,12 @@ var require_lib = __commonJS({
throw new Error("Client has already been disposed."); throw new Error("Client has already been disposed.");
} }
const parsedUrl = new URL(requestUrl); const parsedUrl = new URL(requestUrl);
let info3 = this._prepareRequest(verb, parsedUrl, headers); let info2 = this._prepareRequest(verb, parsedUrl, headers);
const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) ? this._maxRetries + 1 : 1; const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb) ? this._maxRetries + 1 : 1;
let numTries = 0; let numTries = 0;
let response; let response;
do { do {
response = yield this.requestRaw(info3, data); response = yield this.requestRaw(info2, data);
if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) { if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) {
let authenticationHandler; let authenticationHandler;
for (const handler2 of this.handlers) { for (const handler2 of this.handlers) {
@@ -17654,7 +17654,7 @@ var require_lib = __commonJS({
} }
} }
if (authenticationHandler) { if (authenticationHandler) {
return authenticationHandler.handleAuthentication(this, info3, data); return authenticationHandler.handleAuthentication(this, info2, data);
} else { } else {
return response; return response;
} }
@@ -17677,8 +17677,8 @@ var require_lib = __commonJS({
} }
} }
} }
info3 = this._prepareRequest(verb, parsedRedirectUrl, headers); info2 = this._prepareRequest(verb, parsedRedirectUrl, headers);
response = yield this.requestRaw(info3, data); response = yield this.requestRaw(info2, data);
redirectsRemaining--; redirectsRemaining--;
} }
if (!response.message.statusCode || !HttpResponseRetryCodes.includes(response.message.statusCode)) { if (!response.message.statusCode || !HttpResponseRetryCodes.includes(response.message.statusCode)) {
@@ -17707,7 +17707,7 @@ var require_lib = __commonJS({
* @param info * @param info
* @param data * @param data
*/ */
requestRaw(info3, data) { requestRaw(info2, data) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve3, reject) => { return new Promise((resolve3, reject) => {
function callbackForResult(err, res) { function callbackForResult(err, res) {
@@ -17719,7 +17719,7 @@ var require_lib = __commonJS({
resolve3(res); resolve3(res);
} }
} }
this.requestRawWithCallback(info3, data, callbackForResult); this.requestRawWithCallback(info2, data, callbackForResult);
}); });
}); });
} }
@@ -17729,12 +17729,12 @@ var require_lib = __commonJS({
* @param data * @param data
* @param onResult * @param onResult
*/ */
requestRawWithCallback(info3, data, onResult) { requestRawWithCallback(info2, data, onResult) {
if (typeof data === "string") { if (typeof data === "string") {
if (!info3.options.headers) { if (!info2.options.headers) {
info3.options.headers = {}; info2.options.headers = {};
} }
info3.options.headers["Content-Length"] = Buffer.byteLength(data, "utf8"); info2.options.headers["Content-Length"] = Buffer.byteLength(data, "utf8");
} }
let callbackCalled = false; let callbackCalled = false;
function handleResult2(err, res) { function handleResult2(err, res) {
@@ -17743,7 +17743,7 @@ var require_lib = __commonJS({
onResult(err, res); onResult(err, res);
} }
} }
const req = info3.httpModule.request(info3.options, (msg) => { const req = info2.httpModule.request(info2.options, (msg) => {
const res = new HttpClientResponse(msg); const res = new HttpClientResponse(msg);
handleResult2(void 0, res); handleResult2(void 0, res);
}); });
@@ -17755,7 +17755,7 @@ var require_lib = __commonJS({
if (socket) { if (socket) {
socket.end(); socket.end();
} }
handleResult2(new Error(`Request timeout: ${info3.options.path}`)); handleResult2(new Error(`Request timeout: ${info2.options.path}`));
}); });
req.on("error", function(err) { req.on("error", function(err) {
handleResult2(err); handleResult2(err);
@@ -17791,27 +17791,27 @@ var require_lib = __commonJS({
return this._getProxyAgentDispatcher(parsedUrl, proxyUrl); return this._getProxyAgentDispatcher(parsedUrl, proxyUrl);
} }
_prepareRequest(method, requestUrl, headers) { _prepareRequest(method, requestUrl, headers) {
const info3 = {}; const info2 = {};
info3.parsedUrl = requestUrl; info2.parsedUrl = requestUrl;
const usingSsl = info3.parsedUrl.protocol === "https:"; const usingSsl = info2.parsedUrl.protocol === "https:";
info3.httpModule = usingSsl ? https : http2; info2.httpModule = usingSsl ? https : http2;
const defaultPort = usingSsl ? 443 : 80; const defaultPort = usingSsl ? 443 : 80;
info3.options = {}; info2.options = {};
info3.options.host = info3.parsedUrl.hostname; info2.options.host = info2.parsedUrl.hostname;
info3.options.port = info3.parsedUrl.port ? parseInt(info3.parsedUrl.port) : defaultPort; info2.options.port = info2.parsedUrl.port ? parseInt(info2.parsedUrl.port) : defaultPort;
info3.options.path = (info3.parsedUrl.pathname || "") + (info3.parsedUrl.search || ""); info2.options.path = (info2.parsedUrl.pathname || "") + (info2.parsedUrl.search || "");
info3.options.method = method; info2.options.method = method;
info3.options.headers = this._mergeHeaders(headers); info2.options.headers = this._mergeHeaders(headers);
if (this.userAgent != null) { if (this.userAgent != null) {
info3.options.headers["user-agent"] = this.userAgent; info2.options.headers["user-agent"] = this.userAgent;
} }
info3.options.agent = this._getAgent(info3.parsedUrl); info2.options.agent = this._getAgent(info2.parsedUrl);
if (this.handlers) { if (this.handlers) {
for (const handler2 of this.handlers) { for (const handler2 of this.handlers) {
handler2.prepareRequest(info3.options); handler2.prepareRequest(info2.options);
} }
} }
return info3; return info2;
} }
_mergeHeaders(headers) { _mergeHeaders(headers) {
if (this.requestOptions && this.requestOptions.headers) { if (this.requestOptions && this.requestOptions.headers) {
@@ -19781,10 +19781,10 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
error49(message); error49(message);
} }
exports.setFailed = setFailed2; exports.setFailed = setFailed2;
function isDebug3() { function isDebug2() {
return process.env["RUNNER_DEBUG"] === "1"; return process.env["RUNNER_DEBUG"] === "1";
} }
exports.isDebug = isDebug3; exports.isDebug = isDebug2;
function debug2(message) { function debug2(message) {
(0, command_1.issueCommand)("debug", {}, message); (0, command_1.issueCommand)("debug", {}, message);
} }
@@ -19801,10 +19801,10 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
(0, command_1.issueCommand)("notice", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message); (0, command_1.issueCommand)("notice", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message);
} }
exports.notice = notice; exports.notice = notice;
function info3(message) { function info2(message) {
process.stdout.write(message + os.EOL); process.stdout.write(message + os.EOL);
} }
exports.info = info3; exports.info = info2;
function startGroup3(name) { function startGroup3(name) {
(0, command_1.issue)("group", name); (0, command_1.issue)("group", name);
} }
@@ -42088,7 +42088,7 @@ var require_core3 = __commonJS({
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var id_1 = require_id(); var id_1 = require_id();
var ref_1 = require_ref(); var ref_1 = require_ref();
var core7 = [ var core6 = [
"$schema", "$schema",
"$id", "$id",
"$defs", "$defs",
@@ -42098,7 +42098,7 @@ var require_core3 = __commonJS({
id_1.default, id_1.default,
ref_1.default ref_1.default
]; ];
exports.default = core7; exports.default = core6;
} }
}); });
@@ -45876,7 +45876,7 @@ var require_diagnostics = __commonJS({
pong: diagnosticsChannel.channel("undici:websocket:pong") pong: diagnosticsChannel.channel("undici:websocket:pong")
}; };
var isTrackingClientEvents = false; var isTrackingClientEvents = false;
function trackClientEvents(debugLog2 = undiciDebugLog) { function trackClientEvents(debugLog = undiciDebugLog) {
if (isTrackingClientEvents) { if (isTrackingClientEvents) {
return; return;
} }
@@ -45887,7 +45887,7 @@ var require_diagnostics = __commonJS({
const { const {
connectParams: { version: version3, protocol, port, host } connectParams: { version: version3, protocol, port, host }
} = evt; } = evt;
debugLog2( debugLog(
"connecting to %s%s using %s%s", "connecting to %s%s using %s%s",
host, host,
port ? `:${port}` : "", port ? `:${port}` : "",
@@ -45902,7 +45902,7 @@ var require_diagnostics = __commonJS({
const { const {
connectParams: { version: version3, protocol, port, host } connectParams: { version: version3, protocol, port, host }
} = evt; } = evt;
debugLog2( debugLog(
"connected to %s%s using %s%s", "connected to %s%s using %s%s",
host, host,
port ? `:${port}` : "", port ? `:${port}` : "",
@@ -45918,7 +45918,7 @@ var require_diagnostics = __commonJS({
connectParams: { version: version3, protocol, port, host }, connectParams: { version: version3, protocol, port, host },
error: error49 error: error49
} = evt; } = evt;
debugLog2( debugLog(
"connection to %s%s using %s%s errored - %s", "connection to %s%s using %s%s errored - %s",
host, host,
port ? `:${port}` : "", port ? `:${port}` : "",
@@ -45934,12 +45934,12 @@ var require_diagnostics = __commonJS({
const { const {
request: { method, path: path3, origin } request: { method, path: path3, origin }
} = evt; } = evt;
debugLog2("sending request to %s %s%s", method, origin, path3); debugLog("sending request to %s %s%s", method, origin, path3);
} }
); );
} }
var isTrackingRequestEvents = false; var isTrackingRequestEvents = false;
function trackRequestEvents(debugLog2 = undiciDebugLog) { function trackRequestEvents(debugLog = undiciDebugLog) {
if (isTrackingRequestEvents) { if (isTrackingRequestEvents) {
return; return;
} }
@@ -45951,7 +45951,7 @@ var require_diagnostics = __commonJS({
request: { method, path: path3, origin }, request: { method, path: path3, origin },
response: { statusCode } response: { statusCode }
} = evt; } = evt;
debugLog2( debugLog(
"received response to %s %s%s - HTTP %d", "received response to %s %s%s - HTTP %d",
method, method,
origin, origin,
@@ -45966,7 +45966,7 @@ var require_diagnostics = __commonJS({
const { const {
request: { method, path: path3, origin } request: { method, path: path3, origin }
} = evt; } = evt;
debugLog2("trailers received from %s %s%s", method, origin, path3); debugLog("trailers received from %s %s%s", method, origin, path3);
} }
); );
diagnosticsChannel.subscribe( diagnosticsChannel.subscribe(
@@ -45976,7 +45976,7 @@ var require_diagnostics = __commonJS({
request: { method, path: path3, origin }, request: { method, path: path3, origin },
error: error49 error: error49
} = evt; } = evt;
debugLog2( debugLog(
"request to %s %s%s errored - %s", "request to %s %s%s errored - %s",
method, method,
origin, origin,
@@ -45987,7 +45987,7 @@ var require_diagnostics = __commonJS({
); );
} }
var isTrackingWebSocketEvents = false; var isTrackingWebSocketEvents = false;
function trackWebSocketEvents(debugLog2 = websocketDebuglog) { function trackWebSocketEvents(debugLog = websocketDebuglog) {
if (isTrackingWebSocketEvents) { if (isTrackingWebSocketEvents) {
return; return;
} }
@@ -45998,14 +45998,14 @@ var require_diagnostics = __commonJS({
const { const {
address: { address, port } address: { address, port }
} = evt; } = evt;
debugLog2("connection opened %s%s", address, port ? `:${port}` : ""); debugLog("connection opened %s%s", address, port ? `:${port}` : "");
} }
); );
diagnosticsChannel.subscribe( diagnosticsChannel.subscribe(
"undici:websocket:close", "undici:websocket:close",
(evt) => { (evt) => {
const { websocket, code, reason } = evt; const { websocket, code, reason } = evt;
debugLog2( debugLog(
"closed connection to %s - %s %s", "closed connection to %s - %s %s",
websocket.url, websocket.url,
code, code,
@@ -46016,19 +46016,19 @@ var require_diagnostics = __commonJS({
diagnosticsChannel.subscribe( diagnosticsChannel.subscribe(
"undici:websocket:socket_error", "undici:websocket:socket_error",
(err) => { (err) => {
debugLog2("connection errored - %s", err.message); debugLog("connection errored - %s", err.message);
} }
); );
diagnosticsChannel.subscribe( diagnosticsChannel.subscribe(
"undici:websocket:ping", "undici:websocket:ping",
(evt) => { (evt) => {
debugLog2("ping received"); debugLog("ping received");
} }
); );
diagnosticsChannel.subscribe( diagnosticsChannel.subscribe(
"undici:websocket:pong", "undici:websocket:pong",
(evt) => { (evt) => {
debugLog2("pong received"); debugLog("pong received");
} }
); );
} }
@@ -97611,7 +97611,7 @@ var require_semver2 = __commonJS({
}); });
// entry.ts // entry.ts
var core6 = __toESM(require_core(), 1); var core5 = __toESM(require_core(), 1);
// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/arrays.js // node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/arrays.js
var liftArray = (data) => Array.isArray(data) ? data : [data]; var liftArray = (data) => Array.isArray(data) ? data : [data];
@@ -102706,25 +102706,25 @@ var Protocol = class {
}); });
} }
_resetTimeout(messageId) { _resetTimeout(messageId) {
const info3 = this._timeoutInfo.get(messageId); const info2 = this._timeoutInfo.get(messageId);
if (!info3) if (!info2)
return false; return false;
const totalElapsed = Date.now() - info3.startTime; const totalElapsed = Date.now() - info2.startTime;
if (info3.maxTotalTimeout && totalElapsed >= info3.maxTotalTimeout) { if (info2.maxTotalTimeout && totalElapsed >= info2.maxTotalTimeout) {
this._timeoutInfo.delete(messageId); this._timeoutInfo.delete(messageId);
throw McpError.fromError(ErrorCode.RequestTimeout, "Maximum total timeout exceeded", { throw McpError.fromError(ErrorCode.RequestTimeout, "Maximum total timeout exceeded", {
maxTotalTimeout: info3.maxTotalTimeout, maxTotalTimeout: info2.maxTotalTimeout,
totalElapsed totalElapsed
}); });
} }
clearTimeout(info3.timeoutId); clearTimeout(info2.timeoutId);
info3.timeoutId = setTimeout(info3.onTimeout, info3.timeout); info2.timeoutId = setTimeout(info2.onTimeout, info2.timeout);
return true; return true;
} }
_cleanupTimeout(messageId) { _cleanupTimeout(messageId) {
const info3 = this._timeoutInfo.get(messageId); const info2 = this._timeoutInfo.get(messageId);
if (info3) { if (info2) {
clearTimeout(info3.timeoutId); clearTimeout(info2.timeoutId);
this._timeoutInfo.delete(messageId); this._timeoutInfo.delete(messageId);
} }
} }
@@ -123968,7 +123968,7 @@ var require_core4 = /* @__PURE__ */ __commonJSMin(((exports) => {
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const id_1 = require_id2(); const id_1 = require_id2();
const ref_1 = require_ref2(); const ref_1 = require_ref2();
const core7 = [ const core6 = [
"$schema", "$schema",
"$id", "$id",
"$defs", "$defs",
@@ -123978,7 +123978,7 @@ var require_core4 = /* @__PURE__ */ __commonJSMin(((exports) => {
id_1.default, id_1.default,
ref_1.default ref_1.default
]; ];
exports.default = core7; exports.default = core6;
})); }));
var require_limitNumber2 = /* @__PURE__ */ __commonJSMin(((exports) => { var require_limitNumber2 = /* @__PURE__ */ __commonJSMin(((exports) => {
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
@@ -135937,8 +135937,8 @@ function throttling(octokit, octokitOptions) {
"error", "error",
(e) => octokit.log.warn("Error in throttling-plugin limit handler", e) (e) => octokit.log.warn("Error in throttling-plugin limit handler", e)
); );
state.retryLimiter.on("failed", async function(error49, info3) { state.retryLimiter.on("failed", async function(error49, info2) {
const [state2, request2, options] = info3.args; const [state2, request2, options] = info2.args;
const { pathname } = new URL(options.url, "http://github.test"); const { pathname } = new URL(options.url, "http://github.test");
const shouldRetryGraphQL = pathname.startsWith("/graphql") && error49.status !== 401; const shouldRetryGraphQL = pathname.startsWith("/graphql") && error49.status !== 401;
if (!(shouldRetryGraphQL || error49.status === 403 || error49.status === 429)) { if (!(shouldRetryGraphQL || error49.status === 403 || error49.status === 429)) {
@@ -140554,16 +140554,9 @@ import { spawn as nodeSpawn } from "node:child_process";
import { performance as performance3 } from "node:perf_hooks"; import { performance as performance3 } from "node:perf_hooks";
// utils/activity.ts // utils/activity.ts
var core4 = __toESM(require_core(), 1);
import { performance as performance2 } from "node:perf_hooks"; import { performance as performance2 } from "node:perf_hooks";
var DEFAULT_ACTIVITY_TIMEOUT_MS = 6e4; var DEFAULT_ACTIVITY_TIMEOUT_MS = 6e4;
var DEFAULT_ACTIVITY_CHECK_INTERVAL_MS = 5e3; var DEFAULT_ACTIVITY_CHECK_INTERVAL_MS = 5e3;
function debugLog(msg) {
const isDebug3 = process.env.LOG_LEVEL === "debug" || process.env.ACTIONS_STEP_DEBUG === "true" || process.env.RUNNER_DEBUG === "1" || core4.isDebug();
if (isDebug3) {
core4.info(`[${(/* @__PURE__ */ new Date()).toISOString()}] [DEBUG] ${msg}`);
}
}
var _lastActivity = performance2.now(); var _lastActivity = performance2.now();
function markActivity() { function markActivity() {
_lastActivity = performance2.now(); _lastActivity = performance2.now();
@@ -140587,10 +140580,10 @@ function startProcessOutputMonitor(ctx) {
const originalStderrWrite = process.stderr.write.bind(process.stderr); const originalStderrWrite = process.stderr.write.bind(process.stderr);
process.stdout.write = wrapWrite(originalStdoutWrite, markActivity); process.stdout.write = wrapWrite(originalStdoutWrite, markActivity);
process.stderr.write = wrapWrite(originalStderrWrite, markActivity); process.stderr.write = wrapWrite(originalStderrWrite, markActivity);
debugLog(`process activity monitor started: timeout=${ctx.timeoutMs}ms`); log.debug(`process activity monitor started: timeout=${ctx.timeoutMs}ms`);
const intervalId = setInterval(() => { const intervalId = setInterval(() => {
const idleMs = getIdleMs(); const idleMs = getIdleMs();
debugLog(`process activity check: idle=${idleMs}ms / ${ctx.timeoutMs}ms`); log.debug(`process activity check: idle=${idleMs}ms / ${ctx.timeoutMs}ms`);
if (timedOut || idleMs <= ctx.timeoutMs) return; if (timedOut || idleMs <= ctx.timeoutMs) return;
timedOut = true; timedOut = true;
ctx.onTimeout(idleMs); ctx.onTimeout(idleMs);
@@ -146566,7 +146559,7 @@ function normalizeEnv() {
} }
// utils/payload.ts // utils/payload.ts
var core5 = __toESM(require_core(), 1); var core4 = __toESM(require_core(), 1);
import { isAbsolute, resolve as resolve2 } from "node:path"; import { isAbsolute, resolve as resolve2 } from "node:path";
// utils/versioning.ts // utils/versioning.ts
@@ -146633,7 +146626,7 @@ function resolveCwd(cwd) {
return workspace ? resolve2(workspace, cwd) : cwd; return workspace ? resolve2(workspace, cwd) : cwd;
} }
function resolvePromptInput() { function resolvePromptInput() {
const prompt = core5.getInput("prompt", { required: true }); const prompt = core4.getInput("prompt", { required: true });
let parsed2; let parsed2;
try { try {
parsed2 = JSON.parse(prompt); parsed2 = JSON.parse(prompt);
@@ -146649,14 +146642,14 @@ function resolvePromptInput() {
} }
function resolveNonPromptInputs() { function resolveNonPromptInputs() {
return Inputs.omit("prompt").assert({ return Inputs.omit("prompt").assert({
effort: core5.getInput("effort") || void 0, effort: core4.getInput("effort") || void 0,
timeout: core5.getInput("timeout") || void 0, timeout: core4.getInput("timeout") || void 0,
agent: core5.getInput("agent") || void 0, agent: core4.getInput("agent") || void 0,
cwd: core5.getInput("cwd") || void 0, cwd: core4.getInput("cwd") || void 0,
web: core5.getInput("web") || void 0, web: core4.getInput("web") || void 0,
search: core5.getInput("search") || void 0, search: core4.getInput("search") || void 0,
push: core5.getInput("push") || void 0, push: core4.getInput("push") || void 0,
bash: core5.getInput("bash") || void 0 bash: core4.getInput("bash") || void 0
}); });
} }
function resolvePayload(resolvedPromptInput, repoSettings) { function resolvePayload(resolvedPromptInput, repoSettings) {
@@ -147100,11 +147093,11 @@ async function run() {
throw new Error(result.error || "Agent execution failed"); throw new Error(result.error || "Agent execution failed");
} }
if (result.result) { if (result.result) {
core6.setOutput("result", result.result); core5.setOutput("result", result.result);
} }
} catch (error49) { } catch (error49) {
const errorMessage = error49 instanceof Error ? error49.message : "Unknown error occurred"; const errorMessage = error49 instanceof Error ? error49.message : "Unknown error occurred";
core6.setFailed(`Action failed: ${errorMessage}`); core5.setFailed(`Action failed: ${errorMessage}`);
} finally { } finally {
await runCleanup(); await runCleanup();
} }
+3 -15
View File
@@ -1,21 +1,9 @@
import { performance } from "node:perf_hooks"; import { performance } from "node:perf_hooks";
import * as core from "@actions/core"; import { log } from "./log.ts";
export const DEFAULT_ACTIVITY_TIMEOUT_MS = 60_000; export const DEFAULT_ACTIVITY_TIMEOUT_MS = 60_000;
export const DEFAULT_ACTIVITY_CHECK_INTERVAL_MS = 5_000; export const DEFAULT_ACTIVITY_CHECK_INTERVAL_MS = 5_000;
// inline debug check — can't import log.ts since activity.ts is a dependency of it
function debugLog(msg: string): void {
const isDebug =
process.env.LOG_LEVEL === "debug" ||
process.env.ACTIONS_STEP_DEBUG === "true" ||
process.env.RUNNER_DEBUG === "1" ||
core.isDebug();
if (isDebug) {
core.info(`[${new Date().toISOString()}] [DEBUG] ${msg}`);
}
}
type ActivityTimeoutContext = { type ActivityTimeoutContext = {
timeoutMs: number; timeoutMs: number;
checkIntervalMs: number; checkIntervalMs: number;
@@ -85,11 +73,11 @@ function startProcessOutputMonitor(ctx: OutputMonitorContext): OutputMonitor {
process.stdout.write = wrapWrite(originalStdoutWrite, markActivity); process.stdout.write = wrapWrite(originalStdoutWrite, markActivity);
process.stderr.write = wrapWrite(originalStderrWrite, markActivity); process.stderr.write = wrapWrite(originalStderrWrite, markActivity);
debugLog(`process activity monitor started: timeout=${ctx.timeoutMs}ms`); log.debug(`process activity monitor started: timeout=${ctx.timeoutMs}ms`);
const intervalId = setInterval(() => { const intervalId = setInterval(() => {
const idleMs = getIdleMs(); const idleMs = getIdleMs();
debugLog(`process activity check: idle=${idleMs}ms / ${ctx.timeoutMs}ms`); log.debug(`process activity check: idle=${idleMs}ms / ${ctx.timeoutMs}ms`);
if (timedOut || idleMs <= ctx.timeoutMs) return; if (timedOut || idleMs <= ctx.timeoutMs) return;
timedOut = true; timedOut = true;
ctx.onTimeout(idleMs); ctx.onTimeout(idleMs);