nexus-agents 3.2.2 → 3.3.0

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 (126) hide show
  1. package/dist/{child-mcp-config-IGZEHG37.js → child-mcp-config-EXZDHJBP.js} +3 -3
  2. package/dist/{chunk-SDVDWM3C.js → chunk-24GBX2E2.js} +5 -5
  3. package/dist/{chunk-ATNHVLKJ.js → chunk-26NSVQ65.js} +52 -17
  4. package/dist/chunk-26NSVQ65.js.map +1 -0
  5. package/dist/{chunk-47WSUCLS.js → chunk-3T3TZZKG.js} +3 -3
  6. package/dist/{chunk-WKJWUK67.js → chunk-3UYBYO46.js} +35 -35
  7. package/dist/{chunk-GQ5LHJD2.js → chunk-5QAGT56O.js} +2 -2
  8. package/dist/{chunk-25TDC2C4.js → chunk-5ZSWBPUZ.js} +2 -2
  9. package/dist/{chunk-F47KBREM.js → chunk-63EFLUVS.js} +2 -2
  10. package/dist/{chunk-GTU2GK4H.js → chunk-7HDPHBKE.js} +4 -4
  11. package/dist/{chunk-4AF6CP7P.js → chunk-7L7CUYAY.js} +4 -4
  12. package/dist/{chunk-OKVCJFZM.js → chunk-7OVUQKM2.js} +2 -2
  13. package/dist/{chunk-GMJUXSLK.js → chunk-CYXQRAJ2.js} +5 -5
  14. package/dist/{chunk-2WRW3MWB.js → chunk-DGMNPTPG.js} +3 -3
  15. package/dist/{chunk-43YJRZZW.js → chunk-E6YS4KOL.js} +2 -2
  16. package/dist/{chunk-5HG2M5CP.js → chunk-EQGTPGN6.js} +73 -8
  17. package/dist/chunk-EQGTPGN6.js.map +1 -0
  18. package/dist/{chunk-HEZ6VTMO.js → chunk-EV42DVHG.js} +2 -2
  19. package/dist/{chunk-ZBTEOM3T.js → chunk-FSDHFY3C.js} +2 -2
  20. package/dist/{chunk-TIQXKIIA.js → chunk-G2C4WNK7.js} +2 -2
  21. package/dist/{chunk-EL62KWUE.js → chunk-H3B6BSBZ.js} +7 -7
  22. package/dist/{chunk-D33VCEA6.js → chunk-HPQ6QOTI.js} +5 -5
  23. package/dist/{chunk-T6HI32EC.js → chunk-IHMUW7N5.js} +2 -2
  24. package/dist/{chunk-E6JME6SQ.js → chunk-M4IFLNLT.js} +2 -2
  25. package/dist/{chunk-Z2VEERCP.js → chunk-MRSTTALY.js} +3 -3
  26. package/dist/{chunk-OVAO5IMR.js → chunk-NNBX6YZI.js} +2 -2
  27. package/dist/{chunk-A5QBZ5EC.js → chunk-QJPR3Y4E.js} +71 -33
  28. package/dist/chunk-QJPR3Y4E.js.map +1 -0
  29. package/dist/{chunk-RHO52DBX.js → chunk-QZDWVJN6.js} +2 -2
  30. package/dist/{chunk-5NRFPUNP.js → chunk-RAYKASM4.js} +8 -8
  31. package/dist/{chunk-PE35GMXD.js → chunk-SISWFC5K.js} +5 -5
  32. package/dist/{chunk-YAF73ZMR.js → chunk-SNJNRDKZ.js} +2 -1
  33. package/dist/{chunk-NGFG5TIB.js → chunk-U64WRZQ2.js} +2 -2
  34. package/dist/{chunk-VV7KSMMR.js → chunk-UNDYHLRR.js} +3 -3
  35. package/dist/{chunk-UBHTXZR6.js → chunk-UWVHFMU2.js} +4 -4
  36. package/dist/{chunk-QRZPGTZN.js → chunk-YC3RAOU5.js} +2 -2
  37. package/dist/{chunk-344IEWHJ.js → chunk-YWGMDZR4.js} +2 -2
  38. package/dist/{chunk-ENZ3IWEM.js → chunk-ZP5QHPDX.js} +2 -2
  39. package/dist/{cli-circuit-breaker-FTN4E7PN.js → cli-circuit-breaker-76YQJDYE.js} +3 -3
  40. package/dist/cli.js +44 -41
  41. package/dist/cli.js.map +1 -1
  42. package/dist/{composite-router-AHUNMSEQ.js → composite-router-2SGU5BWW.js} +2 -2
  43. package/dist/{consensus-vote-PPZUA3EN.js → consensus-vote-UF73LBG6.js} +17 -17
  44. package/dist/{context-retriever-UDERFG2L.js → context-retriever-MBGPFZA7.js} +8 -8
  45. package/dist/{doctor-deep-XZX7RNDG.js → doctor-deep-N7ZS6YNE.js} +3 -3
  46. package/dist/{expert-bridge-NIYLN24L.js → expert-bridge-GSDGOVQT.js} +4 -4
  47. package/dist/factory-6AR32KPC.js +25 -0
  48. package/dist/{factory-2VYANO2Z.js → factory-KBKFR56R.js} +5 -5
  49. package/dist/{improvement-review-Z3BEZS73.js → improvement-review-B7DR4Y3C.js} +5 -5
  50. package/dist/index.d.ts +21 -0
  51. package/dist/index.js +31 -31
  52. package/dist/{init-opencode-3ENXQJKC.js → init-opencode-QBHHYWWF.js} +6 -6
  53. package/dist/{issue-triage-Q7SYODHT.js → issue-triage-5JONYJ5X.js} +6 -6
  54. package/dist/{pr-reviewer-helpers-CVMB2PRH.js → pr-reviewer-helpers-JMZOSZGY.js} +4 -4
  55. package/dist/{registry-command-XPA6LFHZ.js → registry-command-ZN2N6NB6.js} +2 -2
  56. package/dist/{repo-security-plan-NUMTKVMR.js → repo-security-plan-LM6CQJDK.js} +3 -3
  57. package/dist/{research-helpers-synthesize-EHDMCB6P.js → research-helpers-synthesize-5T3WTCAR.js} +4 -4
  58. package/dist/{routing-memory-3XURCXXF.js → routing-memory-WOYMTDXS.js} +2 -2
  59. package/dist/{session-memory-QISTJJOX.js → session-memory-2E2RFJQO.js} +3 -3
  60. package/dist/{setup-command-NPGRBUWK.js → setup-command-ILFC6FWM.js} +15 -15
  61. package/dist/{setup-config-D6V7HW6W.js → setup-config-GKSERLN5.js} +3 -3
  62. package/dist/{setup-custom-api-U2EUVTPO.js → setup-custom-api-DWREDJNN.js} +4 -4
  63. package/dist/{tool-memory-BR7N6EB6.js → tool-memory-CHAKVXF5.js} +5 -5
  64. package/dist/unified-registry-7WZ2BLIC.js +26 -0
  65. package/dist/{weather-report-22DR27KY.js → weather-report-UDBU5F52.js} +2 -2
  66. package/package.json +1 -1
  67. package/dist/chunk-5HG2M5CP.js.map +0 -1
  68. package/dist/chunk-A5QBZ5EC.js.map +0 -1
  69. package/dist/chunk-ATNHVLKJ.js.map +0 -1
  70. package/dist/factory-KDNW4GTS.js +0 -25
  71. package/dist/unified-registry-K4DRV5PF.js +0 -26
  72. /package/dist/{child-mcp-config-IGZEHG37.js.map → child-mcp-config-EXZDHJBP.js.map} +0 -0
  73. /package/dist/{chunk-SDVDWM3C.js.map → chunk-24GBX2E2.js.map} +0 -0
  74. /package/dist/{chunk-47WSUCLS.js.map → chunk-3T3TZZKG.js.map} +0 -0
  75. /package/dist/{chunk-WKJWUK67.js.map → chunk-3UYBYO46.js.map} +0 -0
  76. /package/dist/{chunk-GQ5LHJD2.js.map → chunk-5QAGT56O.js.map} +0 -0
  77. /package/dist/{chunk-25TDC2C4.js.map → chunk-5ZSWBPUZ.js.map} +0 -0
  78. /package/dist/{chunk-F47KBREM.js.map → chunk-63EFLUVS.js.map} +0 -0
  79. /package/dist/{chunk-GTU2GK4H.js.map → chunk-7HDPHBKE.js.map} +0 -0
  80. /package/dist/{chunk-4AF6CP7P.js.map → chunk-7L7CUYAY.js.map} +0 -0
  81. /package/dist/{chunk-OKVCJFZM.js.map → chunk-7OVUQKM2.js.map} +0 -0
  82. /package/dist/{chunk-GMJUXSLK.js.map → chunk-CYXQRAJ2.js.map} +0 -0
  83. /package/dist/{chunk-2WRW3MWB.js.map → chunk-DGMNPTPG.js.map} +0 -0
  84. /package/dist/{chunk-43YJRZZW.js.map → chunk-E6YS4KOL.js.map} +0 -0
  85. /package/dist/{chunk-HEZ6VTMO.js.map → chunk-EV42DVHG.js.map} +0 -0
  86. /package/dist/{chunk-ZBTEOM3T.js.map → chunk-FSDHFY3C.js.map} +0 -0
  87. /package/dist/{chunk-TIQXKIIA.js.map → chunk-G2C4WNK7.js.map} +0 -0
  88. /package/dist/{chunk-EL62KWUE.js.map → chunk-H3B6BSBZ.js.map} +0 -0
  89. /package/dist/{chunk-D33VCEA6.js.map → chunk-HPQ6QOTI.js.map} +0 -0
  90. /package/dist/{chunk-T6HI32EC.js.map → chunk-IHMUW7N5.js.map} +0 -0
  91. /package/dist/{chunk-E6JME6SQ.js.map → chunk-M4IFLNLT.js.map} +0 -0
  92. /package/dist/{chunk-Z2VEERCP.js.map → chunk-MRSTTALY.js.map} +0 -0
  93. /package/dist/{chunk-OVAO5IMR.js.map → chunk-NNBX6YZI.js.map} +0 -0
  94. /package/dist/{chunk-RHO52DBX.js.map → chunk-QZDWVJN6.js.map} +0 -0
  95. /package/dist/{chunk-5NRFPUNP.js.map → chunk-RAYKASM4.js.map} +0 -0
  96. /package/dist/{chunk-PE35GMXD.js.map → chunk-SISWFC5K.js.map} +0 -0
  97. /package/dist/{chunk-YAF73ZMR.js.map → chunk-SNJNRDKZ.js.map} +0 -0
  98. /package/dist/{chunk-NGFG5TIB.js.map → chunk-U64WRZQ2.js.map} +0 -0
  99. /package/dist/{chunk-VV7KSMMR.js.map → chunk-UNDYHLRR.js.map} +0 -0
  100. /package/dist/{chunk-UBHTXZR6.js.map → chunk-UWVHFMU2.js.map} +0 -0
  101. /package/dist/{chunk-QRZPGTZN.js.map → chunk-YC3RAOU5.js.map} +0 -0
  102. /package/dist/{chunk-344IEWHJ.js.map → chunk-YWGMDZR4.js.map} +0 -0
  103. /package/dist/{chunk-ENZ3IWEM.js.map → chunk-ZP5QHPDX.js.map} +0 -0
  104. /package/dist/{cli-circuit-breaker-FTN4E7PN.js.map → cli-circuit-breaker-76YQJDYE.js.map} +0 -0
  105. /package/dist/{composite-router-AHUNMSEQ.js.map → composite-router-2SGU5BWW.js.map} +0 -0
  106. /package/dist/{consensus-vote-PPZUA3EN.js.map → consensus-vote-UF73LBG6.js.map} +0 -0
  107. /package/dist/{context-retriever-UDERFG2L.js.map → context-retriever-MBGPFZA7.js.map} +0 -0
  108. /package/dist/{doctor-deep-XZX7RNDG.js.map → doctor-deep-N7ZS6YNE.js.map} +0 -0
  109. /package/dist/{expert-bridge-NIYLN24L.js.map → expert-bridge-GSDGOVQT.js.map} +0 -0
  110. /package/dist/{factory-2VYANO2Z.js.map → factory-6AR32KPC.js.map} +0 -0
  111. /package/dist/{factory-KDNW4GTS.js.map → factory-KBKFR56R.js.map} +0 -0
  112. /package/dist/{improvement-review-Z3BEZS73.js.map → improvement-review-B7DR4Y3C.js.map} +0 -0
  113. /package/dist/{init-opencode-3ENXQJKC.js.map → init-opencode-QBHHYWWF.js.map} +0 -0
  114. /package/dist/{issue-triage-Q7SYODHT.js.map → issue-triage-5JONYJ5X.js.map} +0 -0
  115. /package/dist/{pr-reviewer-helpers-CVMB2PRH.js.map → pr-reviewer-helpers-JMZOSZGY.js.map} +0 -0
  116. /package/dist/{registry-command-XPA6LFHZ.js.map → registry-command-ZN2N6NB6.js.map} +0 -0
  117. /package/dist/{repo-security-plan-NUMTKVMR.js.map → repo-security-plan-LM6CQJDK.js.map} +0 -0
  118. /package/dist/{research-helpers-synthesize-EHDMCB6P.js.map → research-helpers-synthesize-5T3WTCAR.js.map} +0 -0
  119. /package/dist/{routing-memory-3XURCXXF.js.map → routing-memory-WOYMTDXS.js.map} +0 -0
  120. /package/dist/{session-memory-QISTJJOX.js.map → session-memory-2E2RFJQO.js.map} +0 -0
  121. /package/dist/{setup-command-NPGRBUWK.js.map → setup-command-ILFC6FWM.js.map} +0 -0
  122. /package/dist/{setup-config-D6V7HW6W.js.map → setup-config-GKSERLN5.js.map} +0 -0
  123. /package/dist/{setup-custom-api-U2EUVTPO.js.map → setup-custom-api-DWREDJNN.js.map} +0 -0
  124. /package/dist/{tool-memory-BR7N6EB6.js.map → tool-memory-CHAKVXF5.js.map} +0 -0
  125. /package/dist/{unified-registry-K4DRV5PF.js.map → unified-registry-7WZ2BLIC.js.map} +0 -0
  126. /package/dist/{weather-report-22DR27KY.js.map → weather-report-UDBU5F52.js.map} +0 -0
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  resolveCliSlot
3
- } from "./chunk-RHO52DBX.js";
3
+ } from "./chunk-QZDWVJN6.js";
4
4
  import {
5
5
  createLogger,
6
6
  getTimeProvider,
7
7
  isRateLimitText
8
- } from "./chunk-ATNHVLKJ.js";
8
+ } from "./chunk-26NSVQ65.js";
9
9
 
