nexus-agents 8.112.1 → 8.112.2

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.
Files changed (136) hide show
  1. package/dist/{ast-rule-runner-25ZAEIFB.js → ast-rule-runner-UEQO7V4Y.js} +3 -3
  2. package/dist/{child-mcp-config-7F4RU5OD.js → child-mcp-config-BYNNNVZF.js} +2 -2
  3. package/dist/{chunk-AVBP6LRJ.js → chunk-27E5O3GY.js} +2 -2
  4. package/dist/{chunk-JIRCYZKV.js → chunk-3E4J3EE6.js} +121 -84
  5. package/dist/chunk-3E4J3EE6.js.map +1 -0
  6. package/dist/{chunk-KTL4ECT6.js → chunk-3SY2GPU3.js} +2 -2
  7. package/dist/{chunk-GNUMZJU3.js → chunk-3TB6L3TE.js} +12 -12
  8. package/dist/{chunk-KWLTPADB.js → chunk-5GMUGQGF.js} +4 -4
  9. package/dist/{chunk-5SF272U4.js → chunk-5VS577SD.js} +2 -2
  10. package/dist/{chunk-LW73YKZK.js → chunk-6FC5VVDA.js} +2 -2
  11. package/dist/{chunk-RMW44CFE.js → chunk-6RYPMOR6.js} +8 -8
  12. package/dist/{chunk-YOCB6CLS.js → chunk-76XX7NPA.js} +2 -2
  13. package/dist/{chunk-6XDACH6N.js → chunk-7JKUA5X6.js} +4 -4
  14. package/dist/{chunk-PXUEZBT6.js → chunk-CD2O5QRG.js} +11 -11
  15. package/dist/{chunk-SDMXHEQA.js → chunk-CZ7EPWIJ.js} +2 -2
  16. package/dist/{chunk-6DANKFL6.js → chunk-DARVXIKJ.js} +2 -2
  17. package/dist/{chunk-AQ3Q2HSV.js → chunk-DAWGZNLK.js} +2 -2
  18. package/dist/{chunk-XYEAG73N.js → chunk-DAYX7FLQ.js} +3 -3
  19. package/dist/{chunk-FC5TYN5K.js → chunk-EIDH64P4.js} +5 -5
  20. package/dist/{chunk-QXAMYEGJ.js → chunk-GFNUYOCY.js} +2 -2
  21. package/dist/{chunk-HSD6QCYP.js → chunk-HEBQA4E4.js} +2 -2
  22. package/dist/{chunk-57E2DYJV.js → chunk-I2FZPV7P.js} +2 -2
  23. package/dist/{chunk-OUZOYB2X.js → chunk-JLOW2KAD.js} +5 -5
  24. package/dist/{chunk-LNS7WJLN.js → chunk-KUB3MGWF.js} +5 -5
  25. package/dist/{chunk-6LMHK463.js → chunk-LLG4XR6P.js} +5 -5
  26. package/dist/{chunk-MYLNLZDK.js → chunk-LYZ2OXI7.js} +2 -2
  27. package/dist/{chunk-FVH4SGTU.js → chunk-M72V2I3F.js} +2 -2
  28. package/dist/{chunk-HLXZRQ7J.js → chunk-N67DGBPZ.js} +2 -2
  29. package/dist/{chunk-U4WWPCDB.js → chunk-NL2IL32T.js} +43 -43
  30. package/dist/{chunk-U4WWPCDB.js.map → chunk-NL2IL32T.js.map} +1 -1
  31. package/dist/{chunk-CNUWYMHT.js → chunk-NXCO6Z7O.js} +3 -3
  32. package/dist/{chunk-OMMG2B3Y.js → chunk-P7ZL3KD6.js} +2 -2
  33. package/dist/{chunk-JQ2BP4UG.js → chunk-QDDTFVW7.js} +2 -2
  34. package/dist/{chunk-PLA7Y4E3.js → chunk-RLSKNDO5.js} +4 -4
  35. package/dist/{chunk-M7CTY6OI.js → chunk-TTPAWUHT.js} +2 -2
  36. package/dist/{chunk-UDKB6OMP.js → chunk-X3VNURAA.js} +3 -3
  37. package/dist/{chunk-2ZGG2AHM.js → chunk-Y4ZLHASZ.js} +3 -3
  38. package/dist/{chunk-RRQU3SCH.js → chunk-YBRWJBHN.js} +2 -2
  39. package/dist/{chunk-5IXQGJDZ.js → chunk-YZMSYPAU.js} +5 -5
  40. package/dist/{chunk-A5AWEWO2.js → chunk-ZWXZY3Z7.js} +2 -2
  41. package/dist/{cli-circuit-breaker-OCWIFUFZ.js → cli-circuit-breaker-KR72NLMQ.js} +3 -3
  42. package/dist/cli.js +53 -49
  43. package/dist/cli.js.map +1 -1
  44. package/dist/{composite-router-AWYGCGCJ.js → composite-router-OEN6DCPK.js} +2 -2
  45. package/dist/{consensus-vote-UBWKTWLU.js → consensus-vote-VD74QW5N.js} +18 -18
  46. package/dist/{context-retriever-MIRNKOXC.js → context-retriever-7VBZZG3I.js} +8 -8
  47. package/dist/{doctor-deep-4XSPQEBZ.js → doctor-deep-JPICT7QB.js} +3 -3
  48. package/dist/doctor-gateway-report-MZY47ZZV.js +17 -0
  49. package/dist/{doctor-live-27BLS5IK.js → doctor-live-AF4XP5WY.js} +11 -11
  50. package/dist/{expert-bridge-COH6EWOV.js → expert-bridge-MPMDMGCC.js} +5 -5
  51. package/dist/{factory-N32FIFJY.js → factory-2Z7GFPKY.js} +5 -5
  52. package/dist/{factory-K4GVINFH.js → factory-ZGYUWL2O.js} +10 -10
  53. package/dist/{improvement-review-2RLXA5P5.js → improvement-review-UA6OJTZ6.js} +6 -6
  54. package/dist/index.d.ts +7 -7
  55. package/dist/index.js +33 -33
  56. package/dist/{init-opencode-M23JFYAR.js → init-opencode-FYYFCXHB.js} +6 -6
  57. package/dist/{issue-triage-6PRRBXVA.js → issue-triage-FOOCSNNK.js} +6 -6
  58. package/dist/{openai-compat-adapter-K74XCJ3M.js → openai-compat-adapter-YAWAN7MX.js} +6 -6
  59. package/dist/{pr-reviewer-helpers-G5MFCGEV.js → pr-reviewer-helpers-J737NDAT.js} +4 -4
  60. package/dist/{registry-command-NSMBHR2Y.js → registry-command-OQ4SLR6K.js} +2 -2
  61. package/dist/{repo-security-plan-TFSNTIZU.js → repo-security-plan-ZNKV7LPR.js} +3 -3
  62. package/dist/{research-helpers-synthesize-F7CLSKTZ.js → research-helpers-synthesize-7RBYSNPH.js} +4 -4
  63. package/dist/{routing-memory-C6Q4I7AR.js → routing-memory-AFLU42CD.js} +2 -2
  64. package/dist/{session-memory-AAISW3XF.js → session-memory-22AVU7MG.js} +3 -3
  65. package/dist/{setup-config-6GERVWAQ.js → setup-config-KVH4TQN7.js} +3 -3
  66. package/dist/{setup-custom-api-GGLJZIQ4.js → setup-custom-api-2ZHJT7BL.js} +4 -4
  67. package/dist/setup-data-dir-YZ3VVOT2.js +34 -0
  68. package/dist/{tool-memory-PRF4BY3S.js → tool-memory-WSCOQQS2.js} +5 -5
  69. package/dist/{unified-registry-Q4MUGDXL.js → unified-registry-RBENDRS4.js} +12 -12
  70. package/dist/{weather-report-XHZN5NLK.js → weather-report-EGG35WEB.js} +2 -2
  71. package/package.json +1 -1
  72. package/dist/chunk-JIRCYZKV.js.map +0 -1
  73. package/dist/doctor-gateway-report-RPT3KK42.js +0 -17
  74. package/dist/setup-data-dir-FLDIBMNW.js +0 -34
  75. /package/dist/{ast-rule-runner-25ZAEIFB.js.map → ast-rule-runner-UEQO7V4Y.js.map} +0 -0
  76. /package/dist/{child-mcp-config-7F4RU5OD.js.map → child-mcp-config-BYNNNVZF.js.map} +0 -0
  77. /package/dist/{chunk-AVBP6LRJ.js.map → chunk-27E5O3GY.js.map} +0 -0
  78. /package/dist/{chunk-KTL4ECT6.js.map → chunk-3SY2GPU3.js.map} +0 -0
  79. /package/dist/{chunk-GNUMZJU3.js.map → chunk-3TB6L3TE.js.map} +0 -0
  80. /package/dist/{chunk-KWLTPADB.js.map → chunk-5GMUGQGF.js.map} +0 -0
  81. /package/dist/{chunk-5SF272U4.js.map → chunk-5VS577SD.js.map} +0 -0
  82. /package/dist/{chunk-LW73YKZK.js.map → chunk-6FC5VVDA.js.map} +0 -0
  83. /package/dist/{chunk-RMW44CFE.js.map → chunk-6RYPMOR6.js.map} +0 -0
  84. /package/dist/{chunk-YOCB6CLS.js.map → chunk-76XX7NPA.js.map} +0 -0
  85. /package/dist/{chunk-6XDACH6N.js.map → chunk-7JKUA5X6.js.map} +0 -0
  86. /package/dist/{chunk-PXUEZBT6.js.map → chunk-CD2O5QRG.js.map} +0 -0
  87. /package/dist/{chunk-SDMXHEQA.js.map → chunk-CZ7EPWIJ.js.map} +0 -0
  88. /package/dist/{chunk-6DANKFL6.js.map → chunk-DARVXIKJ.js.map} +0 -0
  89. /package/dist/{chunk-AQ3Q2HSV.js.map → chunk-DAWGZNLK.js.map} +0 -0
  90. /package/dist/{chunk-XYEAG73N.js.map → chunk-DAYX7FLQ.js.map} +0 -0
  91. /package/dist/{chunk-FC5TYN5K.js.map → chunk-EIDH64P4.js.map} +0 -0
  92. /package/dist/{chunk-QXAMYEGJ.js.map → chunk-GFNUYOCY.js.map} +0 -0
  93. /package/dist/{chunk-HSD6QCYP.js.map → chunk-HEBQA4E4.js.map} +0 -0
  94. /package/dist/{chunk-57E2DYJV.js.map → chunk-I2FZPV7P.js.map} +0 -0
  95. /package/dist/{chunk-OUZOYB2X.js.map → chunk-JLOW2KAD.js.map} +0 -0
  96. /package/dist/{chunk-LNS7WJLN.js.map → chunk-KUB3MGWF.js.map} +0 -0
  97. /package/dist/{chunk-6LMHK463.js.map → chunk-LLG4XR6P.js.map} +0 -0
  98. /package/dist/{chunk-MYLNLZDK.js.map → chunk-LYZ2OXI7.js.map} +0 -0
  99. /package/dist/{chunk-FVH4SGTU.js.map → chunk-M72V2I3F.js.map} +0 -0
  100. /package/dist/{chunk-HLXZRQ7J.js.map → chunk-N67DGBPZ.js.map} +0 -0
  101. /package/dist/{chunk-CNUWYMHT.js.map → chunk-NXCO6Z7O.js.map} +0 -0
  102. /package/dist/{chunk-OMMG2B3Y.js.map → chunk-P7ZL3KD6.js.map} +0 -0
  103. /package/dist/{chunk-JQ2BP4UG.js.map → chunk-QDDTFVW7.js.map} +0 -0
  104. /package/dist/{chunk-PLA7Y4E3.js.map → chunk-RLSKNDO5.js.map} +0 -0
  105. /package/dist/{chunk-M7CTY6OI.js.map → chunk-TTPAWUHT.js.map} +0 -0
  106. /package/dist/{chunk-UDKB6OMP.js.map → chunk-X3VNURAA.js.map} +0 -0
  107. /package/dist/{chunk-2ZGG2AHM.js.map → chunk-Y4ZLHASZ.js.map} +0 -0
  108. /package/dist/{chunk-RRQU3SCH.js.map → chunk-YBRWJBHN.js.map} +0 -0
  109. /package/dist/{chunk-5IXQGJDZ.js.map → chunk-YZMSYPAU.js.map} +0 -0
  110. /package/dist/{chunk-A5AWEWO2.js.map → chunk-ZWXZY3Z7.js.map} +0 -0
  111. /package/dist/{cli-circuit-breaker-OCWIFUFZ.js.map → cli-circuit-breaker-KR72NLMQ.js.map} +0 -0
  112. /package/dist/{composite-router-AWYGCGCJ.js.map → composite-router-OEN6DCPK.js.map} +0 -0
  113. /package/dist/{consensus-vote-UBWKTWLU.js.map → consensus-vote-VD74QW5N.js.map} +0 -0
  114. /package/dist/{context-retriever-MIRNKOXC.js.map → context-retriever-7VBZZG3I.js.map} +0 -0
  115. /package/dist/{doctor-deep-4XSPQEBZ.js.map → doctor-deep-JPICT7QB.js.map} +0 -0
  116. /package/dist/{doctor-gateway-report-RPT3KK42.js.map → doctor-gateway-report-MZY47ZZV.js.map} +0 -0
  117. /package/dist/{doctor-live-27BLS5IK.js.map → doctor-live-AF4XP5WY.js.map} +0 -0
  118. /package/dist/{expert-bridge-COH6EWOV.js.map → expert-bridge-MPMDMGCC.js.map} +0 -0
  119. /package/dist/{factory-K4GVINFH.js.map → factory-2Z7GFPKY.js.map} +0 -0
  120. /package/dist/{factory-N32FIFJY.js.map → factory-ZGYUWL2O.js.map} +0 -0
  121. /package/dist/{improvement-review-2RLXA5P5.js.map → improvement-review-UA6OJTZ6.js.map} +0 -0
  122. /package/dist/{init-opencode-M23JFYAR.js.map → init-opencode-FYYFCXHB.js.map} +0 -0
  123. /package/dist/{issue-triage-6PRRBXVA.js.map → issue-triage-FOOCSNNK.js.map} +0 -0
  124. /package/dist/{openai-compat-adapter-K74XCJ3M.js.map → openai-compat-adapter-YAWAN7MX.js.map} +0 -0
  125. /package/dist/{pr-reviewer-helpers-G5MFCGEV.js.map → pr-reviewer-helpers-J737NDAT.js.map} +0 -0
  126. /package/dist/{registry-command-NSMBHR2Y.js.map → registry-command-OQ4SLR6K.js.map} +0 -0
  127. /package/dist/{repo-security-plan-TFSNTIZU.js.map → repo-security-plan-ZNKV7LPR.js.map} +0 -0
  128. /package/dist/{research-helpers-synthesize-F7CLSKTZ.js.map → research-helpers-synthesize-7RBYSNPH.js.map} +0 -0
  129. /package/dist/{routing-memory-C6Q4I7AR.js.map → routing-memory-AFLU42CD.js.map} +0 -0
  130. /package/dist/{session-memory-AAISW3XF.js.map → session-memory-22AVU7MG.js.map} +0 -0
  131. /package/dist/{setup-config-6GERVWAQ.js.map → setup-config-KVH4TQN7.js.map} +0 -0
  132. /package/dist/{setup-custom-api-GGLJZIQ4.js.map → setup-custom-api-2ZHJT7BL.js.map} +0 -0
  133. /package/dist/{setup-data-dir-FLDIBMNW.js.map → setup-data-dir-YZ3VVOT2.js.map} +0 -0
  134. /package/dist/{tool-memory-PRF4BY3S.js.map → tool-memory-WSCOQQS2.js.map} +0 -0
  135. /package/dist/{unified-registry-Q4MUGDXL.js.map → unified-registry-RBENDRS4.js.map} +0 -0
  136. /package/dist/{weather-report-XHZN5NLK.js.map → weather-report-EGG35WEB.js.map} +0 -0
