@cabane/companion 0.6.161 → 0.6.162

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
@@ -13486,7 +13486,12 @@ var CompanionUpdater = class {
13486
13486
  const stage = this.deps.stage ?? stageVersion;
13487
13487
  this.staging = (async () => {
13488
13488
  this.deps.log.info({ version }, `Installing Cabane ${version} beside this one`);
13489
- const outcome = await stage(version, this.deps.harnesses());
13489
+ let outcome;
13490
+ try {
13491
+ outcome = await stage(version, this.deps.harnesses());
13492
+ } catch (err) {
13493
+ outcome = { ok: false, reason: err instanceof Error ? err.message : String(err) };
13494
+ }
13490
13495
  if (outcome.ok) {
13491
13496
  this.ready = version;
13492
13497
  this.readyAt = this.now();
@@ -13526,11 +13531,16 @@ var CompanionUpdater = class {
13526
13531
  })().finally(() => {
13527
13532
  this.staging = null;
13528
13533
  });
13529
- void this.staging.then(() => this.trySwap());
13534
+ this.staging.then(() => this.trySwap()).catch(
13535
+ (err) => this.deps.log.warn(
13536
+ { version, err: err instanceof Error ? err.message : String(err) },
13537
+ `Couldn't update to Cabane ${version}; trying again on a later check-in`
13538
+ )
13539
+ );
13530
13540
  }
13531
13541
  // Swap into the ready version: when nothing is running, when it has waited `SWAP_WAIT_MS` for
13532
13542
  // that, when this version is below the server's minimum, or `now` (the person asked). Called on
13533
- // each heartbeat until it does.
13543
+ // each heartbeat until it does, and only while auto-update is on unless the person asked.
13534
13544
  async trySwap(now = false) {
13535
13545
  const to = this.ready;
13536
13546
  if (!to || this.swapping) return;
@@ -13540,6 +13550,7 @@ var CompanionUpdater = class {
13540
13550
  this.deps.log.info({ version: to }, `Cabane ${to} is installed; it runs from the next start`);
13541
13551
  return;
13542
13552
  }
13553
+ if (!now && !this.updatesItself()) return;
13543
13554
  if (!now && !this.deps.isIdle() && !this.waitedLongEnough() && !this.belowMinimum()) return;
13544
13555
  this.swapping = true;
13545
13556
  try {
package/dist/runtime.js CHANGED
@@ -13699,7 +13699,12 @@ var CompanionUpdater = class {
13699
13699
  const stage = this.deps.stage ?? stageVersion;
13700
13700
  this.staging = (async () => {
13701
13701
  this.deps.log.info({ version }, `Installing Cabane ${version} beside this one`);
13702
- const outcome = await stage(version, this.deps.harnesses());
13702
+ let outcome;
13703
+ try {
13704
+ outcome = await stage(version, this.deps.harnesses());
13705
+ } catch (err) {
13706
+ outcome = { ok: false, reason: err instanceof Error ? err.message : String(err) };
13707
+ }
13703
13708
  if (outcome.ok) {
13704
13709
  this.ready = version;
13705
13710
  this.readyAt = this.now();
@@ -13739,11 +13744,16 @@ var CompanionUpdater = class {
13739
13744
  })().finally(() => {
13740
13745
  this.staging = null;
13741
13746
  });
13742
- void this.staging.then(() => this.trySwap());
13747
+ this.staging.then(() => this.trySwap()).catch(
13748
+ (err) => this.deps.log.warn(
13749
+ { version, err: err instanceof Error ? err.message : String(err) },
13750
+ `Couldn't update to Cabane ${version}; trying again on a later check-in`
13751
+ )
13752
+ );
13743
13753
  }
13744
13754
  // Swap into the ready version: when nothing is running, when it has waited `SWAP_WAIT_MS` for
13745
13755
  // that, when this version is below the server's minimum, or `now` (the person asked). Called on
13746
- // each heartbeat until it does.
13756
+ // each heartbeat until it does, and only while auto-update is on unless the person asked.
13747
13757
  async trySwap(now = false) {
13748
13758
  const to = this.ready;
13749
13759
  if (!to || this.swapping) return;
@@ -13753,6 +13763,7 @@ var CompanionUpdater = class {
13753
13763
  this.deps.log.info({ version: to }, `Cabane ${to} is installed; it runs from the next start`);
13754
13764
  return;
13755
13765
  }
13766
+ if (!now && !this.updatesItself()) return;
13756
13767
  if (!now && !this.deps.isIdle() && !this.waitedLongEnough() && !this.belowMinimum()) return;
13757
13768
  this.swapping = true;
13758
13769
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cabane/companion",
3
- "version": "0.6.161",
3
+ "version": "0.6.162",
4
4
  "type": "module",
5
5
  "description": "The Cabane Companion (headless): connect an agent on your machine to your Cabane workspace as a responder — drive work against your own codebase, files, and MCP servers without putting any of it in Cabane.",
6
6
  "license": "UNLICENSED",