@buildautomaton/cli 0.1.91 → 0.1.92

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/cli.js CHANGED
@@ -24125,7 +24125,6 @@ function isCliSqliteLockError(e) {
24125
24125
  var CliSqliteInterrupted;
24126
24126
  var init_sqlite_errors = __esm({
24127
24127
  "../bridge/src/sqlite/sqlite-errors.ts"() {
24128
- "use strict";
24129
24128
  CliSqliteInterrupted = class extends Error {
24130
24129
  name = "CliSqliteInterrupted";
24131
24130
  constructor() {
@@ -24236,7 +24235,6 @@ function maybeLogCodeNavCacheWorkerError(message) {
24236
24235
  var diagnosticSink, lastDiagnosticKey;
24237
24236
  var init_code_nav_cache_log = __esm({
24238
24237
  "../bridge/src/sqlite/code-nav-cache/code-nav-cache-log.ts"() {
24239
- "use strict";
24240
24238
  init_log();
24241
24239
  init_sqlite_errors();
24242
24240
  init_sqlite_lock_path();
@@ -30450,7 +30448,7 @@ var {
30450
30448
  } = import_index.default;
30451
30449
 
30452
30450
  // src/cli-version.ts
30453
- var CLI_VERSION = "0.1.91".length > 0 ? "0.1.91" : "0.0.0-dev";
30451
+ var CLI_VERSION = "0.1.92".length > 0 ? "0.1.92" : "0.0.0-dev";
30454
30452
 
30455
30453
  // src/cli/defaults.ts
30456
30454
  var DEFAULT_API_URL = process.env.BUILDAUTOMATON_API_URL ?? "https://api.buildautomaton.com";
@@ -30606,6 +30604,7 @@ function createWsBridge(options) {
30606
30604
  });
30607
30605
  ws.on("open", () => {
30608
30606
  disposeClientPing();
30607
+ if (isActiveSocket && !isActiveSocket(ws)) return;
30609
30608
  if (clientPingIntervalMs != null && clientPingIntervalMs > 0) {
30610
30609
  clearClientPing = attachWebSocketClientPing(ws, clientPingIntervalMs);
30611
30610
  }
@@ -30625,10 +30624,12 @@ function createWsBridge(options) {
30625
30624
  });
30626
30625
  ws.on("close", (code, reason) => {
30627
30626
  disposeClientPing();
30628
- onClose?.(code, reason.toString());
30627
+ if (isActiveSocket && !isActiveSocket(ws)) return;
30628
+ onClose?.(code, reason.toString(), ws);
30629
30629
  });
30630
30630
  ws.on("error", (err) => {
30631
30631
  disposeClientPing();
30632
+ if (isActiveSocket && !isActiveSocket(ws)) return;
30632
30633
  onError2?.(err);
30633
30634
  });
30634
30635
  return ws;
@@ -30733,7 +30734,7 @@ function formatSpawnError(err, command) {
30733
30734
  }
30734
30735
 
30735
30736
  // ../bridge/src/agents/acp/clients/kill-process-tree.ts
30736
- var import_tree_kill = __toESM(require_tree_kill());
30737
+ var import_tree_kill = __toESM(require_tree_kill(), 1);
30737
30738
  import { promisify } from "node:util";
30738
30739
  var treeKillAsync = promisify(import_tree_kill.default);
30739
30740
  var ACP_PROCESS_TREE_KILL_GRACE_MS = 2500;
@@ -43743,7 +43744,7 @@ function createBridgeHeartbeatController(params) {
43743
43744
  }
43744
43745
 
43745
43746
  // ../bridge/src/cli/cli-version.ts
43746
- var CLI_VERSION2 = "0.1.91".length > 0 ? "0.1.91" : "0.0.0-dev";
43747
+ var CLI_VERSION2 = "0.1.92".length > 0 ? "0.1.92" : "0.0.0-dev";
43747
43748
 
43748
43749
  // ../bridge/src/connection/identify/send-bridge-identify.ts
43749
43750
  function sendBridgeIdentify(ws, params) {
@@ -55542,12 +55543,12 @@ function createMainBridgeAuthRefreshHandler(params, connect) {
55542
55543
  // ../bridge/src/connection/ws/main-bridge-ws-close-handler.ts
55543
55544
  function createMainBridgeCloseHandler(params, connect) {
55544
55545
  const { state, logFn, bridgeHeartbeat } = params;
55545
- return (code, reason) => {
55546
+ return (code, reason, closedWs) => {
55547
+ if (state.currentWs !== closedWs) return;
55546
55548
  bridgeHeartbeat?.stop();
55547
55549
  try {
55548
- const was = state.currentWs;
55549
55550
  state.currentWs = null;
55550
- if (was) was.removeAllListeners();
55551
+ closedWs.removeAllListeners();
55551
55552
  const willReconnect = !state.closedByUser;
55552
55553
  if (willReconnect) {
55553
55554
  const duplicateResult = evaluateDuplicateBridgeDisconnect(