@buildautomaton/cli 0.1.41 → 0.1.42

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.
package/dist/index.js CHANGED
@@ -24421,7 +24421,7 @@ function installBridgeProcessResilience() {
24421
24421
  }
24422
24422
 
24423
24423
  // src/cli-version.ts
24424
- var CLI_VERSION = "0.1.41".length > 0 ? "0.1.41" : "0.0.0-dev";
24424
+ var CLI_VERSION = "0.1.42".length > 0 ? "0.1.42" : "0.0.0-dev";
24425
24425
 
24426
24426
  // src/connection/heartbeat/constants.ts
24427
24427
  var BRIDGE_APP_HEARTBEAT_INTERVAL_MS = 1e4;
@@ -26066,18 +26066,6 @@ async function closeBridgeConnection(state, acpManager, devServerManager, log2)
26066
26066
  say("Shutdown complete.");
26067
26067
  }
26068
26068
 
26069
- // src/agents/acp/acp-idle-disconnect-ms.ts
26070
- var DEFAULT_ACP_IDLE_DISCONNECT_MS = 10 * 60 * 1e3;
26071
- function resolveAcpIdleDisconnectMs() {
26072
- const raw = process.env.BUILDAUTOMATON_ACP_IDLE_DISCONNECT_MS;
26073
- if (raw === "0") return 0;
26074
- if (raw != null && raw.trim() !== "") {
26075
- const parsed = Number(raw);
26076
- if (Number.isFinite(parsed) && parsed >= 0) return parsed;
26077
- }
26078
- return DEFAULT_ACP_IDLE_DISCONNECT_MS;
26079
- }
26080
-
26081
26069
  // src/agents/acp/acp-prompt-routing-registry.ts
26082
26070
  var AcpPromptRoutingRegistry = class {
26083
26071
  runs = /* @__PURE__ */ new Map();
@@ -26127,9 +26115,7 @@ function createAcpManagerContext(options) {
26127
26115
  acpAgents: /* @__PURE__ */ new Map(),
26128
26116
  promptRouting: new AcpPromptRoutingRegistry(),
26129
26117
  runDispatch: /* @__PURE__ */ new Map(),
26130
- pendingCancelRunIds: /* @__PURE__ */ new Set(),
26131
- idleDisconnectTimers: /* @__PURE__ */ new Map(),
26132
- idleDisconnectMs: options.idleDisconnectMs
26118
+ pendingCancelRunIds: /* @__PURE__ */ new Set()
26133
26119
  };
26134
26120
  }
26135
26121
 
@@ -27860,55 +27846,8 @@ async function ensureAcpClient(options) {
27860
27846
  return state.acpStartPromise;
27861
27847
  }
27862
27848
 
27863
- // src/agents/acp/manager/idle-disconnect.ts
27864
- function hasActiveWorkForAcpAgent(ctx, acpAgentKey) {
27865
- if (ctx.promptRouting.getStreamingRunId(acpAgentKey)) return true;
27866
- for (const meta of ctx.runDispatch.values()) {
27867
- if (meta.acpAgentKey === acpAgentKey) return true;
27868
- }
27869
- return false;
27870
- }
27871
- function clearIdleDisconnectTimer(ctx, acpAgentKey) {
27872
- const timer = ctx.idleDisconnectTimers.get(acpAgentKey);
27873
- if (timer == null) return;
27874
- clearTimeout(timer);
27875
- ctx.idleDisconnectTimers.delete(acpAgentKey);
27876
- }
27877
- function disconnectIdleAcpAgent(ctx, acpAgentKey) {
27878
- clearIdleDisconnectTimer(ctx, acpAgentKey);
27879
- if (hasActiveWorkForAcpAgent(ctx, acpAgentKey)) return;
27880
- const state = ctx.acpAgents.get(acpAgentKey);
27881
- if (!state?.acpHandle && !state?.acpStartPromise) {
27882
- ctx.acpAgents.delete(acpAgentKey);
27883
- return;
27884
- }
27885
- const handle = state.acpHandle;
27886
- void (async () => {
27887
- try {
27888
- await handle?.disconnectGracefully();
27889
- } catch {
27890
- }
27891
- invalidateAcpClientState(state);
27892
- ctx.acpAgents.delete(acpAgentKey);
27893
- logDebug(`[Agent] Idle disconnect (${acpAgentKey.split("::")[0] ?? acpAgentKey})`);
27894
- })();
27895
- }
27896
- function scheduleIdleDisconnect(ctx, acpAgentKey) {
27897
- if (ctx.idleDisconnectMs <= 0) return;
27898
- clearIdleDisconnectTimer(ctx, acpAgentKey);
27899
- const timer = setTimeout(() => {
27900
- ctx.idleDisconnectTimers.delete(acpAgentKey);
27901
- disconnectIdleAcpAgent(ctx, acpAgentKey);
27902
- }, ctx.idleDisconnectMs);
27903
- timer.unref?.();
27904
- ctx.idleDisconnectTimers.set(acpAgentKey, timer);
27905
- }
27906
-
27907
27849
  // src/agents/acp/manager/disconnect-all.ts
27908
27850
  async function disconnectAll(ctx) {
27909
- for (const acpAgentKey of ctx.idleDisconnectTimers.keys()) {
27910
- clearIdleDisconnectTimer(ctx, acpAgentKey);
27911
- }
27912
27851
  await Promise.all(
27913
27852
  [...ctx.acpAgents.values()].map(async (state) => {
27914
27853
  try {
@@ -33245,7 +33184,6 @@ function handlePrompt(ctx, opts) {
33245
33184
  }
33246
33185
  const activeAcpAgentKey = acpAgentKey;
33247
33186
  ctx.pendingCancelRunIds.delete(activeRunId);
33248
- clearIdleDisconnectTimer(ctx, activeAcpAgentKey);
33249
33187
  ctx.promptRouting.registerRun({ sessionId, runId: activeRunId });
33250
33188
  ctx.runDispatch.set(activeRunId, { acpAgentKey: activeAcpAgentKey });
33251
33189
  async function run() {
@@ -33328,7 +33266,6 @@ function handlePrompt(ctx, opts) {
33328
33266
  ctx.promptRouting.unregisterRun(activeRunId);
33329
33267
  ctx.runDispatch.delete(activeRunId);
33330
33268
  ctx.pendingCancelRunIds.delete(activeRunId);
33331
- scheduleIdleDisconnect(ctx, activeAcpAgentKey);
33332
33269
  });
33333
33270
  }
33334
33271
 
@@ -33346,8 +33283,7 @@ function logPromptReceivedFromBridge(ctx, opts) {
33346
33283
  async function createAcpManager(options) {
33347
33284
  const ctx = createAcpManagerContext({
33348
33285
  log: options.log,
33349
- reportAgentCapabilities: options.reportAgentCapabilities,
33350
- idleDisconnectMs: resolveAcpIdleDisconnectMs()
33286
+ reportAgentCapabilities: options.reportAgentCapabilities
33351
33287
  });
33352
33288
  return {
33353
33289
  setPreferredAgentType(agentType) {