@nowcrew/daemon 0.6.7 → 0.6.8

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.
@@ -2,7 +2,8 @@ import { fork } from "node:child_process";
2
2
  import { fileURLToPath } from "node:url";
3
3
  import { executionBackendCapability, ownsRuntimeViaJobObject } from "./execution-backend.js";
4
4
  const DEFAULT_ABORT_TIMEOUT_MS = 5_000;
5
- const DEFAULT_HANDSHAKE_TIMEOUT_MS = 5_000;
5
+ const DEFAULT_READY_HANDSHAKE_TIMEOUT_MS = 20_000;
6
+ const DEFAULT_RELEASE_HANDSHAKE_TIMEOUT_MS = 5_000;
6
7
  const DEFAULT_TASKKILL_TIMEOUT_MS = 5_000;
7
8
  const PROCESS_GROUP_POLL_MS = 10;
8
9
  function messageError(error) {
@@ -153,9 +154,17 @@ export async function startDormantSupervisor(launch, options = {}) {
153
154
  const childEntry = options.childEntry
154
155
  ?? fileURLToPath(new URL("./execution-supervisor-child.js", import.meta.url));
155
156
  const abortTimeoutMs = options.abortTimeoutMs ?? DEFAULT_ABORT_TIMEOUT_MS;
156
- const handshakeTimeoutMs = options.handshakeTimeoutMs ?? DEFAULT_HANDSHAKE_TIMEOUT_MS;
157
- if (!Number.isFinite(handshakeTimeoutMs) || handshakeTimeoutMs <= 0) {
158
- throw new RangeError("handshakeTimeoutMs must be a positive finite number");
157
+ const readyHandshakeTimeoutMs = options.readyHandshakeTimeoutMs
158
+ ?? options.handshakeTimeoutMs
159
+ ?? DEFAULT_READY_HANDSHAKE_TIMEOUT_MS;
160
+ const releaseHandshakeTimeoutMs = options.releaseHandshakeTimeoutMs
161
+ ?? options.handshakeTimeoutMs
162
+ ?? DEFAULT_RELEASE_HANDSHAKE_TIMEOUT_MS;
163
+ if (!Number.isFinite(readyHandshakeTimeoutMs) || readyHandshakeTimeoutMs <= 0) {
164
+ throw new RangeError("readyHandshakeTimeoutMs must be a positive finite number");
165
+ }
166
+ if (!Number.isFinite(releaseHandshakeTimeoutMs) || releaseHandshakeTimeoutMs <= 0) {
167
+ throw new RangeError("releaseHandshakeTimeoutMs must be a positive finite number");
159
168
  }
160
169
  const env = Object.fromEntries(Object.entries(launch.env).filter((entry) => entry[1] !== undefined));
161
170
  const child = fork(childEntry, [], {
@@ -272,7 +281,7 @@ export async function startDormantSupervisor(launch, options = {}) {
272
281
  reject(error);
273
282
  });
274
283
  });
275
- await withTimeout(ready, handshakeTimeoutMs, "ready handshake");
284
+ await withTimeout(ready, readyHandshakeTimeoutMs, "ready handshake");
276
285
  }
277
286
  catch (error) {
278
287
  await abort().catch((abortError) => {
@@ -298,7 +307,7 @@ export async function startDormantSupervisor(launch, options = {}) {
298
307
  });
299
308
  });
300
309
  try {
301
- await withTimeout(acknowledgement, handshakeTimeoutMs, "release handshake");
310
+ await withTimeout(acknowledgement, releaseHandshakeTimeoutMs, "release handshake");
302
311
  }
303
312
  catch (error) {
304
313
  await abort().catch((abortError) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nowcrew/daemon",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "type": "module",
5
5
  "description": "crew daemon — 运行在用户机器:拉起/管理 agent 进程,注入 crew CLI,归一化 runtime 事件",
6
6
  "license": "Apache-2.0",