@@ -9,9 +9,9 @@ import {
9
9
  getBuiltInAstRulesPath,
10
10
  loadRules,
11
11
  runAstQaRules
12
- } from "./chunk-AQ3Q2HSV.js";
12
+ } from "./chunk-DAWGZNLK.js";
13
13
  import "./chunk-XEPZSDN5.js";
14
- import "./chunk-2ZGG2AHM.js";
14
+ import "./chunk-Y4ZLHASZ.js";
15
15
  import "./chunk-UE7A2XHM.js";
16
16
  import "./chunk-LWOX65CP.js";
17
17
  import "./chunk-PX6F3LHL.js";
@@ -27,4 +27,4 @@ export {
27
27
  loadRules,
28
28
  runAstQaRules
29
29
  };
30
- //# sourceMappingURL=ast-rule-runner-25ZAEIFB.js.map
30
+ //# sourceMappingURL=ast-rule-runner-UEQO7V4Y.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-OITVVSWO.js";
4
4
  import {
5
5
  createLogger
6
- } from "./chunk-2ZGG2AHM.js";
6
+ } from "./chunk-Y4ZLHASZ.js";
7
7
  import "./chunk-UE7A2XHM.js";
8
8
  import "./chunk-LWOX65CP.js";
9
9
  import "./chunk-PX6F3LHL.js";
