conductor-remote 1.21.1 → 1.21.2

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/README.md CHANGED
@@ -220,6 +220,82 @@ dist/ built PWA (gitignored) — what the relay serves
220
220
  - The relay reads Conductor's SQLite DB **read-only** and never writes to it.
221
221
  Your data stays on your machine — nothing is sent anywhere.
222
222
 
223
+ ## Troubleshooting
224
+
225
+ ### The relay stops answering when the Mac is on battery
226
+
227
+ **Symptom.** On battery, the phone loses the relay after a few minutes — even
228
+ though the LaunchAgent is still running and a keep-awake app (Amphetamine,
229
+ KeepingYouAwake, `caffeinate`) is active. Plug into power and it recovers. This
230
+ bites anyone running the relay on an unplugged laptop; it is **not** a bug in
231
+ conductor-remote.
232
+
233
+ **Cause — it's *Maintenance Sleep*, not idle sleep.** Confirm the reason:
234
+
235
+ ```bash
236
+ pmset -g log | grep "Entering Sleep state due to" | tail
237
+ # 'Maintenance Sleep' / 'Sleep Service Back to Sleep' ← the culprit
238
+ # 'Idle Sleep' ← NOT what's happening
239
+ ```
240
+
241
+ macOS has two independent sleep paths, and the popular keep-awake tools only
242
+ reach one of them:
243
+
244
+ | Layer | Sleep type | Controlled by | Keep-awake apps reach it? |
245
+ | --- | --- | --- | --- |
246
+ | Idle timer | `Idle Sleep` | `PreventUserIdleSystemSleep` power assertion | ✅ yes |
247
+ | Standby / Power Nap | **`Maintenance Sleep`** | `pmset` `standby` / `powernap` | ❌ **no** |
248
+
249
+ Amphetamine, KeepingYouAwake and `caffeinate -i` all hold only the *idle*
250
+ assertion. On battery the Mac isn't idle-sleeping — it's cycling through
251
+ **standby maintenance sleep** (a periodic dark-wake → back-to-sleep loop) that
252
+ lives at the root `pmset` layer no assertion can touch. Running those tools with
253
+ `sudo` changes nothing: the assertion is identical at any privilege, and there is
254
+ no assertion for the standby layer. (Note: lid *closed* on Apple Silicon forces
255
+ sleep regardless — keep the lid open, or attach an external display **and** power.)
256
+
257
+ **Fix — act at the `pmset` layer (root).** Pick one:
258
+
259
+ *Always-on relay → a boot LaunchDaemon* (durable across reboots — `disablesleep`
260
+ alone does not survive a restart, which is why this is a daemon, not a one-off):
261
+
262
+ ```bash
263
+ sudo tee /Library/LaunchDaemons/dev.conductor-remote.nosleep.plist >/dev/null <<'PLIST'
264
+ <?xml version="1.0" encoding="UTF-8"?>
265
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
266
+ <plist version="1.0"><dict>
267
+ <key>Label</key><string>dev.conductor-remote.nosleep</string>
268
+ <key>ProgramArguments</key>
269
+ <array><string>/usr/bin/pmset</string><string>-b</string><string>disablesleep</string><string>1</string></array>
270
+ <key>RunAtLoad</key><true/>
271
+ </dict></plist>
272
+ PLIST
273
+ sudo launchctl bootstrap system /Library/LaunchDaemons/dev.conductor-remote.nosleep.plist
274
+ ```
275
+
276
+ *Occasional / time-boxed → a shell function* that blocks battery sleep for a
277
+ bounded window, then auto-reverts (on clean exit, Ctrl-C, or kill):
278
+
279
+ ```bash
280
+ nosleep() { # nosleep 1h | nosleep 30m | nosleep 90s (default 1h)
281
+ local a="${1:-1h}" s
282
+ case "$a" in *h) s=$(( ${a%h} * 3600 ));; *m) s=$(( ${a%m} * 60 ));; *s) s=${a%s};; *) s=$a;; esac
283
+ sudo sh -c "pmset -b standby 0 powernap 0 disablesleep 1
284
+ trap 'pmset -b standby 1 powernap 1 disablesleep 0' EXIT INT TERM
285
+ sleep $s"
286
+ }
287
+ ```
288
+
289
+ **Check / undo:**
290
+
291
+ ```bash
292
+ pmset -g | grep -i sleepdisabled # 1 = sleep blocked
293
+ sudo pmset -b standby 1 powernap 1 disablesleep 0 # restore defaults
294
+ ```
295
+
296
+ Once set, you can quit the keep-awake app entirely — it was only ever asserting on
297
+ the idle layer, which was never the problem.
298
+
223
299
  ## Disclaimer
224
300
 
225
301
  Unofficial and not affiliated with, endorsed by, or supported by Conductor. It