relay-companion 0.1.75 → 0.1.76

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relay-companion",
3
- "version": "0.1.75",
3
+ "version": "0.1.76",
4
4
  "description": "Relay companion for ordinary messages, with dormant coordination features available only by explicit opt-in.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -623,6 +623,13 @@ export function spawnDetachedUpdate({
623
623
  ` echo "[relay-update] $(date) electron runtime missing; running electron install.js" >> ${LOG} 2>&1`,
624
624
  ` "$NODE" "$ELECTRON_DIR/install.js" >> ${LOG} 2>&1 || true`,
625
625
  ` fi`,
626
+ // A half-extracted dist (binary present, Frameworks missing) SIGABRTs at
627
+ // launch and passed the old executable-only check. Force a clean re-extract.
628
+ ` ELECTRON_FRAMEWORKS="$ELECTRON_DIR/dist/Electron.app/Contents/Frameworks/Electron Framework.framework"`,
629
+ ` if [ -x "$ELECTRON" ] && [ ! -d "$ELECTRON_FRAMEWORKS" ] && [ -f "$ELECTRON_DIR/install.js" ]; then`,
630
+ ` echo "[relay-update] $(date) electron dist incomplete (no Frameworks); re-extracting" >> ${LOG} 2>&1`,
631
+ ` rm -rf "$ELECTRON_DIR/dist" 2>/dev/null; "$NODE" "$ELECTRON_DIR/install.js" >> ${LOG} 2>&1 || true`,
632
+ ` fi`,
626
633
  // Verify the package at the exact launchd-owned root reached the exact discovered
627
634
  // version. A mismatched prefix or stale npm response must never trigger restart.
628
635
  ` INSTALLED_VERSION="$("$NODE" -e 'process.stdout.write(require(process.argv[1]).version)' "$PKG/package.json" 2>/dev/null)"`,
@@ -631,7 +638,7 @@ export function spawnDetachedUpdate({
631
638
  ? ` VERSION_OK=0; if [ "$INSTALLED_VERSION" = ${q(target)} ]; then VERSION_OK=1; else echo "[relay-update] $(date) verify FAILED: installed $INSTALLED_VERSION != exact target ${target}" >> ${LOG} 2>&1; fi`
632
639
  : ` VERSION_OK=1`,
633
640
  ` DESKTOP_OK=0`,
634
- ` if [ "$VERSION_OK" = 1 ] && [ -x "$ELECTRON" ] && [ -f "$PKG/bin/relay.js" ] && grep -q '"version"' "$PKG/package.json" 2>/dev/null; then`,
641
+ ` if [ "$VERSION_OK" = 1 ] && [ -x "$ELECTRON" ] && [ -d "$ELECTRON_FRAMEWORKS" ] && [ -f "$PKG/bin/relay.js" ] && grep -q '"version"' "$PKG/package.json" 2>/dev/null; then`,
635
642
  // Rebuild version-coupled app/plist paths from the NEW package before restart.
636
643
  // --no-restart keeps sequencing here: pill first, daemon (our parent) last.
637
644
  ` if "$NODE" "$PKG/bin/relay.js" repair-desktop --no-restart${repairModeArgs ? ` ${repairModeArgs}` : ""} >> ${LOG} 2>&1; then DESKTOP_OK=1; else echo "[relay-update] $(date) desktop repair FAILED" >> ${LOG} 2>&1; fi`,
package/src/client.js CHANGED
@@ -1,4 +1,16 @@
1
1
  import { apiUrl, deviceToken } from "./config.js";
2
+ import { createRequire } from "node:module";
3
+
4
+ // Reported on every device-authenticated call so the server always knows which
5
+ // companion version each device runs — support and rollout questions get
6
+ // answered from data, never from screenshots.
7
+ const COMPANION_VERSION = (() => {
8
+ try {
9
+ return String(createRequire(import.meta.url)("../package.json").version || "");
10
+ } catch {
11
+ return "";
12
+ }
13
+ })();
2
14
 
3
15
  /** Thin authenticated client for relay-api, used by the CLI, MCP server, and daemon. */
4
16
  export class RelayClient {
@@ -9,6 +21,7 @@ export class RelayClient {
9
21
 
10
22
  async #req(method, path, body, { auth = true } = {}) {
11
23
  const headers = { "Content-Type": "application/json" };
24
+ if (COMPANION_VERSION) headers["x-relay-version"] = COMPANION_VERSION;
12
25
  if (auth && this.token) headers.Authorization = `Bearer ${this.token}`;
13
26
  const res = await fetch(`${this.url}${path}`, {
14
27
  method,