@@ -47,4 +47,4 @@ async function generateMcpConfig(options) {
47
47
  export {
48
48
  generateMcpConfig
49
49
  };
50
- //# sourceMappingURL=child-mcp-config-7F4RU5OD.js.map
50
+ //# sourceMappingURL=child-mcp-config-BYNNNVZF.js.map
@@ -7,7 +7,7 @@ import {
7
7
  CACHE_TIMEOUTS,
8
8
  createLogger,
9
9
  getTimeProvider
10
- } from "./chunk-2ZGG2AHM.js";
10
+ } from "./chunk-Y4ZLHASZ.js";
11
11
 
12
12
  // src/security/input-sanitizer.ts
13
13
  var DANGEROUS_HTML_PATTERN = /<(picture|source|img)\b[^>]*>[\s\S]*?<\/\1>|<(picture|source|img)\b[^>]*\/?>/gi;
@@ -509,4 +509,4 @@ export {
509
509
  resolveReputationGatingMode,
510
510
  gateWithReputation
511
511
  };
512
- //# sourceMappingURL=chunk-AVBP6LRJ.js.map
512
+ //# sourceMappingURL=chunk-27E5O3GY.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CUSTOM_API_DEFAULT_MODEL
3
- } from "./chunk-SDMXHEQA.js";
3
+ } from "./chunk-CZ7EPWIJ.js";
4
4
  import {
5
5
  AdapterModelError,
6
6
  BaseAdapter,
@@ -10,7 +10,7 @@ import {
10
10
  readGatewayTransport,
11
11
  requireApiKey,
12
12
  validateApiKeyPresence
13
- } from "./chunk-LW73YKZK.js";
13
+ } from "./chunk-6FC5VVDA.js";
14
14
  import {
15
15
  assertCustomApiHostResolvesPublic,
16
16
  hostnameOf,
@@ -19,28 +19,28 @@ import {
19
19
  readGatewayEnv,
20
20
  redactApiKey,
21
21
  validateCustomApiBaseUrl
22
- } from "./chunk-RRQU3SCH.js";
22
+ } from "./chunk-YBRWJBHN.js";
23
23
  import {
24
24
  sanitizeOutput
25
- } from "./chunk-HSD6QCYP.js";
25
+ } from "./chunk-HEBQA4E4.js";
26
26
  import {
27
27
  nexusMkdtempSync
28
28
  } from "./chunk-OITVVSWO.js";
