fix: address review comments

- Use optional timeoutMs parameter (undefined = use config/default)
- Extract DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS to shared constants.ts
- Import constant in client.ts instead of hardcoding
- Re-export constant from probe.ts for backwards compatibility
This commit is contained in:
Yudong Han
2026-02-04 08:08:44 +00:00
committed by Peter Steinberger
parent 78f8a29071
commit f633a8cb22
4 changed files with 17 additions and 10 deletions

View File

@@ -2,6 +2,7 @@ import { type ChildProcessWithoutNullStreams, spawn } from "node:child_process";
import { createInterface, type Interface } from "node:readline";
import type { RuntimeEnv } from "../runtime.js";
import { resolveUserPath } from "../utils.js";
import { DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS } from "./constants.js";
export type IMessageRpcError = {
code?: number;
@@ -149,8 +150,7 @@ export class IMessageRpcClient {
params: params ?? {},
};
const line = `${JSON.stringify(payload)}\n`;
// Default timeout matches DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS from probe.ts
const timeoutMs = opts?.timeoutMs ?? 10_000;
const timeoutMs = opts?.timeoutMs ?? DEFAULT_IMESSAGE_PROBE_TIMEOUT_MS;
const response = new Promise<T>((resolve, reject) => {
const key = String(id);