10
10
  // src/pipeline/expert-bridge.ts
11
11
  function resolveCliFromModelString(model) {
@@ -21,7 +21,7 @@ async function getMcpConfigPath() {
21
21
  if (cachedMcpConfigPath !== null) return cachedMcpConfigPath;
22
22
  mcpConfigInitPromise ??= (async () => {
23
23
  try {
24
- const { generateMcpConfig } = await import("./child-mcp-config-IGZEHG37.js");
24
+ const { generateMcpConfig } = await import("./child-mcp-config-EXZDHJBP.js");
25
25
  const config = await generateMcpConfig();
26
26
  cachedMcpConfigPath = config.configPath;
27
27
  cachedMcpConfigCleanup = config.cleanup;
@@ -93,8 +93,8 @@ var routerInitPromise = null;
93
93
  async function getRouter() {
94
94
  if (cachedRouter !== null) return cachedRouter;
95
95
  routerInitPromise ??= (async () => {
96
- const { createAllAdapters } = await import("./factory-KDNW4GTS.js");
97
- const { createCompositeRouter } = await import("./composite-router-AHUNMSEQ.js");
96
+ const { createAllAdapters } = await import("./factory-6AR32KPC.js");
97
+ const { createCompositeRouter } = await import("./composite-router-2SGU5BWW.js");
98
98
  const adapters = createAllAdapters();
99
99
  if (adapters.size === 0) {
100
100
  routerInitPromise = null;
@@ -102,7 +102,7 @@ async function getRouter() {
102
102
  }
103
103
  cachedRouter = adaptCompositeRouter(createCompositeRouter(adapters));
104
104
  try {
105
- const { createCliCircuitBreakerIntegration } = await import("./cli-circuit-breaker-FTN4E7PN.js");
105
+ const { createCliCircuitBreakerIntegration } = await import("./cli-circuit-breaker-76YQJDYE.js");
106
106
  cachedCircuitBreaker = createCliCircuitBreakerIntegration([...adapters.values()]);
107
107
  } catch (error) {
108
108
  const msg = error instanceof Error ? error.message : String(error);
@@ -213,4 +213,4 @@ export {
213
213
  tokenSplitFromUsage,
214
214
  executeExpert
215
215
  };
216
- //# sourceMappingURL=chunk-EL62KWUE.js.map
216
+ //# sourceMappingURL=chunk-H3B6BSBZ.js.map
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  resolveToken
3
- } from "./chunk-T6HI32EC.js";
3
+ } from "./chunk-IHMUW7N5.js";
4
4
  import {
5
5
  REGISTRY_PATH,
6
6
  getProjectRoot,
7
7
  loadPapersRegistry,
8
8
  loadTechniquesRegistry,
9
9
  savePapersRegistry
10
- } from "./chunk-E6JME6SQ.js";
10
+ } from "./chunk-M4IFLNLT.js";
11
11
  import {
12
12
  resolveInsideRoot
13
13
  } from "./chunk-NUBSJGQZ.js";
14
14
  import {
15
15
  getToolMemory
16
- } from "./chunk-GTU2GK4H.js";
16
+ } from "./chunk-7HDPHBKE.js";
17
17
  import {
18
18
  capitalizeWords,
19
19
  truncateSentence
@@ -38,7 +38,7 @@ import {
38
38
  getTimeProvider,
39
39
  ok,
40
40
  registerPersistentDistillerFactory
41
- } from "./chunk-ATNHVLKJ.js";
41
+ } from "./chunk-26NSVQ65.js";
42
42
  import {
43
43
  ensureLearningDir,
44
44
  getRulesFile
@@ -4090,4 +4090,4 @@ export {
4090
4090
  DEFAULT_CONTEXT_BUDGET_TOKENS,
4091
4091
  getContextPromptPrefix
4092
4092
  };
4093
- //# sourceMappingURL=chunk-D33VCEA6.js.map
4093
+ //# sourceMappingURL=chunk-HPQ6QOTI.js.map
@@ -2,7 +2,7 @@ import {
2
2
  createLogger,
3
3
  err,
4
4
  ok
5
- } from "./chunk-ATNHVLKJ.js";
5
+ } from "./chunk-26NSVQ65.js";
6
6
 
7
7
  // src/scm/token-resolver.ts
8
8
  import { execFile } from "child_process";
@@ -87,4 +87,4 @@ export {
87
87
  hasToken,
88
88
  getTokenEnvVars
89
89
  };
90
- //# sourceMappingURL=chunk-T6HI32EC.js.map
90
+ //# sourceMappingURL=chunk-IHMUW7N5.js.map
@@ -8,7 +8,7 @@ import {
8
8
  getErrorMessage,
9
9
  ok,
10
10
  parseBoolEnv
11
- } from "./chunk-ATNHVLKJ.js";
11
+ } from "./chunk-26NSVQ65.js";
12
12
 
13
13
  // src/cli/research-helpers-io.ts
14
14
  import * as fs2 from "fs/promises";
@@ -146,4 +146,4 @@ export {
146
146
  loadPapersRegistry,
147
147
  savePapersRegistry
148
148
  };
149
- //# sourceMappingURL=chunk-E6JME6SQ.js.map
149
+ //# sourceMappingURL=chunk-M4IFLNLT.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  loadPapersRegistry
3
- } from "./chunk-E6JME6SQ.js";
3
+ } from "./chunk-M4IFLNLT.js";
4
4
  import {
5
5
  getErrorMessage
6
- } from "./chunk-ATNHVLKJ.js";
6
+ } from "./chunk-26NSVQ65.js";
7
7
 
8
8
  // src/cli/research-helpers-synthesize.ts
9
9
  import { z } from "zod";
@@ -876,4 +876,4 @@ export {
876
876
  AttributedInsightSchema,
877
877
  synthesizeResearch
878
878
  };
879
- //# sourceMappingURL=chunk-Z2VEERCP.js.map
879
+ //# sourceMappingURL=chunk-MRSTTALY.js.map
@@ -2,7 +2,7 @@ import {
2
2
  TASK_CATEGORIES,
3
3
  getAdaptiveBonus,
4
4
  getOutcomeStore
5
- } from "./chunk-ATNHVLKJ.js";
5
+ } from "./chunk-26NSVQ65.js";
6
6
 
7
7
  // src/cli/doctor-deep.ts
8
8
  var CLI_NAMES = ["claude", "gemini", "codex", "opencode"];
@@ -106,4 +106,4 @@ export {
106
106
  runDeepDiagnostics,
107
107
  formatDeepDiagnostics
108
108
  };
109
- //# sourceMappingURL=chunk-OVAO5IMR.js.map
109
+ //# sourceMappingURL=chunk-NNBX6YZI.js.map
@@ -5,34 +5,34 @@ import {
5
5
  planOptionalParams,
6
6
  requireApiKey,
7
7
  validateApiKeyPresence
8
- } from "./chunk-HEZ6VTMO.js";
8
+ } from "./chunk-EV42DVHG.js";
9
9
  import {
10
10
  CUSTOM_API_DEFAULT_MODEL
11
- } from "./chunk-NGFG5TIB.js";
11
+ } from "./chunk-U64WRZQ2.js";
12
12
  import {
13
13
  CUSTOM_API_BASE_URL_ENV,
14
14
  PROVIDER_ENV_KEYS,
15
15
  assertCustomApiHostResolvesPublic,
16
16
  validateCustomApiBaseUrl
17
- } from "./chunk-ZBTEOM3T.js";
17
+ } from "./chunk-FSDHFY3C.js";
18
18
  import {
19
19
  nexusMkdtempSync
20
- } from "./chunk-YAF73ZMR.js";
20
+ } from "./chunk-SNJNRDKZ.js";
21
21
  import {
22
22
  getAvailabilityCache
23
- } from "./chunk-RHO52DBX.js";
23
+ } from "./chunk-QZDWVJN6.js";
24
24
  import {
25
25
  extractSystemPrompt
26
26
  } from "./chunk-QZUG667L.js";