29
29
  import {
30
30
  getAvailabilityCache
31
- } from "./chunk-KTL4ECT6.js";
31
+ } from "./chunk-3SY2GPU3.js";
32
32
  import {
33
33
  extractSystemPrompt
34
34
  } from "./chunk-QZUG667L.js";
35
35
  import {
36
36
  generateHyphenId
37
- } from "./chunk-A5AWEWO2.js";
37
+ } from "./chunk-ZWXZY3Z7.js";
38
38
  import {
39
39
  CliCircuitBreaker,
40
40
  DEFAULT_CIRCUIT_BREAKER_CONFIG,
41
41
  getCliCircuitBreakerSnapshot,
42
42
  getDefaultCliCircuitBreakerRegistry
43
- } from "./chunk-QXAMYEGJ.js";
43
+ } from "./chunk-GFNUYOCY.js";
44
44
  import {
45
45
  CLI_NAMES,
46
46
  CLI_SUBPROCESS_TIMEOUTS,
@@ -106,7 +106,7 @@ import {
106
106
  resolveRetryAfterMs,
107
107
  toModelTokenUsage,
108
108
  warnIfGatewayCostUndeclared
109
- } from "./chunk-2ZGG2AHM.js";
109
+ } from "./chunk-Y4ZLHASZ.js";
110
110
  import {
111
111
  parseBoolValue
112
112
  } from "./chunk-LWOX65CP.js";
