@cabane/companion 0.6.199 → 0.6.200

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
@@ -14179,6 +14179,10 @@ var CompanionSupervisor = class {
14179
14179
  // Whether the device stream is open, which is what every workspace's link on
14180
14180
  // the dashboard reports.
14181
14181
  deviceConnected = false;
14182
+ // Set when the device stream ended on a 403: the device was deactivated, not
14183
+ // unpaired. The next accepted heartbeat proves it was reactivated, and
14184
+ // reopens the stream.
14185
+ deviceStreamDeactivated = false;
14182
14186
  recoveryChecked = false;
14183
14187
  recovering = false;
14184
14188
  heartbeated = false;
@@ -14314,7 +14318,15 @@ var CompanionSupervisor = class {
14314
14318
  }
14315
14319
  if (ev.event === "message") await this.handleDeviceMessage(ev);
14316
14320
  },
14317
- onAuthFailure: () => {
14321
+ onAuthFailure: (status2) => {
14322
+ if (status2 === 403) {
14323
+ this.deviceStreamDeactivated = true;
14324
+ this.heartbeatTimer?.ref();
14325
+ this.log.warn(
14326
+ "This device was deactivated in Cabane. The companion will reconnect once it is reactivated."
14327
+ );
14328
+ return;
14329
+ }
14318
14330
  this.log.error(
14319
14331
  `Cabane no longer accepts this device. Run ${cabane("logout")}, then ${cabane("setup")} to pair again.`
14320
14332
  );
@@ -14404,6 +14416,12 @@ var CompanionSupervisor = class {
14404
14416
  lastAcknowledgedDevice: view.success ? view.data : null,
14405
14417
  lastHeartbeatRefused: false
14406
14418
  };
14419
+ if (this.deviceStreamDeactivated && this.deviceSub && !this.stopped) {
14420
+ this.deviceStreamDeactivated = false;
14421
+ this.heartbeatTimer?.unref();
14422
+ this.log.info("This device was reactivated; reconnecting to Cabane.");
14423
+ this.deviceSub.start();
14424
+ }
14407
14425
  void this.recoverRuns();
14408
14426
  void this.updater?.onHeartbeat(res.companion, this.deviceConnected).catch(
14409
14427
  (err) => this.log.warn(
package/dist/runtime.js CHANGED
@@ -9789,6 +9789,10 @@ var CompanionSupervisor = class {
9789
9789
  // Whether the device stream is open, which is what every workspace's link on
9790
9790
  // the dashboard reports.
9791
9791
  deviceConnected = false;
9792
+ // Set when the device stream ended on a 403: the device was deactivated, not
9793
+ // unpaired. The next accepted heartbeat proves it was reactivated, and
9794
+ // reopens the stream.
9795
+ deviceStreamDeactivated = false;
9792
9796
  recoveryChecked = false;
9793
9797
  recovering = false;
9794
9798
  heartbeated = false;
@@ -9924,7 +9928,15 @@ var CompanionSupervisor = class {
9924
9928
  }
9925
9929
  if (ev.event === "message") await this.handleDeviceMessage(ev);
9926
9930
  },
9927
- onAuthFailure: () => {
9931
+ onAuthFailure: (status) => {
9932
+ if (status === 403) {
9933
+ this.deviceStreamDeactivated = true;
9934
+ this.heartbeatTimer?.ref();
9935
+ this.log.warn(
9936
+ "This device was deactivated in Cabane. The companion will reconnect once it is reactivated."
9937
+ );
9938
+ return;
9939
+ }
9928
9940
  this.log.error(
9929
9941
  `Cabane no longer accepts this device. Run ${cabane("logout")}, then ${cabane("setup")} to pair again.`
9930
9942
  );
@@ -10014,6 +10026,12 @@ var CompanionSupervisor = class {
10014
10026
  lastAcknowledgedDevice: view.success ? view.data : null,
10015
10027
  lastHeartbeatRefused: false
10016
10028
  };
10029
+ if (this.deviceStreamDeactivated && this.deviceSub && !this.stopped) {
10030
+ this.deviceStreamDeactivated = false;
10031
+ this.heartbeatTimer?.unref();
10032
+ this.log.info("This device was reactivated; reconnecting to Cabane.");
10033
+ this.deviceSub.start();
10034
+ }
10017
10035
  void this.recoverRuns();
10018
10036
  void this.updater?.onHeartbeat(res.companion, this.deviceConnected).catch(
10019
10037
  (err) => this.log.warn(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cabane/companion",
3
- "version": "0.6.199",
3
+ "version": "0.6.200",
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",