@zeph-to/cli 2.14.0 → 2.16.0
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 +44 -3
- package/dist/cli.js +11 -2
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/gate.d.ts +8 -3
- package/dist/gate.d.ts.map +1 -1
- package/dist/gate.js +6 -5
- package/dist/keep-awake.d.ts +32 -0
- package/dist/keep-awake.d.ts.map +1 -0
- package/dist/keep-awake.js +43 -0
- package/dist/listener.d.ts +7 -0
- package/dist/listener.d.ts.map +1 -1
- package/dist/listener.js +79 -6
- package/dist/presence.d.ts +14 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +84 -0
- package/dist/remote-agents.d.ts +35 -0
- package/dist/remote-agents.d.ts.map +1 -1
- package/dist/remote-agents.js +60 -1
- package/dist/session-registry.d.ts +8 -1
- package/dist/session-registry.d.ts.map +1 -1
- package/dist/session-registry.js +7 -14
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +3 -2
- package/dist/test-state-dir.d.ts +10 -0
- package/dist/test-state-dir.d.ts.map +1 -0
- package/dist/test-state-dir.js +32 -0
- package/dist/transcript-tail.d.ts +147 -0
- package/dist/transcript-tail.d.ts.map +1 -0
- package/dist/transcript-tail.js +397 -0
- package/dist/turn-ring.d.ts +85 -0
- package/dist/turn-ring.d.ts.map +1 -0
- package/dist/turn-ring.js +280 -0
- package/dist/turn-watch.d.ts +151 -0
- package/dist/turn-watch.d.ts.map +1 -0
- package/dist/turn-watch.js +502 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,7 +49,9 @@ binary.
|
|
|
49
49
|
Once installed, the hooks fire in **every** session of each configured
|
|
50
50
|
agent — `zeph cc` is the phone-control bridge, not the notification
|
|
51
51
|
switch. In Claude Code the routine per-turn push starts off (`quiet` is
|
|
52
|
-
the default)
|
|
52
|
+
the default) — while you're at the terminal; once you've stepped away, a
|
|
53
|
+
finished turn still pushes ([Quiet while away](#quiet-while-away)).
|
|
54
|
+
`/zeph-normal` turns it on for a project, `/zeph-loud`
|
|
53
55
|
pushes on every turn, `/zeph-mute` silences a project entirely, and
|
|
54
56
|
`/zeph-status` shows what's in effect. See
|
|
55
57
|
[Mute & push mode](#mute--push-mode).
|
|
@@ -337,6 +339,24 @@ With the service installed, launchd owns the process: `zeph cc` and
|
|
|
337
339
|
`zeph listener --stop|--restart` ask launchd rather than signalling the
|
|
338
340
|
PID, so there is never a second daemon racing the first.
|
|
339
341
|
|
|
342
|
+
### Keeping the Mac awake
|
|
343
|
+
|
|
344
|
+
The listener holds an *outbound* socket, and macOS **"Wake for network
|
|
345
|
+
access" does not protect it** — that setting only wakes the machine for
|
|
346
|
+
inbound requests to services it advertises. When the Mac idle-sleeps, the
|
|
347
|
+
socket dies and the phone shows "Waiting for the live stream…" until
|
|
348
|
+
someone opens the lid. A Mac running Claude Code hides this (the agent
|
|
349
|
+
runs `caffeinate` during every turn), so one machine looks fine while
|
|
350
|
+
another, idling at a prompt, keeps dropping.
|
|
351
|
+
|
|
352
|
+
So on macOS the listener runs `caffeinate -s -w <its pid>` for as long as
|
|
353
|
+
it lives. `-s` is honoured **on AC power only** — on battery macOS ignores
|
|
354
|
+
it, so a laptop still sleeps and nothing drains. The display still turns
|
|
355
|
+
off; a closed lid still sleeps. Activity Monitor shows the daemon under
|
|
356
|
+
"Preventing Sleep". Opt out with `--no-keep-awake` or `"keepAwake": false`
|
|
357
|
+
in `~/.zeph/config.json`; the log's `keep-awake:` line says which way it
|
|
358
|
+
went.
|
|
359
|
+
|
|
340
360
|
### Diagnostics
|
|
341
361
|
|
|
342
362
|
The auto-spawned listener writes to three files under `~/.zeph/`:
|
|
@@ -573,6 +593,7 @@ which project + branch finished without writing per-IDE wrappers. Pass
|
|
|
573
593
|
| `--base-url <url>` | REST API base URL (or set `ZEPH_BASE_URL` env, or `baseUrl` in `~/.zeph/config.json`) |
|
|
574
594
|
| `--stop` | Stop the running daemon and clear its PID/version stamps |
|
|
575
595
|
| `--restart` | Stop it and relaunch detached (logs to `~/.zeph/listener.log`) |
|
|
596
|
+
| `--no-keep-awake` | Don't hold the Mac awake on AC power (macOS). Lasting form: `"keepAwake": false` in `~/.zeph/config.json` |
|
|
576
597
|
|
|
577
598
|
The listener reconnects with exponential backoff + jitter (1 s → 30 s
|
|
578
599
|
cap). Heartbeat is ping every 25 s with a 10 s pong timeout. On an
|
|
@@ -631,8 +652,8 @@ this order — first hit wins:
|
|
|
631
652
|
It is now `quiet`, so upgrading turns the routine per-turn push off until
|
|
632
653
|
you run `/zeph-normal`. Row 4 is why the hooks this CLI installs are
|
|
633
654
|
unaffected: they name `normal` themselves, since a hook that supplies no
|
|
634
|
-
`high` marker would be
|
|
635
|
-
merely quieter. Row 4 sits *below* the state files on purpose — the flag
|
|
655
|
+
`high` marker would be silent under `quiet` whenever you're at the terminal,
|
|
656
|
+
rather than merely quieter. Row 4 sits *below* the state files on purpose — the flag
|
|
636
657
|
names a default, it does not override a dial the user set.
|
|
637
658
|
|
|
638
659
|
Under `normal` the JSON hook configs push on every turn, because they see
|
|
@@ -643,6 +664,26 @@ others cannot: a turn with no tool calls, a turn with exactly one (a
|
|
|
643
664
|
lone edit included — the gate wants two), and a turn whose calls were
|
|
644
665
|
all reads. `/zeph-loud` still pushes on all of them.
|
|
645
666
|
|
|
667
|
+
#### Quiet while away
|
|
668
|
+
|
|
669
|
+
`quiet` silences routine pushes because you are watching the pane. When
|
|
670
|
+
you've walked away, nobody is, so `notify --auto` under `quiet` still sends
|
|
671
|
+
the push (normal priority) once it decides you're away. It checks three
|
|
672
|
+
signals, and the first that answers wins:
|
|
673
|
+
|
|
674
|
+
1. Inside tmux and **no client attached to the tmux server** → away.
|
|
675
|
+
2. Not over SSH and macOS `ioreg` reports **`HIDIdleTime`** (system-wide
|
|
676
|
+
input idle) → that alone decides. Inside tmux, "over SSH" follows the
|
|
677
|
+
session environment tmux refreshes on each attach, not the value frozen
|
|
678
|
+
at server start.
|
|
679
|
+
3. Inside tmux → the newest tmux **`client_activity`** (SSH and non-macOS).
|
|
680
|
+
|
|
681
|
+
Anything unreadable counts as present. The threshold is `ZEPH_AWAY_SEC`
|
|
682
|
+
seconds in the hook's environment (default `300`, `0` turns detection off,
|
|
683
|
+
and a non-number falls back to the default). The probe runs only on a
|
|
684
|
+
quiet turn with no `high` marker. The Claude Code plugin's Stop hook
|
|
685
|
+
applies the same rule (`zeph_is_away` in its `hooks/gate.sh`).
|
|
686
|
+
|
|
646
687
|
A dial file that exists but reads empty resolves to `normal`, not to row
|
|
647
688
|
5: an empty file is a failed write, and resolving breakage to silence
|
|
648
689
|
leaves no symptom to debug.
|
package/dist/cli.js
CHANGED
|
@@ -15,6 +15,7 @@ const mcp_js_1 = require("./mcp.js");
|
|
|
15
15
|
const listener_js_1 = require("./listener.js");
|
|
16
16
|
const config_js_1 = require("./config.js");
|
|
17
17
|
const gate_js_1 = require("./gate.js");
|
|
18
|
+
const presence_js_1 = require("./presence.js");
|
|
18
19
|
const remote_agents_js_1 = require("./remote-agents.js");
|
|
19
20
|
const remote_hook_js_1 = require("./remote-hook.js");
|
|
20
21
|
const detectBranchAndProject = () => {
|
|
@@ -104,6 +105,10 @@ ${usageAgentLines()}
|
|
|
104
105
|
remove the login-time service
|
|
105
106
|
--service-status
|
|
106
107
|
show what the installed service points at
|
|
108
|
+
--no-keep-awake
|
|
109
|
+
don't hold the Mac awake on AC power
|
|
110
|
+
(macOS; default runs 'caffeinate -s' so an
|
|
111
|
+
idle Mac keeps the socket up)
|
|
107
112
|
|
|
108
113
|
Notify options:
|
|
109
114
|
--title <text> Push title
|
|
@@ -282,13 +287,17 @@ const handleNotify = async (args) => {
|
|
|
282
287
|
// always-push behavior in normal mode, while the /zeph-quiet | /zeph-loud
|
|
283
288
|
// dial now works for every hook-driven agent. Gated-out → silent success.
|
|
284
289
|
// With no dial the mode falls back to --pushmode-default, then to quiet.
|
|
290
|
+
// Quiet still pushes when the user has left the terminal (presence.ts).
|
|
285
291
|
if (args.auto === true) {
|
|
292
|
+
const marker = (0, gate_js_1.normalizeMarker)(typeof args.marker === 'string' ? args.marker : undefined);
|
|
293
|
+
const pushMode = (0, gate_js_1.autoPushMode)(projectDir, args[gate_js_1.PUSHMODE_DEFAULT_FLAG]);
|
|
286
294
|
const verdict = (0, gate_js_1.decidePush)({
|
|
287
295
|
toolCount: gateCount(args[gate_js_1.TOOL_COUNT_FLAG], gate_js_1.GATE_DEFAULTS.toolCount),
|
|
288
296
|
nonReadonlyCount: gateCount(args[gate_js_1.NONREADONLY_COUNT_FLAG], gate_js_1.GATE_DEFAULTS.nonReadonlyCount),
|
|
289
297
|
alreadyAsked: gate_js_1.GATE_DEFAULTS.alreadyAsked,
|
|
290
|
-
marker
|
|
291
|
-
pushMode
|
|
298
|
+
marker,
|
|
299
|
+
pushMode,
|
|
300
|
+
away: (0, presence_js_1.awayForGate)(pushMode, marker),
|
|
292
301
|
});
|
|
293
302
|
if (!verdict.push)
|
|
294
303
|
return 0;
|
package/dist/config.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export interface ZephConfig {
|
|
|
6
6
|
baseUrl?: string;
|
|
7
7
|
wsUrl?: string;
|
|
8
8
|
deviceId?: string;
|
|
9
|
+
/** `false` stops the listener holding the Mac awake on AC (`caffeinate -s`). README § Listener Options. */
|
|
10
|
+
keepAwake?: boolean;
|
|
9
11
|
}
|
|
10
12
|
export declare const resolvedEnv: (key: string, env?: NodeJS.ProcessEnv) => string | undefined;
|
|
11
13
|
/**
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,QAA2B,CAAC;AACnD,eAAO,MAAM,WAAW,QAAkC,CAAC;AAE3D,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,QAA2B,CAAC;AACnD,eAAO,MAAM,WAAW,QAAkC,CAAC;AAE3D,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2GAA2G;IAC3G,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,MAAK,MAAM,CAAC,UAAwB,KAAG,MAAM,GAAG,SAGxF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,MAAK,MAAM,CAAC,UAAwB,KAAG,MAAM,GAAG,SACrB,CAAC;AAM1D,eAAO,MAAM,oBAAoB,+EAAgF,CAAC;AAElH,sFAAsF;AACtF,eAAO,MAAM,gBAAgB,QAAO,MAMnC,CAAC;AAIF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,QAAO,UAqB7B,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,QAAQ,UAAU,KAAG,IAM/C,CAAC;AAEF,eAAO,MAAM,OAAO,QAOhB,CAAC"}
|
package/dist/gate.d.ts
CHANGED
|
@@ -9,6 +9,10 @@ export interface GateInput {
|
|
|
9
9
|
alreadyAsked: boolean;
|
|
10
10
|
marker: GateMarker;
|
|
11
11
|
pushMode: GatePushMode;
|
|
12
|
+
/** The user is away from the terminal (presence.ts awayForGate) — lets quiet
|
|
13
|
+
* push. Optional so existing callers keep compiling; absent = present,
|
|
14
|
+
* matching the bash twin's missing 6th argument. */
|
|
15
|
+
away?: boolean;
|
|
12
16
|
}
|
|
13
17
|
export interface GateVerdict {
|
|
14
18
|
push: boolean;
|
|
@@ -21,9 +25,10 @@ export interface GateVerdict {
|
|
|
21
25
|
* hooks — while quiet/loud now work everywhere.
|
|
22
26
|
*
|
|
23
27
|
* These defaults cannot rescue a quiet dial: quiet only lets a `high` marker
|
|
24
|
-
* through, and a hook with no turn facts has no
|
|
25
|
-
* the installed templates pass `--pushmode-default
|
|
26
|
-
* — for them quiet is not a lower volume, it is
|
|
28
|
+
* or an away user (presence.ts) through, and a hook with no turn facts has no
|
|
29
|
+
* marker either. That is why the installed templates pass `--pushmode-default
|
|
30
|
+
* normal` (see templates.ts) — for them quiet is not a lower volume, it is
|
|
31
|
+
* silence while the user is at the terminal.
|
|
27
32
|
*/
|
|
28
33
|
export declare const GATE_DEFAULTS: {
|
|
29
34
|
readonly toolCount: 2;
|
package/dist/gate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAyBA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEvD,MAAM,WAAW,SAAS;IACxB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,gBAAgB,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAyBA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAA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,OAsB1E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,EAAE,MAAK,MAAM,MAAiB,KAAG,IAS7E,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,IAQ/C,CAAC;AAEF,0DAA0D;AAC1D,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,KAAG,OAGrC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,YAAsB,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,GACvB,KAAK,MAAM,EACX,WAAU,YAA+B,KACxC,YAUF,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,EAAE,MAAM,MAAM,GAAG,OAAO,GAAG,SAAS,KAAG,YACW,CAAC"}
|
package/dist/gate.js
CHANGED
|
@@ -15,7 +15,7 @@ exports.autoPushMode = exports.readPushMode = exports.NONREADONLY_COUNT_FLAG = e
|
|
|
15
15
|
* 1. alreadyAsked wins over EVERYTHING — even loud (dedup beats the dial).
|
|
16
16
|
* 2. priority is high iff marker === 'high', decided BEFORE the mode
|
|
17
17
|
* switch, so quiet+high and loud+high both push at high priority.
|
|
18
|
-
* 3. quiet →
|
|
18
|
+
* 3. quiet → a high marker or an away user pushes; loud → always push; normal →
|
|
19
19
|
* marker overrides the heuristic (skip → silent, push/high → push),
|
|
20
20
|
* no marker → push iff toolCount ≥ 2 AND nonReadonlyCount > 0
|
|
21
21
|
* (the B1 read-only floor).
|
|
@@ -32,9 +32,10 @@ const path_1 = require("path");
|
|
|
32
32
|
* hooks — while quiet/loud now work everywhere.
|
|
33
33
|
*
|
|
34
34
|
* These defaults cannot rescue a quiet dial: quiet only lets a `high` marker
|
|
35
|
-
* through, and a hook with no turn facts has no
|
|
36
|
-
* the installed templates pass `--pushmode-default
|
|
37
|
-
* — for them quiet is not a lower volume, it is
|
|
35
|
+
* or an away user (presence.ts) through, and a hook with no turn facts has no
|
|
36
|
+
* marker either. That is why the installed templates pass `--pushmode-default
|
|
37
|
+
* normal` (see templates.ts) — for them quiet is not a lower volume, it is
|
|
38
|
+
* silence while the user is at the terminal.
|
|
38
39
|
*/
|
|
39
40
|
exports.GATE_DEFAULTS = {
|
|
40
41
|
toolCount: 2,
|
|
@@ -50,7 +51,7 @@ const decidePush = (input) => {
|
|
|
50
51
|
return { push: false, priority: 'normal' };
|
|
51
52
|
const priority = input.marker === 'high' ? 'high' : 'normal';
|
|
52
53
|
if (input.pushMode === 'quiet')
|
|
53
|
-
return { push: input.marker === 'high', priority };
|
|
54
|
+
return { push: input.marker === 'high' || input.away === true, priority };
|
|
54
55
|
if (input.pushMode === 'loud')
|
|
55
56
|
return { push: true, priority };
|
|
56
57
|
if (input.marker === 'skip')
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Keep the host awake while the listener runs — macOS only.
|
|
4
|
+
*
|
|
5
|
+
* The listener holds an OUTBOUND WebSocket. macOS "Wake for network access"
|
|
6
|
+
* only wakes the machine for inbound requests to Bonjour-advertised services,
|
|
7
|
+
* so it does nothing for us: when the Mac idle-sleeps, the socket dies and the
|
|
8
|
+
* phone sits on "Waiting for the live stream…" until the lid is opened. On a
|
|
9
|
+
* machine that runs Claude Code this is masked — the agent spawns
|
|
10
|
+
* `caffeinate -i -t 300` while a turn is running — which is why one Mac looks
|
|
11
|
+
* fine and another, idling at a prompt, keeps dropping.
|
|
12
|
+
*
|
|
13
|
+
* `caffeinate -s -w <pid>`: `-s` blocks system sleep and is honoured ONLY on
|
|
14
|
+
* AC power (macOS drops the assertion on battery, so this never drains a
|
|
15
|
+
* laptop); `-w` releases it the moment our pid exits, so a crashed daemon
|
|
16
|
+
* leaves no orphan holding the machine up. The display still sleeps; a closed
|
|
17
|
+
* lid still sleeps — those are the user's call, not ours.
|
|
18
|
+
*/
|
|
19
|
+
export interface KeepAwakeOptions {
|
|
20
|
+
/** `false` = `--no-keep-awake` / `"keepAwake": false` in config. */
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
log: (msg: string) => void;
|
|
23
|
+
platform?: NodeJS.Platform;
|
|
24
|
+
pid?: number;
|
|
25
|
+
spawnFn?: typeof spawn;
|
|
26
|
+
}
|
|
27
|
+
export interface KeepAwake {
|
|
28
|
+
/** Release the assertion now rather than at process exit. Idempotent. */
|
|
29
|
+
stop: () => void;
|
|
30
|
+
}
|
|
31
|
+
export declare const startKeepAwake: (opts: KeepAwakeOptions) => KeepAwake;
|
|
32
|
+
//# sourceMappingURL=keep-awake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keep-awake.d.ts","sourceRoot":"","sources":["../src/keep-awake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,gBAAgB;IAC7B,oEAAoE;IACpE,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAED,MAAM,WAAW,SAAS;IACtB,yEAAyE;IACzE,IAAI,EAAE,MAAM,IAAI,CAAC;CACpB;AAID,eAAO,MAAM,cAAc,GAAI,MAAM,gBAAgB,KAAG,SAoCvD,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startKeepAwake = void 0;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const NOOP = { stop: () => undefined };
|
|
6
|
+
const startKeepAwake = (opts) => {
|
|
7
|
+
if (!opts.enabled) {
|
|
8
|
+
opts.log('keep-awake: off — the Mac may idle-sleep and drop the socket');
|
|
9
|
+
return NOOP;
|
|
10
|
+
}
|
|
11
|
+
if ((opts.platform ?? process.platform) !== 'darwin')
|
|
12
|
+
return NOOP;
|
|
13
|
+
const pid = opts.pid ?? process.pid;
|
|
14
|
+
const spawnFn = opts.spawnFn ?? node_child_process_1.spawn;
|
|
15
|
+
const child = spawnFn('caffeinate', ['-s', '-w', String(pid)], { stdio: 'ignore' });
|
|
16
|
+
let stopped = false;
|
|
17
|
+
// ENOENT and friends arrive here, asynchronously — spawn itself does not
|
|
18
|
+
// throw for a missing binary. Not fatal: the listener works without it,
|
|
19
|
+
// the machine just sleeps like it did before.
|
|
20
|
+
child.on('error', (err) => {
|
|
21
|
+
stopped = true;
|
|
22
|
+
opts.log(`! keep-awake: caffeinate unavailable (${err.message}) — the Mac may idle-sleep and drop the socket`);
|
|
23
|
+
});
|
|
24
|
+
child.on('exit', (code, signal) => {
|
|
25
|
+
if (stopped)
|
|
26
|
+
return;
|
|
27
|
+
stopped = true;
|
|
28
|
+
opts.log(`! keep-awake: caffeinate exited early (${code ?? signal}) — the Mac may idle-sleep and drop the socket`);
|
|
29
|
+
});
|
|
30
|
+
// Never keep the event loop alive on the child's account: the daemon's
|
|
31
|
+
// lifetime is the socket loop's, and `-w` ties caffeinate to it anyway.
|
|
32
|
+
child.unref();
|
|
33
|
+
opts.log(`keep-awake: caffeinate -s -w ${pid} — blocks idle sleep on AC power only (--no-keep-awake to disable)`);
|
|
34
|
+
return {
|
|
35
|
+
stop: () => {
|
|
36
|
+
if (stopped)
|
|
37
|
+
return;
|
|
38
|
+
stopped = true;
|
|
39
|
+
child.kill();
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
exports.startKeepAwake = startKeepAwake;
|
package/dist/listener.d.ts
CHANGED
|
@@ -314,6 +314,13 @@ export interface SessionForgetResult {
|
|
|
314
314
|
requestId: string;
|
|
315
315
|
sessionName: string;
|
|
316
316
|
forgotten?: true;
|
|
317
|
+
/**
|
|
318
|
+
* Set when the record went but the chat scrollback file would not delete.
|
|
319
|
+
* The session is no longer resumable either way; this says the prompts and
|
|
320
|
+
* tool targets it collected are still on the machine, which a flat
|
|
321
|
+
* `forgotten: true` would have claimed otherwise.
|
|
322
|
+
*/
|
|
323
|
+
scrollbackKept?: true;
|
|
317
324
|
error?: string;
|
|
318
325
|
at: string;
|
|
319
326
|
}
|
package/dist/listener.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../src/listener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AA6BH,OAAO,EAA0C,KAAK,SAAS,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAUxH,OAAO,EAAiD,KAAK,UAAU,EAA4C,MAAM,kBAAkB,CAAC;AAG5I,OAAO,EAA4E,KAAK,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACvI,OAAO,EAA6C,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAmCtG,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAElD,UAAU,YAAY;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;;;;;;;;;;;OAYG;IACH,mBAAmB,CAAC,EAAE,MAAM,GAA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yEF,eAAO,MAAM,oBAAoB,GAAI,KAAK;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,KAAG,IAE/E,CAAC;AA2FF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GACtB,MAAK,MAAmB,EACxB,MAAK,MAAwB,EAC7B,MAAK,MAA0B,KAChC,MAaF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GACnB,MAAM,QAAQ,EACd,OAAM,cAAmB,KAC1B,OAAO,CAAC,OAAO,CAgDjB,CAAC;AAcF,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,KAAG,MAIhD,CAAC;AA4DF,eAAO,MAAM,uBAAuB,GAAI,OAAO,MAAM,KAAG,MA2BvD,CAAC;AAySF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA+H3C,eAAO,MAAM,cAAc,GAAU,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAG,OAAO,CAAC,MAAM,CAoK3F,CAAC"}
|
package/dist/listener.js
CHANGED
|
@@ -44,7 +44,10 @@ const agent_state_js_1 = require("./agent-state.js");
|
|
|
44
44
|
const inventory_offload_js_1 = require("./inventory-offload.js");
|
|
45
45
|
const agent_rules_fetch_js_1 = require("./agent-rules-fetch.js");
|
|
46
46
|
const crypto_js_1 = require("./crypto.js");
|
|
47
|
+
const turn_watch_js_1 = require("./turn-watch.js");
|
|
48
|
+
const turn_ring_js_1 = require("./turn-ring.js");
|
|
47
49
|
const input_sequencer_js_1 = require("./input-sequencer.js");
|
|
50
|
+
const keep_awake_js_1 = require("./keep-awake.js");
|
|
48
51
|
const PING_INTERVAL_MS = 25_000;
|
|
49
52
|
const PONG_TIMEOUT_MS = 10_000;
|
|
50
53
|
const RECONNECT_BASE_MS = 1_000;
|
|
@@ -1229,10 +1232,18 @@ const handleSessionForgetRequest = (req, send) => {
|
|
|
1229
1232
|
return reply({ error: 'rate_limited' });
|
|
1230
1233
|
if (sessionExists(sessionName))
|
|
1231
1234
|
return reply({ error: 'still_running' });
|
|
1232
|
-
|
|
1235
|
+
const outcome = (0, session_registry_js_1.forgetSession)(sessionName);
|
|
1236
|
+
if (outcome === 'unknown') {
|
|
1233
1237
|
log(`✗ forget ${sessionName}: never seen on this machine`);
|
|
1234
1238
|
return reply({ error: 'unknown_session' });
|
|
1235
1239
|
}
|
|
1240
|
+
if (outcome === 'scrollback_kept') {
|
|
1241
|
+
// The registry entry is gone, so the session is no longer resumable —
|
|
1242
|
+
// but its chat scrollback would not delete, and answering a flat
|
|
1243
|
+
// "forgotten" would overstate what actually happened.
|
|
1244
|
+
log(`🗑 forget ${sessionName}: dropped from the record, but its chat scrollback would not delete`);
|
|
1245
|
+
return reply({ forgotten: true, scrollbackKept: true });
|
|
1246
|
+
}
|
|
1236
1247
|
log(`🗑 forget ${sessionName}: dropped from this machine's record`);
|
|
1237
1248
|
return reply({ forgotten: true });
|
|
1238
1249
|
};
|
|
@@ -1620,6 +1631,35 @@ const STREAM_LOG_INTERVAL_MS = 5_000;
|
|
|
1620
1631
|
/** How far a start (and each renew) pushes the deadline out. */
|
|
1621
1632
|
const leaseFor = (renewing) => (renewing ? exports.STREAM_LEASE_MS : STREAM_MAX_MS);
|
|
1622
1633
|
const activeStreams = new Map();
|
|
1634
|
+
/**
|
|
1635
|
+
* The live agent-chat timeline (`turn-watch.ts`), kept beside `activeStreams`
|
|
1636
|
+
* rather than inside it: both are per-session and both end on socket close, but
|
|
1637
|
+
* their lifetimes are driven by different things — a tmux pane for one, a
|
|
1638
|
+
* viewer's lease over a growing file for the other — and merging them would tie
|
|
1639
|
+
* a terminal mirror's death to a chat tab's.
|
|
1640
|
+
*/
|
|
1641
|
+
const turnWatchers = (0, turn_watch_js_1.createTurnWatchers)({
|
|
1642
|
+
deviceId: () => (0, exports.computeListenerDeviceId)(),
|
|
1643
|
+
resolveTranscript: (sessionName) => {
|
|
1644
|
+
const info = readPaneInfo(sessionName);
|
|
1645
|
+
if (!info.currentPath)
|
|
1646
|
+
return null;
|
|
1647
|
+
// Ask the agent actually running in the pane, through the same detector
|
|
1648
|
+
// the session sweep uses — start_command first, because the foreground
|
|
1649
|
+
// process is usually the interpreter, and quote-stripped, because a
|
|
1650
|
+
// leading `"` once made this exact check miss every wrapped session.
|
|
1651
|
+
// A Codex or Gemini pane carries no resolver yet and answers null, which
|
|
1652
|
+
// the watcher reports as `no_transcript` — the EXTENSION POINT rule the
|
|
1653
|
+
// session-id and session-name resolvers already follow.
|
|
1654
|
+
const agent = (0, exports.detectRemoteAgent)(info);
|
|
1655
|
+
return agent?.resolveTranscript?.(info.currentPath, info.panePid ?? undefined) ?? null;
|
|
1656
|
+
},
|
|
1657
|
+
sessionExists: (sessionName) => sessionExists(sessionName),
|
|
1658
|
+
initCrypto: async () => { await (0, crypto_js_1.initDeviceCrypto)(); },
|
|
1659
|
+
seal: (plaintext, subscriberPublicKey) => (0, crypto_js_1.encryptEphemeral)(plaintext, subscriberPublicKey),
|
|
1660
|
+
ring: turn_ring_js_1.diskTurnRing,
|
|
1661
|
+
log: (message) => log(message),
|
|
1662
|
+
});
|
|
1623
1663
|
/** Inbound key ordering, one per (streamed session, sender device) — see the
|
|
1624
1664
|
* `agent.command.input` section below. Lives here so stopStream can drop them
|
|
1625
1665
|
* with the lease they belong to. Keyed `<session>#<deviceId>`, or the bare
|
|
@@ -2618,6 +2658,18 @@ const writeRemoteMarker = (paneCwd, text, now = Date.now) => {
|
|
|
2618
2658
|
}
|
|
2619
2659
|
};
|
|
2620
2660
|
exports.writeRemoteMarker = writeRemoteMarker;
|
|
2661
|
+
/** Take back a marker whose text never reached the pane. Best-effort, like the write. */
|
|
2662
|
+
const clearRemoteMarker = (paneCwd) => {
|
|
2663
|
+
const hash = (0, gate_js_1.projectHash)(paneCwd);
|
|
2664
|
+
if (!hash)
|
|
2665
|
+
return;
|
|
2666
|
+
try {
|
|
2667
|
+
(0, fs_1.rmSync)((0, gate_js_1.remoteMarkerPath)(hash), { force: true });
|
|
2668
|
+
}
|
|
2669
|
+
catch {
|
|
2670
|
+
/* a marker we can't remove just expires (15 min) — never fail the push over it */
|
|
2671
|
+
}
|
|
2672
|
+
};
|
|
2621
2673
|
const defaultPaneCwd = (session) => readPaneInfo(session).currentPath;
|
|
2622
2674
|
/**
|
|
2623
2675
|
* Type text into a pane. `submit` false stops after the paste, leaving the
|
|
@@ -2632,6 +2684,11 @@ const defaultPaneCwd = (session) => readPaneInfo(session).currentPath;
|
|
|
2632
2684
|
* submit is the user's own keypress. Text they edit before sending simply
|
|
2633
2685
|
* fails the match and the marker expires, which is the best-effort contract
|
|
2634
2686
|
* that path already has.
|
|
2687
|
+
*
|
|
2688
|
+
* The marker goes down BEFORE the keys. An idle agent submits the instant the
|
|
2689
|
+
* Enter lands and its prompt hook looks for the marker right then; written
|
|
2690
|
+
* after the inject, it lost that race and the phone message read as typed at
|
|
2691
|
+
* the keyboard. A failed inject takes the marker back out.
|
|
2635
2692
|
*/
|
|
2636
2693
|
const tryInject = (session, text, deps, submit = true) => {
|
|
2637
2694
|
if (!text) {
|
|
@@ -2640,17 +2697,17 @@ const tryInject = (session, text, deps, submit = true) => {
|
|
|
2640
2697
|
}
|
|
2641
2698
|
if (!passesInjectGuards(session, deps, SUBMIT_COST))
|
|
2642
2699
|
return false;
|
|
2700
|
+
const cwd = (deps.paneCwd ?? defaultPaneCwd)(session);
|
|
2701
|
+
const marked = cwd !== null && (0, exports.writeRemoteMarker)(cwd, text);
|
|
2643
2702
|
const ok = submit
|
|
2644
2703
|
? (deps.inject ?? injectKeys)(session, text)
|
|
2645
2704
|
: (deps.insertText ?? pasteText)(session, text);
|
|
2646
2705
|
const preview = text.length > 60 ? text.slice(0, 60) + '…' : text;
|
|
2647
2706
|
log(`${ok ? (submit ? '→' : '⇢') : '✗'} ${session}: ${preview}`);
|
|
2648
|
-
if (ok)
|
|
2707
|
+
if (ok)
|
|
2649
2708
|
noteStreamInput(session);
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
(0, exports.writeRemoteMarker)(cwd, text);
|
|
2653
|
-
}
|
|
2709
|
+
else if (marked)
|
|
2710
|
+
clearRemoteMarker(cwd);
|
|
2654
2711
|
return ok;
|
|
2655
2712
|
};
|
|
2656
2713
|
/** Key-event sibling of tryInject: same pane/shell/rate guards, but sends
|
|
@@ -3175,6 +3232,10 @@ const streamSession = (wsUrl, apiKey) => {
|
|
|
3175
3232
|
// lease is live, so it sits behind the same routing chain.
|
|
3176
3233
|
if (!(0, exports.handleCommandInput)(m.data, sendEphemeral) &&
|
|
3177
3234
|
!(0, exports.handleStreamControl)(m.data, sendEphemeral) &&
|
|
3235
|
+
// The chat timeline's own control messages. Same envelope,
|
|
3236
|
+
// same addressing rule, different source — a transcript file
|
|
3237
|
+
// rather than the pane.
|
|
3238
|
+
!turnWatchers.handle(m.data, sendEphemeral) &&
|
|
3178
3239
|
// A page of scrollback answers through `send` rather than by
|
|
3179
3240
|
// return value: on an encrypted stream it finishes after the
|
|
3180
3241
|
// seal, exactly like the frames it is history for.
|
|
@@ -3216,6 +3277,11 @@ const streamSession = (wsUrl, apiKey) => {
|
|
|
3216
3277
|
});
|
|
3217
3278
|
sock.on('close', (code, reasonBuf) => {
|
|
3218
3279
|
(0, exports.stopAllStreams)();
|
|
3280
|
+
// `send` is a closure over THIS socket, so a watcher that outlived it
|
|
3281
|
+
// would tick forever into a dead connection. Viewers re-arm with a
|
|
3282
|
+
// fresh watch.start after reconnecting, exactly as they re-lease a
|
|
3283
|
+
// terminal stream.
|
|
3284
|
+
turnWatchers.stopAll('socket closed');
|
|
3219
3285
|
cleanup();
|
|
3220
3286
|
resolve({ closeCode: code, reason: reasonBuf?.toString('utf-8') ?? '', connected: opened });
|
|
3221
3287
|
});
|
|
@@ -3407,6 +3473,12 @@ const handleListener = async (args) => {
|
|
|
3407
3473
|
log(`zeph listener starting — v${config_js_1.VERSION} — ${wsUrl}`);
|
|
3408
3474
|
log(`device=${(0, exports.computeListenerDeviceId)()} host=${(0, os_1.hostname)()} pid=${process.pid}`);
|
|
3409
3475
|
log("Waiting for 'agent.command' pushes from the phone picker. Ctrl-C to stop.");
|
|
3476
|
+
// Idle sleep kills the socket; "Wake for network access" does not bring it
|
|
3477
|
+
// back (see keep-awake.ts). Flag beats config; the default is on.
|
|
3478
|
+
const keepAwake = (0, keep_awake_js_1.startKeepAwake)({
|
|
3479
|
+
enabled: args['no-keep-awake'] !== true && config.keepAwake !== false,
|
|
3480
|
+
log,
|
|
3481
|
+
});
|
|
3410
3482
|
// Heartbeat memory log — once an hour. Lets the user (and us) spot
|
|
3411
3483
|
// gradual growth in a long-running daemon before it gets bad enough
|
|
3412
3484
|
// to make the host shell unresponsive. The MB counter is human-
|
|
@@ -3460,6 +3532,7 @@ const handleListener = async (args) => {
|
|
|
3460
3532
|
// Force-close any open WS so the streamSession promise resolves
|
|
3461
3533
|
// immediately instead of waiting for the server to drop us.
|
|
3462
3534
|
activeHandle?.terminate();
|
|
3535
|
+
keepAwake.stop();
|
|
3463
3536
|
notifyStop();
|
|
3464
3537
|
};
|
|
3465
3538
|
process.on('SIGINT', () => stop('SIGINT'));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GateMarker, GatePushMode } from './gate.js';
|
|
2
|
+
export interface PresenceDeps {
|
|
3
|
+
env: NodeJS.ProcessEnv;
|
|
4
|
+
/** stdout of a probe command, or null when it fails, is missing, or times out. */
|
|
5
|
+
run: (cmd: string, args: string[]) => string | null;
|
|
6
|
+
now: () => number;
|
|
7
|
+
}
|
|
8
|
+
export declare const isAway: (deps?: PresenceDeps) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Presence for decidePush, probed only where it can change the verdict: quiet
|
|
11
|
+
* with no `high` marker is the one path that is otherwise silent.
|
|
12
|
+
*/
|
|
13
|
+
export declare const awayForGate: (pushMode: GatePushMode, marker: GateMarker, probe?: () => boolean) => boolean;
|
|
14
|
+
//# sourceMappingURL=presence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presence.d.ts","sourceRoot":"","sources":["../src/presence.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAK1D,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,kFAAkF;IAClF,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,MAAM,GAAG,IAAI,CAAC;IACpD,GAAG,EAAE,MAAM,MAAM,CAAC;CACnB;AAiCD,eAAO,MAAM,MAAM,GAAI,OAAM,YAA4B,KAAG,OAkB3D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,GACtB,UAAU,YAAY,EACtB,QAAQ,UAAU,EAClB,QAAO,MAAM,OAAgB,KAC5B,OAA+D,CAAC"}
|
package/dist/presence.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.awayForGate = exports.isAway = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Presence — is the user away from the terminal?
|
|
6
|
+
*
|
|
7
|
+
* The TS twin of `plugin/hooks/gate.sh` zeph_is_away (zeph-to/plugin): the
|
|
8
|
+
* Claude Stop hook asks there, every `notify --auto` hook asks here, and both
|
|
9
|
+
* must answer alike. The quiet dial silences routine pushes because the user is
|
|
10
|
+
* watching the pane; an away user is not, so the answer becomes decidePush's
|
|
11
|
+
* `away`. Keep the probe order and fallbacks in sync with the bash side — the
|
|
12
|
+
* cases in presence.test.ts mirror its `away:` block in test-zeph-stop.sh.
|
|
13
|
+
*
|
|
14
|
+
* Threshold: ZEPH_AWAY_SEC seconds (default 300, `0` disables, anything that is
|
|
15
|
+
* not a whole number of at most 9 digits falls back to the default). Probes,
|
|
16
|
+
* first answer wins:
|
|
17
|
+
* 1. inside tmux and no client attached to the server at all → away. Any
|
|
18
|
+
* attached client means someone is at a tmux terminal, so switching the
|
|
19
|
+
* one client between sessions must not read as leaving.
|
|
20
|
+
* 2. not over SSH and ioreg reports HIDIdleTime (macOS) → that decides, and
|
|
21
|
+
* nothing below runs: tmux activity only sees keys typed into tmux, so a
|
|
22
|
+
* user reading a browser would look idle to it. Inside tmux, "over SSH"
|
|
23
|
+
* comes from the session environment (`show-environment`), which tmux
|
|
24
|
+
* refreshes on every attach — the process's own SSH_CONNECTION is frozen
|
|
25
|
+
* at server start.
|
|
26
|
+
* 3. inside tmux → the newest client_activity (SSH and non-macOS hosts).
|
|
27
|
+
* Anything else is present: an unreadable signal must never add a push.
|
|
28
|
+
*/
|
|
29
|
+
const child_process_1 = require("child_process");
|
|
30
|
+
const AWAY_SEC_DEFAULT = 300;
|
|
31
|
+
const PROBE_TIMEOUT_MS = 2000;
|
|
32
|
+
const runProbe = (cmd, args) => {
|
|
33
|
+
const r = (0, child_process_1.spawnSync)(cmd, args, {
|
|
34
|
+
encoding: 'utf-8',
|
|
35
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
36
|
+
timeout: PROBE_TIMEOUT_MS,
|
|
37
|
+
});
|
|
38
|
+
return r.status === 0 ? (r.stdout ?? '') : null;
|
|
39
|
+
};
|
|
40
|
+
const defaultDeps = () => ({ env: process.env, run: runProbe, now: Date.now });
|
|
41
|
+
const awayThresholdSec = (raw) => raw !== undefined && /^\d{1,9}$/.test(raw) ? Number(raw) : AWAY_SEC_DEFAULT;
|
|
42
|
+
const hidIdleSec = (ioregOut) => {
|
|
43
|
+
const match = ioregOut?.match(/"HIDIdleTime" = (\d+)/);
|
|
44
|
+
return match ? Math.floor(Number(match[1]) / 1e9) : null;
|
|
45
|
+
};
|
|
46
|
+
const newestActivitySec = (clientsOut) => {
|
|
47
|
+
const stamps = clientsOut.split('\n').filter((l) => /^\d+$/.test(l)).map(Number);
|
|
48
|
+
return stamps.length > 0 ? Math.max(...stamps) : null;
|
|
49
|
+
};
|
|
50
|
+
// null = tmux had no answer for the variable, so the process env decides.
|
|
51
|
+
const isOverSsh = (deps, inTmux) => {
|
|
52
|
+
const sessionVar = inTmux ? deps.run('tmux', ['show-environment', 'SSH_CONNECTION']) : null;
|
|
53
|
+
if (sessionVar !== null)
|
|
54
|
+
return sessionVar.startsWith('SSH_CONNECTION=');
|
|
55
|
+
return Boolean(deps.env.SSH_CONNECTION);
|
|
56
|
+
};
|
|
57
|
+
const isAway = (deps = defaultDeps()) => {
|
|
58
|
+
const threshold = awayThresholdSec(deps.env.ZEPH_AWAY_SEC);
|
|
59
|
+
if (threshold === 0)
|
|
60
|
+
return false;
|
|
61
|
+
// null = not in tmux, or no server answered; '' = a server with no clients.
|
|
62
|
+
const clients = deps.env.TMUX ? deps.run('tmux', ['list-clients', '-F', '#{client_activity}']) : null;
|
|
63
|
+
if (clients !== null && clients.trim() === '')
|
|
64
|
+
return true;
|
|
65
|
+
if (!isOverSsh(deps, clients !== null)) {
|
|
66
|
+
// -r -k -d 1: just the IOHIDSystem node (~4 KB), not its ~380 KB subtree.
|
|
67
|
+
const idle = hidIdleSec(deps.run('ioreg', ['-r', '-k', 'HIDIdleTime', '-d', '1', '-c', 'IOHIDSystem']));
|
|
68
|
+
if (idle !== null)
|
|
69
|
+
return idle >= threshold;
|
|
70
|
+
}
|
|
71
|
+
if (clients === null)
|
|
72
|
+
return false;
|
|
73
|
+
const newest = newestActivitySec(clients);
|
|
74
|
+
if (newest === null)
|
|
75
|
+
return false;
|
|
76
|
+
return Math.floor(deps.now() / 1000) - newest >= threshold;
|
|
77
|
+
};
|
|
78
|
+
exports.isAway = isAway;
|
|
79
|
+
/**
|
|
80
|
+
* Presence for decidePush, probed only where it can change the verdict: quiet
|
|
81
|
+
* with no `high` marker is the one path that is otherwise silent.
|
|
82
|
+
*/
|
|
83
|
+
const awayForGate = (pushMode, marker, probe = exports.isAway) => pushMode === 'quiet' && marker !== 'high' && probe();
|
|
84
|
+
exports.awayForGate = awayForGate;
|