@@ -2203,7 +2203,7 @@ function stampNoRelaunch(cliName, childEnv) {
2203
2203
  }
2204
2204
 
2205
2205
  // src/cli-adapters/process-tree-kill.ts
2206
- import { execFileSync } from "node:child_process";
2206
+ import { execFile, execFileSync } from "node:child_process";
2207
2207
  import { readdirSync, readFileSync as readFileSync2 } from "node:fs";
2208
2208
 
2209
2209
  // src/cli-adapters/proc-start-time.ts
@@ -2227,6 +2227,8 @@ function readProcStartTime(pid) {
2227
2227
 
2228
2228
  // src/cli-adapters/process-tree-kill.ts
2229
2229
  var MAX_DESCENDANTS = 1e3;
2230
+ var PS_ARGS = ["-A", "-o", "pid=,ppid="];
2231
+ var PS_TIMEOUT_MS = 2e3;
2230
2232
  function isSpawnedProcess(child) {
2231
2233
  return typeof child.pid === "number" && typeof child.spawnfile === "string" && Array.isArray(child.spawnargs);
2232
2234
  }
@@ -2246,30 +2248,36 @@ function procChildren(pid) {
2246
2248
  return void 0;
2247
2249
  }
2248
2250
  }
2249
- function psChildMap() {
2251
+ function parsePsChildMap(out) {
2252
+ const map = /* @__PURE__ */ new Map();
2253
+ for (const line of out.split("\n")) {
2254
+ const [pidText, ppidText] = line.trim().split(/\s+/);
2255
+ const pid = Number(pidText);
2256
+ const ppid = Number(ppidText);
2257
+ if (!Number.isInteger(pid) || !Number.isInteger(ppid)) continue;
2258
+ map.set(ppid, [...map.get(ppid) ?? [], pid]);
2259
+ }
2260
+ return map;
2261
+ }
2262
+ function psChildMapSync() {
2250
2263
  if (process.platform === "win32") return void 0;
2251
2264
  try {
2252
- const out = execFileSync("ps", ["-A", "-o", "pid=,ppid="], {
2253
- encoding: "utf8",
2254
- timeout: 2e3
2255
- });
2256
- const map = /* @__PURE__ */ new Map();
2257
- for (const line of out.split("\n")) {
2258
- const [pidText, ppidText] = line.trim().split(/\s+/);
2259
- const pid = Number(pidText);
2260
- const ppid = Number(ppidText);
2261
- if (!Number.isInteger(pid) || !Number.isInteger(ppid)) continue;
2262
- map.set(ppid, [...map.get(ppid) ?? [], pid]);
2263
- }
2264
- return map;
2265
+ return parsePsChildMap(
2266
+ execFileSync("ps", PS_ARGS, { encoding: "utf8", timeout: PS_TIMEOUT_MS })
2267
+ );
2265
2268
  } catch {
2266
2269
  return void 0;
2267
2270
  }
2268
2271
  }
2269
- function collectDescendants(root) {
2270
- const useProc = process.platform === "linux" && procChildren(root) !== void 0;
2271
- const psMap = useProc ? void 0 : psChildMap();
2272
- const childrenOf = (pid) => (useProc ? procChildren(pid) : psMap?.get(pid)) ?? [];
2272
+ function psChildMapAsync() {
2273
+ if (process.platform === "win32") return Promise.resolve(void 0);
2274
+ return new Promise((resolve) => {
2275
+ execFile("ps", PS_ARGS, { encoding: "utf8", timeout: PS_TIMEOUT_MS }, (error, stdout) => {
2276
+ resolve(error === null ? parsePsChildMap(stdout) : void 0);
2277
+ });
2278
+ });
2279
+ }
2280
+ function walkDescendants(root, childrenOf) {
2273
2281
  const seen = /* @__PURE__ */ new Set([root]);
2274
2282
  const out = [];
2275
2283
  const queue = [root];
@@ -2284,6 +2292,15 @@ function collectDescendants(root) {
2284
2292
  }
2285
2293
  return out;
2286
2294
  }
2295
+ function collectDescendants(root) {
2296
+ const useProc = process.platform === "linux" && procChildren(root) !== void 0;
2297
+ const psMap = useProc ? void 0 : psChildMapSync();
2298
+ return walkDescendants(root, (pid) => (useProc ? procChildren(pid) : psMap?.get(pid)) ?? []);
2299
+ }
2300
+ async function collectDescendantsAsync(root) {
2301
+ const psMap = await psChildMapAsync();
2302
+ return walkDescendants(root, (pid) => psMap?.get(pid) ?? []);
2303
+ }
2287
2304
  function isPidAlive(pid) {
2288
2305
  try {
2289
2306
  process.kill(pid, 0);
@@ -2294,6 +2311,7 @@ function isPidAlive(pid) {
2294
2311
  }
2295
2312
  var defaultOps = {
2296
2313
  collectDescendants,
2314
+ collectDescendantsAsync: process.platform === "linux" ? void 0 : collectDescendantsAsync,
2297
2315
  hasStartTimes: process.platform === "linux",
2298
2316
  readStartTime: readProcStartTime,
2299
2317
  isPidAlive,
@@ -2326,10 +2344,10 @@ function hasExited(child) {
2326
2344
  }
2327
2345
  var liveTrees = /* @__PURE__ */ new Map();
2328
2346
  var exitHookInstalled = false;
2329
- function signalProcessTree(child, signal, known, ops = defaultOps) {
2330
- const pid = child.pid;
2331
- const walk = isSpawnedProcess(child) && pid !== void 0 && !hasExited(child);
2332
- const fresh = walk ? identify(ops.collectDescendants(pid), ops) : [];
2347
+ function walkablePid(child) {
2348
+ return isSpawnedProcess(child) && !hasExited(child) ? child.pid : void 0;
2349
+ }
2350
+ function signalCollected(child, signal, known, fresh, ops) {
2333
2351
  const candidates = uniqueByPid([...known, ...liveTrees.get(child) ?? [], ...fresh]);
2334
2352
  child.kill(signal);
2335
2353
  const tree = candidates.filter((entry) => isSameProcess(entry, ops));
@@ -2342,6 +2360,26 @@ function signalProcessTree(child, signal, known, ops = defaultOps) {
2342
2360
  if (liveTrees.has(child)) liveTrees.set(child, tree);
2343
2361
  return tree;
2344
2362
  }
2363
+ function signalProcessTree(child, signal, known, ops = defaultOps) {
2364
+ const pid = walkablePid(child);
2365
+ const fresh = pid === void 0 ? [] : identify(ops.collectDescendants(pid), ops);
2366
+ return signalCollected(child, signal, known, fresh, ops);
2367
+ }
2368
+ function signalProcessTreeSoon(child, signal, known, ops) {
2369
+ const pid = walkablePid(child);
2370
+ const collectAsync = ops.collectDescendantsAsync;
2371
+ if (pid === void 0 || collectAsync === void 0) {
2372
+ return signalProcessTree(child, signal, known, ops);
2373
+ }
2374
+ return collectAsync(pid).then(
2375
+ (pids) => {
2376
+ const fresh = hasExited(child) ? [] : identify(pids, ops);
2377
+ return signalCollected(child, signal, known, fresh, ops);
2378
+ },
2379
+ // A failed walk must not leave the child unsignalled or reject into a `void`.
2380
+ () => signalCollected(child, signal, known, [], ops)
2381
+ );
2382
+ }
2345
2383
  function isProcessTreeAlive(child, tree, ops = defaultOps) {
2346
2384
  if (!hasExited(child)) return true;
2347
2385
  return tree.some((entry) => isSameProcess(entry, ops));
@@ -2379,21 +2417,33 @@ function signalTrackedProcessTrees(signal, ops = defaultOps) {
2379
2417
  }
2380
2418
  return count;
2381
2419
  }
2420
+ async function signalTrackedProcessTreesAsync(signal, ops = defaultOps) {
2421
+ pruneFinishedTrees(ops);
2422
+ const trees = [...liveTrees];
2423
+ await Promise.all(
2424
+ trees.map(([child, known]) => Promise.resolve(signalProcessTreeSoon(child, signal, known, ops)))
2425
+ );
2426
+ return trees.length;
2427
+ }
2382
2428
  var SIGKILL_GRACE_MS = 5e3;
2383
- function terminateProcessTree(child, graceMs = SIGKILL_GRACE_MS, onEscalate) {
2384
- const tree = signalProcessTree(child, "SIGTERM", []);
2385
- const timer = setTimeout(() => {
2386
- if (!isProcessTreeAlive(child, tree)) return;
2387
- onEscalate?.();
2388
- signalProcessTree(child, "SIGKILL", tree);
2389
- }, graceMs);
2390
- timer.unref();
2391
- if (tree.length === 0) {
2392
- child.once("close", () => {
2393
- clearTimeout(timer);
2394
- });
2395
- }
2396
- return tree;
2429
+ function terminateProcessTree(child, graceMs = SIGKILL_GRACE_MS, onEscalate, ops = defaultOps) {
2430
+ const armEscalation = (tree) => {
2431
+ const timer = setTimeout(() => {
2432
+ if (!isProcessTreeAlive(child, tree, ops)) return;
2433
+ onEscalate?.();
2434
+ void signalProcessTreeSoon(child, "SIGKILL", tree, ops);
2435
+ }, graceMs);
2436
+ timer.unref();
2437
+ if (tree.length === 0) {
2438
+ child.once("close", () => {
2439
+ clearTimeout(timer);
2440
+ });
2441
+ }
2442
+ return tree;
2443
+ };
2444
+ const signalled = signalProcessTreeSoon(child, "SIGTERM", [], ops);
2445
+ if (Array.isArray(signalled)) return Promise.resolve(armEscalation(signalled));
2446
+ return signalled.then(armEscalation);
2397
2447
  }
2398
2448
 
2399
2449
  // src/cli-adapters/subprocess-adapter.ts
@@ -2549,7 +2599,7 @@ var SubprocessCliAdapter = class extends BaseCliAdapter {
2549
2599
  attachAbortSignal(child, signal, resolve) {
2550
2600
  const onAbort = () => {
2551
2601
  if (child.exitCode === null && child.signalCode === null) {
2552
- terminateProcessTree(child, SIGKILL_GRACE_MS, () => {
2602
+ void terminateProcessTree(child, SIGKILL_GRACE_MS, () => {
2553
2603
  this.logger.warn("Child ignored SIGTERM after abort, escalating to SIGKILL", {
2554
2604
  cli: this.name,
2555
2605
  sigkillGraceMs: SIGKILL_GRACE_MS
@@ -2707,17 +2757,14 @@ var SubprocessCliAdapter = class extends BaseCliAdapter {
2707
2757
  child.on("error", (error) => {
2708
2758
  resolveOnce(this.handleSubprocessError(error));
2709
2759
  });
2710
- const timers = this.scheduleTimeoutWithSigkillEscalation({
2760
+ const timeoutId = this.scheduleTimeoutWithSigkillEscalation({
2711
2761
  child,
2712
2762
  timeoutMs,
2713
2763
  requestId,
2714
2764
  resolveOnce
2715
2765
  });
2716
2766
  child.on("close", (code) => {
2717
- clearTimeout(timers.timeoutId);
2718
- if (timers.sigkillTimerId !== void 0 && timers.tree.length === 0) {
2719
- clearTimeout(timers.sigkillTimerId);
2720
- }
2767
+ clearTimeout(timeoutId);
2721
2768
  this.logTimingBreakdown(state, startTime, code, requestId);
2722
2769
  resolveOnce(this.classifyCloseResult(code, state, startTime));
2723
2770
  });
@@ -2727,37 +2774,27 @@ var SubprocessCliAdapter = class extends BaseCliAdapter {
2727
2774
  * Schedules the SIGTERM-on-timeout + SIGKILL-on-grace escalation
2728
2775
  * (#3026 finding 1).
2729
2776
  *
2730
- * The primary timer fires SIGTERM and resolves the caller's promise
2777
+ * The timer SIGTERMs the tree and resolves the caller's promise
2731
2778
  * immediately so it doesn't wait on a hung child. The escalation
2732
- * timer (`SIGKILL_GRACE_MS` later) checks whether the child actually
2733
- * exited and force-reaps it with SIGKILL if not — preventing
2734
- * zombie accumulation when a child ignores SIGTERM (Node CLIs that
2735
- * install graceful-shutdown handlers can hang on a broken stream).
2736
- * Both timers are cleared from the `'close'` handler so a child
2737
- * that exits within the grace window doesn't see the second signal.
2779
+ * (`SIGKILL_GRACE_MS` later, in {@link terminateProcessTree}) checks
2780
+ * whether the tree actually exited and force-reaps it with SIGKILL if
2781
+ * not — preventing zombie accumulation when a child ignores SIGTERM
2782
+ * (Node CLIs that install graceful-shutdown handlers can hang on a broken
2783
+ * stream). Off Linux the descendants are collected by an async `ps`
2784
+ * first (#6718). Returns the timeout timer, for the `'close'` handler.
2738
2785
  */
2739
2786
  scheduleTimeoutWithSigkillEscalation(opts) {
2740
2787
  const { child, timeoutMs, requestId, resolveOnce } = opts;
2741
- const timers = {
2742
- tree: [],
2743
- timeoutId: setTimeout(() => {
2744
- timers.tree = signalProcessTree(child, "SIGTERM", []);
2745
- resolveOnce(err(this.createError("TIMEOUT", "Execution timed out")));
2746
- timers.sigkillTimerId = setTimeout(() => {
2747
- if (isProcessTreeAlive(child, timers.tree)) {
2748
- this.logger.warn("Child ignored SIGTERM, escalating to SIGKILL", {
2749
- cli: this.name,
2750
- requestId,
2751
- sigkillGraceMs: SIGKILL_GRACE_MS
2752
- });
2753
- signalProcessTree(child, "SIGKILL", timers.tree);
2754
- }
2755
- }, SIGKILL_GRACE_MS);
2756
- timers.sigkillTimerId.unref();
2757
- }, timeoutMs),
2758
- sigkillTimerId: void 0
2759
- };
2760
- return timers;
2788
+ return setTimeout(() => {
2789
+ void terminateProcessTree(child, SIGKILL_GRACE_MS, () => {
2790
+ this.logger.warn("Child ignored SIGTERM, escalating to SIGKILL", {
2791
+ cli: this.name,
2792
+ requestId,
2793
+ sigkillGraceMs: SIGKILL_GRACE_MS
2794
+ });
2795
+ });
2796
+ resolveOnce(err(this.createError("TIMEOUT", "Execution timed out")));
2797
+ }, timeoutMs);
2761
2798
  }
2762
2799
  /** Attach stdout/stderr data handlers + capture first-byte time (#2472). */
2763
2800
  attachStdoutHandlers(child, state, onProgress) {
@@ -4262,7 +4299,7 @@ var CodexMcpAdapter = class extends BaseCliAdapter {
4262
4299
  };
4263
4300
 
4264
4301
  // src/cli-adapters/adapters/opencode-adapter.ts
4265
- import { execFile } from "node:child_process";
4302
+ import { execFile as execFile2 } from "node:child_process";
4266
4303
 
4267
4304
  // src/cli-adapters/parsers/opencode-parser.ts
4268
4305
  var logger5 = createLogger({ component: "opencode-parser" });
@@ -4666,7 +4703,7 @@ function probeAvailableModels() {
4666
4703
  if (cachedModels !== void 0) return Promise.resolve(cachedModels);
4667
4704
  if (probePromise !== void 0) return probePromise;
4668
4705
  probePromise = new Promise((resolve) => {
4669
- execFile("opencode", ["models"], { timeout: PROBE_TIMEOUT_MS }, (error, stdout) => {
4706
+ execFile2("opencode", ["models"], { timeout: PROBE_TIMEOUT_MS }, (error, stdout) => {
4670
4707
  if (error !== null || stdout.trim() === "") {
4671
4708
  logger6.debug("Failed to probe OpenCode models, will omit --model flag", {
4672
4709
  error: error?.message
@@ -4892,12 +4929,12 @@ ${task.content}` : task.content;
4892
4929
  };
4893
4930
 
4894
4931
  // src/cli/cli-auth-probe.ts
4895
- import { execFile as execFile2 } from "node:child_process";
4932
+ import { execFile as execFile3 } from "node:child_process";
4896
4933
  import { promisify as promisify2 } from "node:util";
4897
4934
  import { existsSync, readFileSync as readFileSync3 } from "node:fs";
4898
4935
  import { homedir } from "node:os";
4899
4936
  import { join as join2 } from "node:path";
4900
- var execFileAsync = promisify2(execFile2);
4937
+ var execFileAsync = promisify2(execFile3);
4901
4938
  var HOME = homedir();
4902
4939
  function claudeNeedsLogin(reason) {
4903
4940
  return {
@@ -5249,7 +5286,7 @@ export {
5249
5286
  NEXUS_SUBPROCESS_DEPTH_ENV,
5250
5287
  readSubprocessDepth,
5251
5288
  trackProcessTree,
5252
- signalTrackedProcessTrees,
5289
+ signalTrackedProcessTreesAsync,
5253
5290
  SIGKILL_GRACE_MS,
5254
5291
  terminateProcessTree,
5255
5292
  SubprocessCliAdapter,
@@ -5286,4 +5323,4 @@ export {
5286
5323
  SdkAdapter,
5287
5324
  createAutoAdapter
5288
5325
  };
5289
- //# sourceMappingURL=chunk-JIRCYZKV.js.map
5326
+ //# sourceMappingURL=chunk-3E4J3EE6.js.map