27
27
  import {
28
28
  generateHyphenId
29
- } from "./chunk-25TDC2C4.js";
29
+ } from "./chunk-5ZSWBPUZ.js";
30
30
  import {
31
31
  CliCircuitBreaker,
32
32
  DEFAULT_CIRCUIT_BREAKER_CONFIG,
33
33
  getCliCircuitBreakerSnapshot,
34
34
  getDefaultCliCircuitBreakerRegistry
35
- } from "./chunk-OKVCJFZM.js";
35
+ } from "./chunk-7OVUQKM2.js";
36
36
  import {
37
37
  CLI_SUBPROCESS_TIMEOUTS,
38
38
  CLI_TIMEOUTS,
@@ -69,7 +69,7 @@ import {
69
69
  ok,
70
70
  parseRetryAfterMs,
71
71
  resolveCliAlias
72
- } from "./chunk-ATNHVLKJ.js";
72
+ } from "./chunk-26NSVQ65.js";
73
73
 
74
74
  // src/cli-adapters/cli-to-model-adapter.ts
75
75
  var CliToModelAdapter = class {
@@ -2548,6 +2548,38 @@ var SubprocessCliAdapter = class extends BaseCliAdapter {
2548
2548
  * + model and surface tail-latency outliers") requires a way to
2549
2549
  * disambiguate which timing row belongs to which call.
2550
2550
  */
2551
+ /**
2552
+ * Wraps a command's cleanup in a once-guard (#4488).
2553
+ *
2554
+ * `CommandConfig.cleanup` removes a tempdir the command builder created (e.g.
2555
+ * codex's `nexus-codex-sysprompt-*` holding the system prompt). It must run on
2556
+ * EVERY exit path — a path that skips it leaks a directory per invocation, the
2557
+ * leak codex-adapter's own comment records as having exhausted inodes on
2558
+ * long-running MCP daemons — and exactly ONCE, since a second rm could hit a
2559
+ * path the OS has already handed to someone else.
2560
+ */
2561
+ /**
2562
+ * Result for a synchronous spawn failure (#4488).
2563
+ *
2564
+ * `spawn()` throws synchronously on some failures (EACCES, and ENOENT on
2565
+ * certain platforms), and handler setup can throw too. Those paths never
2566
+ * reach `resolve`, so without catching them the tempdir leaks AND the promise
2567
+ * rejects instead of returning a Result — breaking the never-throws contract
2568
+ * this adapter is supposed to honour.
2569
+ */
2570
+ spawnFailure(command, error) {
2571
+ return err(
2572
+ this.createError("EXECUTION_ERROR", `Failed to spawn ${command}: ${getErrorMessage(error)}`)
2573
+ );
2574
+ }
2575
+ onceCleanup(cleanup) {
2576
+ let done = false;
2577
+ return () => {
2578
+ if (done) return;
2579
+ done = true;
2580
+ this.runSubprocessCleanup(cleanup);
2581
+ };
2582
+ }
2551
2583
  spawnSubprocess(task, options, requestId) {
2552
2584
  const cmdConfig = this.getCommand(task);
2553
2585
  const startTime = getTimeProvider().now();
@@ -2556,32 +2588,38 @@ var SubprocessCliAdapter = class extends BaseCliAdapter {
2556
2588
  return Promise.resolve(err(this.createError("TIMEOUT", "Aborted before spawn")));
2557
2589
  }
2558
2590
  return new Promise((resolveOuter) => {
2559
- const resolve = (result) => {
2560
- this.runSubprocessCleanup(cmdConfig.cleanup);
2561
- resolveOuter(result);
2591
+ const runCleanupOnce = this.onceCleanup(cmdConfig.cleanup);
2592
+ const resolve = (r) => {
2593
+ runCleanupOnce();
2594
+ resolveOuter(r);
2562
2595
  };
2563
- const childEnv = buildChildEnv(this.name);
2564
- const child = spawn(cmdConfig.command, cmdConfig.args, {
2565
- stdio: ["pipe", "pipe", "pipe"],
2566
- env: childEnv
2567
- });
2568
- const onProgress = options.onProgress;
2569
- const state = this.setupChildProcessHandlers({
2570
- child,
2571
- startTime,
2572
- timeoutMs: options.timeoutMs,
2573
- resolve,
2574
- requestId,
2575
- ...onProgress !== void 0 ? { onProgress } : {}
2576
- });
2577
- if (signal !== void 0) {
2578
- this.attachAbortSignal(child, signal, resolve);
2579
- }
2580
- if (cmdConfig.stdin !== void 0) {
2581
- child.stdin.write(cmdConfig.stdin);
2596
+ try {
2597
+ const childEnv = buildChildEnv(this.name);
2598
+ const child = spawn(cmdConfig.command, cmdConfig.args, {
2599
+ stdio: ["pipe", "pipe", "pipe"],
2600
+ env: childEnv
2601
+ });
2602
+ const onProgress = options.onProgress;
2603
+ const state = this.setupChildProcessHandlers({
2604
+ child,
2605
+ startTime,
2606
+ timeoutMs: options.timeoutMs,
2607
+ resolve,
2608
+ requestId,
2609
+ ...onProgress !== void 0 ? { onProgress } : {}
2610
+ });
2611
+ if (signal !== void 0) {
2612
+ this.attachAbortSignal(child, signal, resolve);
2613
+ }
2614
+ if (cmdConfig.stdin !== void 0) {
2615
+ child.stdin.write(cmdConfig.stdin);
2616
+ }
2617
+ child.stdin.end();
2618
+ void state;
2619
+ } catch (error) {
2620
+ runCleanupOnce();
2621
+ resolveOuter(this.spawnFailure(cmdConfig.command, error));
2582
2622
  }
2583
- child.stdin.end();
2584
- void state;
2585
2623
  });
2586
2624
  }
2587
2625
  /**
@@ -4724,4 +4762,4 @@ export {
4724
4762
  SdkAdapter,
4725
4763
  createAutoAdapter
4726
4764
  };
4727
- //# sourceMappingURL=chunk-A5QBZ5EC.js.map
4765
+ //# sourceMappingURL=chunk-QJPR3Y4E.js.map