@atlaswork/atlascode 0.1.138 → 0.1.139

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "product": "atlascode",
3
- "version": "0.1.138",
3
+ "version": "0.1.139",
4
4
  "runtimeSha256": "9bbb766ae76e5a73f1155a83bd6eda493644fb228b9308e0f45938fb49f43451",
5
5
  "executionSha256": "b14e2ea5946c9e086d65d2debe0de98b0afec83228d887958bcb16a6e867710d"
6
6
  }
package/dist/cli.js CHANGED
@@ -83917,6 +83917,7 @@ function createMcpConnectionManager() {
83917
83917
  const connections = new Map;
83918
83918
  const pending = new Set;
83919
83919
  const pendingConnects = new Map;
83920
+ const pendingChildren = new Map;
83920
83921
  const connectFailures = new Map;
83921
83922
  function fail(name, config, error, authFailure = false) {
83922
83923
  const conn = {
@@ -83949,6 +83950,7 @@ function createMcpConnectionManager() {
83949
83950
  args: finalArgs,
83950
83951
  env
83951
83952
  });
83953
+ pendingChildren.set(name, child);
83952
83954
  let stderrOutput = "";
83953
83955
  const stderrHandler = (data) => {
83954
83956
  if (stderrOutput.length < 64 * 1024 * 1024) {
@@ -84086,6 +84088,7 @@ function createMcpConnectionManager() {
84086
84088
  return await connectStdio(name, config, opts);
84087
84089
  } finally {
84088
84090
  pending.delete(name);
84091
+ pendingChildren.delete(name);
84089
84092
  }
84090
84093
  }
84091
84094
  async function closeConnection(name) {
@@ -84106,6 +84109,10 @@ function createMcpConnectionManager() {
84106
84109
  for (const name of [...connections.keys()]) {
84107
84110
  await manager.close(name);
84108
84111
  }
84112
+ for (const [name, child] of [...pendingChildren]) {
84113
+ pendingChildren.delete(name);
84114
+ await terminateChild(name, child);
84115
+ }
84109
84116
  },
84110
84117
  getPendingServerNames: () => [...pending],
84111
84118
  markBlocked
@@ -94653,6 +94660,22 @@ async function runHeadless(inputPrompt, options) {
94653
94660
  if (teammateDrainRequested > 0) {
94654
94661
  logForDebugging2(`[headless] teammate lifecycle exit guard: forcing process exit after drain (requested=${teammateDrainRequested})`);
94655
94662
  }
94663
+ {
94664
+ const mcpExitCount = mcpManager.list().filter((c) => c.type === "connected").length + mcpManager.getPendingServerNames().length;
94665
+ if (mcpExitCount > 0) {
94666
+ const mcpTeardownBudgetMs = Math.max(2000, 750 * mcpExitCount);
94667
+ const mcpTeardownTimer = setTimeout(() => {
94668
+ logForDebugging2(`[headless] MCP teardown failsafe: closeAll exceeded ${mcpTeardownBudgetMs}ms, forcing exit 0`);
94669
+ process.exit(0);
94670
+ }, mcpTeardownBudgetMs);
94671
+ mcpTeardownTimer.unref();
94672
+ try {
94673
+ await mcpManager.closeAll();
94674
+ } finally {
94675
+ clearTimeout(mcpTeardownTimer);
94676
+ }
94677
+ }
94678
+ }
94656
94679
  await flushDebugSink();
94657
94680
  if (teammateDrainRequested > 0) {
94658
94681
  await new Promise((resolve) => setTimeout(resolve, 2000));
@@ -337616,6 +337639,9 @@ async function gracefulShutdown(exitCode = 0, reason = "other", options) {
337616
337639
  } catch {
337617
337640
  clearTimeout(cleanupTimeoutId);
337618
337641
  }
337642
+ try {
337643
+ await getMcpConnectionManager().closeAll();
337644
+ } catch {}
337619
337645
  try {
337620
337646
  await executeSessionEndHooks(reason, {
337621
337647
  ...options,
@@ -337648,6 +337674,7 @@ var init_gracefulShutdown = __esm(() => {
337648
337674
  init_dec();
337649
337675
  init_osc();
337650
337676
  init_cleanupRegistry3();
337677
+ init_mcp3();
337651
337678
  init_debug();
337652
337679
  init_diagLogs();
337653
337680
  init_envUtils2();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaswork/atlascode",
3
- "version": "0.1.138",
3
+ "version": "0.1.139",
4
4
  "description": "AtlasCode — Coding Agent for the domestic computing ecosystem (Ascend NPU + domestic LLM backends)",
5
5
  "homepage": "https://www.atlaswork.cn/",
6
6
  "bin": {