@zeph-to/cli 2.12.1 → 2.14.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 CHANGED
@@ -200,11 +200,18 @@ block here.
200
200
  ### Setup
201
201
 
202
202
  1. **Install tmux.** The listener uses `send-keys`; the wrapper spawns
203
- named sessions. `brew install tmux` on macOS, `apt install tmux` on
204
- Debian/Ubuntu.
203
+ named sessions. `zeph install` checks for it and, on macOS with Homebrew,
204
+ offers to run `brew install tmux` for you. Elsewhere it prints the line to
205
+ run — `sudo apt install tmux` on Debian/Ubuntu, and so on — because
206
+ installing with `sudo` is not something an installer should do on your
207
+ behalf. tmux has no Windows build, so `zeph cc` needs WSL there.
205
208
 
206
209
  2. **Add `wsUrl` to `~/.zeph/config.json`** (the WebSocket endpoint of
207
- your Zeph backend — CDK output `WsApiUrl`):
210
+ your Zeph backend — CDK output `WsApiUrl`). Keep it on the same stage as
211
+ `baseUrl`: the REST stage is the path prefix (`/v1` prod, `/d1` dev) and the
212
+ socket stage is the hostname, so they can disagree without either looking
213
+ wrong. `zeph verify` says which stage each one is on, and the listener only
214
+ reads this at startup — `zeph listener --restart` after editing:
208
215
 
209
216
  ```json
210
217
  {
@@ -214,7 +221,12 @@ block here.
214
221
  }
215
222
  ```
216
223
 
217
- Alternatively set `ZEPH_WS_URL` in your shell env.
224
+ This is where it belongs. `--ws-url` overrides it for a single run.
225
+ `ZEPH_WS_URL` is deprecated: it used to outrank this file, which meant an
226
+ `export` in a shell profile silently chose the stage and left no trace of
227
+ having done so. It now loses to the file and is read only when the file has
228
+ no `wsUrl`, so nothing that worked stops working — but it will go, and
229
+ `zeph verify` says so while it is still set.
218
230
 
219
231
  3. **Run agents through the wrapper.** That's it.
220
232
 
@@ -520,7 +532,7 @@ zeph notify --title "Hello" --json
520
532
  | `login` | Browser sign-in: auto-fetch API key + hook into `~/.zeph/config.json` over a localhost loopback (`--web-url`, `--timeout`). No copy-paste |
521
533
  | `install` (alias: `setup`) | One-command setup: detect agents, save config, install rules + hooks + MCP. No saved config → opens browser login automatically. `--only claude,cursor,…` skips the picker |
522
534
  | `uninstall` | Remove Zeph from all detected agents (`--dry-run`, `--purge`) |
523
- | `verify` | Check installation health across detected agents (`--ping` for a live API call) |
535
+ | `verify` | Check installation health across detected agents (`--ping` for a live API call). Also reports the resolved WebSocket URL **and where it came from** — `--ws-url`, config, the deprecated `ZEPH_WS_URL`, or the built-in default — warns when the socket and the API base are on different stages, and warns when the running listener is on a different URL than the one that resolves now (it reads the config once, at startup) |
524
536
  | `check-update` | Check whether a newer Zeph version is on npm |
525
537
  | `notify` | Send a push notification |
526
538
  | `list` | List recent push notifications |
@@ -556,7 +568,7 @@ which project + branch finished without writing per-IDE wrappers. Pass
556
568
 
557
569
  | Flag | Description |
558
570
  |------|-------------|
559
- | `--ws-url <url>` | WebSocket endpoint (or set `ZEPH_WS_URL` env, or `wsUrl` in `~/.zeph/config.json`) |
571
+ | `--ws-url <url>` | WebSocket endpoint for this run only; the lasting setting is `wsUrl` in `~/.zeph/config.json` |
560
572
  | `--key <api-key>` | API key (or set `ZEPH_API_KEY` env) |
561
573
  | `--base-url <url>` | REST API base URL (or set `ZEPH_BASE_URL` env, or `baseUrl` in `~/.zeph/config.json`) |
562
574
  | `--stop` | Stop the running daemon and clear its PID/version stamps |
@@ -660,7 +672,7 @@ The CLI checks `CLAUDE_PROJECT_DIR`, `CURSOR_PROJECT_DIR`,
660
672
  |----------|-------------|
661
673
  | `ZEPH_API_KEY` | API key (fallback when `--key` not provided) |
662
674
  | `ZEPH_BASE_URL` | API base URL (default: `https://api.zeph.to/v1`) |
663
- | `ZEPH_WS_URL` | WebSocket endpoint for `zeph listener` (no default required) |
675
+ | `ZEPH_WS_URL` | **Deprecated.** WebSocket endpoint for `zeph listener`. `wsUrl` in `~/.zeph/config.json` wins over it; read only when the file has none. It will stop being read |
664
676
  | `ZEPH_TMUX_SOCKET` | Explicit tmux socket path for the listener (skips auto-discovery — use when your tmux runs with `-L <name>` or a custom `-S <path>`) |
665
677
  | `ZEPH_SESSION_ID` | AI session ID (fallback when `--session` not provided) |
666
678
 
package/dist/config.d.ts CHANGED
@@ -17,6 +17,14 @@ export declare const resolveHookId: (env?: NodeJS.ProcessEnv) => string | undefi
17
17
  export declare const PROJECT_DIR_ENV_VARS: readonly ["CLAUDE_PROJECT_DIR", "CURSOR_PROJECT_DIR", "WINDSURF_PROJECT_DIR"];
18
18
  /** First set project-dir env (unresolved `${VAR}` placeholders ignored), else cwd. */
19
19
  export declare const detectProjectDir: () => string;
20
+ /**
21
+ * An absent config is normal — plenty of commands run on `--key` alone, so it
22
+ * stays silent. A config that exists but does not parse is not normal, and used
23
+ * to be indistinguishable from absent: every value silently became undefined,
24
+ * so `zeph` behaved as if the file had never been written. That is precisely
25
+ * how "it isn't reading my config" looks from the outside, with nothing
26
+ * anywhere to say otherwise. Say it, on stderr, and carry on with defaults.
27
+ */
20
28
  export declare const loadConfig: () => ZephConfig;
21
29
  export declare const saveConfig: (config: ZephConfig) => void;
22
30
  export declare const VERSION: string;
@@ -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;CACnB;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;AAEF,eAAO,MAAM,UAAU,QAAO,UAM7B,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,QAAQ,UAAU,KAAG,IAM/C,CAAC;AAEF,eAAO,MAAM,OAAO,QAOhB,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;CACnB;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/config.js CHANGED
@@ -33,13 +33,38 @@ const detectProjectDir = () => {
33
33
  return process.cwd();
34
34
  };
35
35
  exports.detectProjectDir = detectProjectDir;
36
+ let warnedAboutBrokenConfig = false;
37
+ /**
38
+ * An absent config is normal — plenty of commands run on `--key` alone, so it
39
+ * stays silent. A config that exists but does not parse is not normal, and used
40
+ * to be indistinguishable from absent: every value silently became undefined,
41
+ * so `zeph` behaved as if the file had never been written. That is precisely
42
+ * how "it isn't reading my config" looks from the outside, with nothing
43
+ * anywhere to say otherwise. Say it, on stderr, and carry on with defaults.
44
+ */
36
45
  const loadConfig = () => {
46
+ let raw;
37
47
  try {
38
- return JSON.parse((0, fs_1.readFileSync)(exports.CONFIG_FILE, 'utf-8'));
48
+ raw = (0, fs_1.readFileSync)(exports.CONFIG_FILE, 'utf-8');
39
49
  }
40
50
  catch {
41
51
  return {};
42
52
  }
53
+ try {
54
+ return JSON.parse(raw);
55
+ }
56
+ catch (err) {
57
+ // Once per process: a single command can call loadConfig several times
58
+ // (handleVerify and resolveHookId both do), and repeating the same two
59
+ // lines four times reads like four separate problems.
60
+ if (!warnedAboutBrokenConfig) {
61
+ warnedAboutBrokenConfig = true;
62
+ const reason = err instanceof Error ? err.message : String(err);
63
+ console.error(`zeph: ${exports.CONFIG_FILE} is not valid JSON, so it is being ignored (${reason}).`);
64
+ console.error('zeph: fix the file, or re-run `zeph install` to write a fresh one.');
65
+ }
66
+ return {};
67
+ }
43
68
  };
44
69
  exports.loadConfig = loadConfig;
45
70
  const saveConfig = (config) => {
@@ -1 +1 @@
1
- {"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../src/installer.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AA+BzC;;;GAGG;AACH;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,YAAY,MAAM,GAAG,SAAS,EAAE,SAAS,OAAO,KAAG,OACxD,CAAC;AAoBzB;6EAC6E;AAC7E,eAAO,MAAM,aAAa,GAAI,UAAU,MAAM,EAAE,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,IAqBhF,CAAC;AAsCF;mEACmE;AACnE,eAAO,MAAM,cAAc,GAAI,UAA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C,EACtC,gBAAgB,OAAO,KACtB,KAAK,GAAG,IAAI,GAAG,KAKjB,CAAC;AAgCF,eAAO,MAAM,aAAa,GAAU,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAG,OAAO,CAAC,MAAM,CA0I1F,CAAC"}
package/dist/installer.js CHANGED
@@ -10,6 +10,7 @@ const zeph_hook_js_1 = require("./zeph-hook.js");
10
10
  const config_js_1 = require("./config.js");
11
11
  const login_js_1 = require("./login.js");
12
12
  const agents_js_1 = require("./agents.js");
13
+ const tmux_install_js_1 = require("./tmux-install.js");
13
14
  const mcp_command_js_1 = require("./mcp-command.js");
14
15
  const listener_service_js_1 = require("./listener-service.js");
15
16
  const templates_js_1 = require("./templates.js");
@@ -464,7 +465,7 @@ const applyServiceChoice = async (choice) => {
464
465
  try {
465
466
  const { confirm } = await import('@inquirer/prompts');
466
467
  wanted = await confirm({
467
- message: 'Start the listener at every login? (so the phone sees this machine after a reboot)',
468
+ message: 'Start the listener at every login, so the phone sees this machine after a reboot? (enter to confirm)',
468
469
  default: true,
469
470
  });
470
471
  }
@@ -551,6 +552,7 @@ const handleInstall = async (args) => {
551
552
  if (selected.length === 0) {
552
553
  console.log(' (no agents selected — only the config file will be saved)');
553
554
  }
555
+ console.log(' - Check tmux (`zeph cc` runs agents inside it)');
554
556
  if ((0, exports.serviceInstallChoice)(args, nonInteractive) !== 'no') {
555
557
  console.log(' - Offer to start the listener at every login');
556
558
  }
@@ -577,10 +579,28 @@ const handleInstall = async (args) => {
577
579
  if (installer)
578
580
  installer();
579
581
  }
580
- // 7. Login-time service the only thing that makes the phone see this
582
+ // 7. tmux`zeph cc` is tmux or nothing, so check before claiming success.
583
+ console.log('\n Checking tmux...');
584
+ await (0, tmux_install_js_1.ensureTmux)({
585
+ plan: (0, tmux_install_js_1.planTmuxInstall)({ resolve: agents_js_1.resolveCommand, platform: process.platform }),
586
+ nonInteractive,
587
+ askConfirm: async (message) => {
588
+ try {
589
+ const { confirm } = await import('@inquirer/prompts');
590
+ return await confirm({ message, default: true });
591
+ }
592
+ catch {
593
+ // Ctrl-C or no TTY — an unanswered question is not a yes.
594
+ return false;
595
+ }
596
+ },
597
+ run: (argv) => { (0, child_process_1.execFileSync)(argv[0], argv.slice(1), { stdio: 'inherit' }); },
598
+ report: { ok, fail, note: skipNote },
599
+ });
600
+ // 8. Login-time service — the only thing that makes the phone see this
581
601
  // machine after a reboot without a terminal being opened first.
582
602
  await applyServiceChoice((0, exports.serviceInstallChoice)(args, nonInteractive));
583
- // 8. Test connection
603
+ // 9. Test connection
584
604
  console.log('\n Testing connection...');
585
605
  await testConnection(apiKey, baseUrl);
586
606
  console.log('\n Done! Restart your agents.\n');
@@ -1,6 +1,13 @@
1
1
  export declare const LISTENER_PID_FILE: string;
2
2
  /** CLI version the running daemon booted from. Absent ⇒ pre-stamp build. */
3
3
  export declare const LISTENER_VERSION_FILE: string;
4
+ /**
5
+ * The socket the running daemon actually connected to. A stamp rather than a
6
+ * line in listener.log, because the log rotates at 5MB and a long-lived daemon
7
+ * — exactly the one whose config edit has been outlived — loses its own startup
8
+ * line to that rotation, which would silently switch the staleness check off.
9
+ */
10
+ export declare const LISTENER_WS_URL_FILE: string;
4
11
  export declare const LISTENER_LOG_FILE: string;
5
12
  export declare const sleep: (ms: number) => Promise<void>;
6
13
  /**
@@ -16,7 +23,9 @@ export declare const runningListenerPid: () => number | null;
16
23
  */
17
24
  export declare const runningListenerVersion: () => string | null;
18
25
  /** Claim the singleton slot for THIS process and stamp the version with it. */
19
- export declare const writeListenerRuntime: (version: string) => void;
26
+ export declare const writeListenerRuntime: (version: string, wsUrl?: string) => void;
27
+ /** The socket the running daemon connected to, or null when it is unknown. */
28
+ export declare const runningListenerWsUrl: () => string | null;
20
29
  /**
21
30
  * Drop the PID/version stamps, but only when they still name `pid` — a
22
31
  * successor that already claimed the slot must not be trampled by a
@@ -1 +1 @@
1
- {"version":3,"file":"listener-process.d.ts","sourceRoot":"","sources":["../src/listener-process.ts"],"names":[],"mappings":"AAwBA,eAAO,MAAM,iBAAiB,QAAiC,CAAC;AAChE,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,QAAqC,CAAC;AACxE,eAAO,MAAM,iBAAiB,QAAiC,CAAC;AAEhE,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,KAAG,OAAO,CAAC,IAAI,CAAsD,CAAC;AAEtG;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QAAO,MAAM,GAAG,IAS9C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAAO,MAAM,GAAG,IAMlD,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,KAAG,IAItD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,KAAK,MAAM,KAAG,IASlD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAAO,IAQ5C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAU,KAAK,MAAM,EAAE,kBAAiB,KAAG,OAAO,CAAC,OAAO,CAqBlF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,QAAO,MAAM,GAAG,IAM1C,CAAC;AAgBF,eAAO,MAAM,wBAAwB,QAAO,IAO3C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAO,OAgBxC,CAAC"}
1
+ {"version":3,"file":"listener-process.d.ts","sourceRoot":"","sources":["../src/listener-process.ts"],"names":[],"mappings":"AAwBA,eAAO,MAAM,iBAAiB,QAAiC,CAAC;AAChE,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,QAAqC,CAAC;AACxE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,QAAmC,CAAC;AACrE,eAAO,MAAM,iBAAiB,QAAiC,CAAC;AAEhE,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,KAAG,OAAO,CAAC,IAAI,CAAsD,CAAC;AAEtG;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QAAO,MAAM,GAAG,IAS9C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAAO,MAAM,GAAG,IAMlD,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,EAAE,QAAQ,MAAM,KAAG,IAKtE,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,QAAO,MAAM,GAAG,IAOhD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,KAAK,MAAM,KAAG,IAWlD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAAO,IAQ5C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAU,KAAK,MAAM,EAAE,kBAAiB,KAAG,OAAO,CAAC,OAAO,CAqBlF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,QAAO,MAAM,GAAG,IAM1C,CAAC;AAgBF,eAAO,MAAM,wBAAwB,QAAO,IAO3C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAO,OAgBxC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.spawnListenerDetached = exports.rotateListenerLogIfLarge = exports.resolveCliPath = exports.stopListener = exports.clearStaleListenerRuntime = exports.clearListenerRuntime = exports.writeListenerRuntime = exports.runningListenerVersion = exports.runningListenerPid = exports.sleep = exports.LISTENER_LOG_FILE = exports.LISTENER_VERSION_FILE = exports.LISTENER_PID_FILE = void 0;
3
+ exports.spawnListenerDetached = exports.rotateListenerLogIfLarge = exports.resolveCliPath = exports.stopListener = exports.clearStaleListenerRuntime = exports.clearListenerRuntime = exports.runningListenerWsUrl = exports.writeListenerRuntime = exports.runningListenerVersion = exports.runningListenerPid = exports.sleep = exports.LISTENER_LOG_FILE = exports.LISTENER_WS_URL_FILE = exports.LISTENER_VERSION_FILE = exports.LISTENER_PID_FILE = void 0;
4
4
  const node_child_process_1 = require("node:child_process");
5
5
  const node_fs_1 = require("node:fs");
6
6
  const node_os_1 = require("node:os");
@@ -26,6 +26,13 @@ const ZEPH_DIR = (0, node_path_1.join)((0, node_os_1.homedir)(), '.zeph');
26
26
  exports.LISTENER_PID_FILE = (0, node_path_1.join)(ZEPH_DIR, 'listener.pid');
27
27
  /** CLI version the running daemon booted from. Absent ⇒ pre-stamp build. */
28
28
  exports.LISTENER_VERSION_FILE = (0, node_path_1.join)(ZEPH_DIR, 'listener.version');
29
+ /**
30
+ * The socket the running daemon actually connected to. A stamp rather than a
31
+ * line in listener.log, because the log rotates at 5MB and a long-lived daemon
32
+ * — exactly the one whose config edit has been outlived — loses its own startup
33
+ * line to that rotation, which would silently switch the staleness check off.
34
+ */
35
+ exports.LISTENER_WS_URL_FILE = (0, node_path_1.join)(ZEPH_DIR, 'listener.wsurl');
29
36
  exports.LISTENER_LOG_FILE = (0, node_path_1.join)(ZEPH_DIR, 'listener.log');
30
37
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
31
38
  exports.sleep = sleep;
@@ -62,12 +69,26 @@ const runningListenerVersion = () => {
62
69
  };
63
70
  exports.runningListenerVersion = runningListenerVersion;
64
71
  /** Claim the singleton slot for THIS process and stamp the version with it. */
65
- const writeListenerRuntime = (version) => {
72
+ const writeListenerRuntime = (version, wsUrl) => {
66
73
  (0, node_fs_1.mkdirSync)(ZEPH_DIR, { recursive: true });
67
74
  (0, node_fs_1.writeFileSync)(exports.LISTENER_PID_FILE, String(process.pid));
68
75
  (0, node_fs_1.writeFileSync)(exports.LISTENER_VERSION_FILE, version);
76
+ if (wsUrl)
77
+ (0, node_fs_1.writeFileSync)(exports.LISTENER_WS_URL_FILE, wsUrl);
69
78
  };
70
79
  exports.writeListenerRuntime = writeListenerRuntime;
80
+ /** The socket the running daemon connected to, or null when it is unknown. */
81
+ const runningListenerWsUrl = () => {
82
+ if ((0, exports.runningListenerPid)() === null)
83
+ return null;
84
+ try {
85
+ return (0, node_fs_1.readFileSync)(exports.LISTENER_WS_URL_FILE, 'utf-8').trim() || null;
86
+ }
87
+ catch {
88
+ return null;
89
+ }
90
+ };
91
+ exports.runningListenerWsUrl = runningListenerWsUrl;
71
92
  /**
72
93
  * Drop the PID/version stamps, but only when they still name `pid` — a
73
94
  * successor that already claimed the slot must not be trampled by a
@@ -80,10 +101,12 @@ const clearListenerRuntime = (pid) => {
80
101
  if (Number((0, node_fs_1.readFileSync)(exports.LISTENER_PID_FILE, 'utf-8').trim()) !== pid)
81
102
  return;
82
103
  (0, node_fs_1.unlinkSync)(exports.LISTENER_PID_FILE);
83
- try {
84
- (0, node_fs_1.unlinkSync)(exports.LISTENER_VERSION_FILE);
104
+ for (const stamp of [exports.LISTENER_VERSION_FILE, exports.LISTENER_WS_URL_FILE]) {
105
+ try {
106
+ (0, node_fs_1.unlinkSync)(stamp);
107
+ }
108
+ catch { /* best-effort — a missing stamp is already the desired state */ }
85
109
  }
86
- catch { /* best-effort — a missing stamp is already the desired state */ }
87
110
  }
88
111
  catch { /* best-effort */ }
89
112
  };
@@ -783,17 +783,6 @@ export declare const gcAttachments: (now?: number, dir?: string, ttl?: number) =
783
783
  export declare const handlePush: (push: PushItem, deps?: HandlePushDeps) => Promise<boolean>;
784
784
  export declare const computeBackoff: (attempt: number) => number;
785
785
  export declare const computeListenerDeviceId: (host?: string) => string;
786
- /**
787
- * A user who only set ZEPH_API_KEY (no `zeph login`, no config file) gets the
788
- * prod socket by default — mirroring the DEFAULT_API_BASE fallback for REST.
789
- * The default only applies when the base URL is also the prod default: with a
790
- * custom base URL, silently pointing the listener at the prod socket while
791
- * REST talks to another stage would split the device across environments, so
792
- * that combination still errors loudly.
793
- */
794
- export declare const resolveWsUrl: (args: Record<string, string | boolean>, config: {
795
- wsUrl?: string;
796
- }, baseUrl: string) => string | null;
786
+ export { resolveWsUrl } from './ws-url.js';
797
787
  export declare const handleListener: (args: Record<string, string | boolean>) => Promise<number>;
798
- export {};
799
788
  //# sourceMappingURL=listener.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../src/listener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AA4BH,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,GAAG,IAAI,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,MAAM,WAAW,oBAAoB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OA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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;AAgSF,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,CA4J3F,CAAC"}
package/dist/listener.js CHANGED
@@ -34,6 +34,7 @@ const os_1 = require("os");
34
34
  const path_1 = require("path");
35
35
  const ws_1 = __importDefault(require("ws"));
36
36
  const config_js_1 = require("./config.js");
37
+ const ws_url_js_1 = require("./ws-url.js");
37
38
  const listener_process_js_1 = require("./listener-process.js");
38
39
  const gate_js_1 = require("./gate.js");
39
40
  const session_registry_js_1 = require("./session-registry.js");
@@ -3224,21 +3225,11 @@ const streamSession = (wsUrl, apiKey) => {
3224
3225
  terminate: () => { ws?.terminate(); },
3225
3226
  };
3226
3227
  };
3227
- const DEFAULT_WS_URL = 'wss://ws.zeph.to';
3228
- /**
3229
- * A user who only set ZEPH_API_KEY (no `zeph login`, no config file) gets the
3230
- * prod socket by default — mirroring the DEFAULT_API_BASE fallback for REST.
3231
- * The default only applies when the base URL is also the prod default: with a
3232
- * custom base URL, silently pointing the listener at the prod socket while
3233
- * REST talks to another stage would split the device across environments, so
3234
- * that combination still errors loudly.
3235
- */
3236
- const resolveWsUrl = (args, config, baseUrl) => {
3237
- const fromArg = typeof args['ws-url'] === 'string' ? args['ws-url'] : null;
3238
- return fromArg || (0, config_js_1.resolvedEnv)('ZEPH_WS_URL') || config.wsUrl
3239
- || (baseUrl === DEFAULT_API_BASE ? DEFAULT_WS_URL : null);
3240
- };
3241
- exports.resolveWsUrl = resolveWsUrl;
3228
+ // Resolution (and its precedence) lives in ws-url.ts so `zeph verify` can ask
3229
+ // the same question without loading this module. Re-exported because
3230
+ // listener.test.ts has always asked it here.
3231
+ var ws_url_js_2 = require("./ws-url.js");
3232
+ Object.defineProperty(exports, "resolveWsUrl", { enumerable: true, get: function () { return ws_url_js_2.resolveWsUrl; } });
3242
3233
  // ── Singleton guard (PID file) ──────────────────────────────────────
3243
3234
  /**
3244
3235
  * Whether another `zeph listener` is already running on this machine.
@@ -3253,12 +3244,14 @@ const otherListenerAlive = () => {
3253
3244
  const pid = (0, listener_process_js_1.runningListenerPid)();
3254
3245
  return pid === null || pid === process.pid ? null : pid;
3255
3246
  };
3256
- const writeListenerPid = () => {
3247
+ const writeListenerPid = (wsUrl) => {
3257
3248
  try {
3258
3249
  // Stamp the version alongside the pid: `npm i -g` swaps the package
3259
3250
  // on disk without touching this already-running process, and the
3260
- // stamp is how `zeph cc` notices the drift and restarts us.
3261
- (0, listener_process_js_1.writeListenerRuntime)(config_js_1.VERSION);
3251
+ // stamp is how `zeph cc` notices the drift and restarts us. The socket
3252
+ // goes with it so `zeph verify` can say what this daemon is actually
3253
+ // connected to without reading a log that rotates out from under it.
3254
+ (0, listener_process_js_1.writeListenerRuntime)(config_js_1.VERSION, wsUrl);
3262
3255
  }
3263
3256
  catch (err) {
3264
3257
  log(`! could not write ${listener_process_js_1.LISTENER_PID_FILE}: ${err.message}`);
@@ -3391,15 +3384,17 @@ const handleListener = async (args) => {
3391
3384
  // resolution order as the rest of the CLI; falls back to the prod API.
3392
3385
  const baseUrl = args['base-url'] || (0, config_js_1.resolvedEnv)('ZEPH_BASE_URL') || config.baseUrl || DEFAULT_API_BASE;
3393
3386
  (0, exports.setAttachmentContext)({ apiKey, baseUrl });
3394
- const wsUrl = (0, exports.resolveWsUrl)(args, config, baseUrl);
3387
+ const staleWsEnv = (0, ws_url_js_1.legacyWsEnvNotice)(config);
3388
+ if (staleWsEnv)
3389
+ console.error(staleWsEnv);
3390
+ const wsUrl = (0, ws_url_js_1.resolveWsUrlDetailed)(args, config, baseUrl)?.url ?? null;
3395
3391
  if (!wsUrl) {
3396
3392
  console.error('zeph listener: WebSocket URL not set. Either:\n' +
3397
3393
  ' • add "wsUrl": "wss://..." to ~/.zeph/config.json\n' +
3398
- ' • export ZEPH_WS_URL=wss://...\n' +
3399
3394
  ' • pass --ws-url wss://...');
3400
3395
  return 1;
3401
3396
  }
3402
- writeListenerPid();
3397
+ writeListenerPid(wsUrl);
3403
3398
  process.on('exit', removeListenerPid);
3404
3399
  // Rotate before writing anything, so this run's first line lands in the
3405
3400
  // file the user tails rather than being copied straight into `.old`. The
@@ -0,0 +1,44 @@
1
+ /**
2
+ * tmux is not optional for `zeph cc` — every remote-agent subcommand runs the
3
+ * agent inside a named tmux session so the listener (and the phone picker) can
4
+ * reach it. Nothing in the install flow used to mention that, so a machine
5
+ * without tmux looked fully set up until the first `zeph cc` failed with an
6
+ * error from a program the user was never told they needed.
7
+ */
8
+ /** What this machine can do about a missing tmux. */
9
+ export type TmuxInstallPlan = {
10
+ readonly kind: 'present';
11
+ readonly path: string;
12
+ }
13
+ /** Safe to run unattended — no root, user-writable prefix. */
14
+ | {
15
+ readonly kind: 'command';
16
+ readonly run: readonly string[];
17
+ readonly label: string;
18
+ }
19
+ /** Needs root, or there is no package manager we recognise. Tell, don't do. */
20
+ | {
21
+ readonly kind: 'manual';
22
+ readonly hint: string;
23
+ };
24
+ export declare const planTmuxInstall: (deps: {
25
+ resolve: (cmd: string) => string | null;
26
+ platform: NodeJS.Platform;
27
+ }) => TmuxInstallPlan;
28
+ /**
29
+ * Act on the plan. Everything the outside world touches is injected, because
30
+ * the interesting branch — "offer, then run a package manager" — is otherwise
31
+ * only reachable through an interactive install that no test can drive.
32
+ */
33
+ export declare const ensureTmux: (deps: {
34
+ plan: TmuxInstallPlan;
35
+ nonInteractive: boolean;
36
+ askConfirm: (message: string) => Promise<boolean>;
37
+ run: (argv: readonly string[]) => void;
38
+ report: {
39
+ ok: (m: string) => void;
40
+ fail: (m: string) => void;
41
+ note: (m: string) =>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I,CAAA;KAAE,CAAC;CAC7F,KAAG,OAAO,CAAC,IAAI,CAsBf,CAAC"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ /**
3
+ * tmux is not optional for `zeph cc` — every remote-agent subcommand runs the
4
+ * agent inside a named tmux session so the listener (and the phone picker) can
5
+ * reach it. Nothing in the install flow used to mention that, so a machine
6
+ * without tmux looked fully set up until the first `zeph cc` failed with an
7
+ * error from a program the user was never told they needed.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ensureTmux = exports.planTmuxInstall = void 0;
11
+ /** Package managers that need root, and the line to hand the user for each. */
12
+ const ROOT_PACKAGE_MANAGERS = [
13
+ { bin: 'apt-get', hint: 'sudo apt install tmux' },
14
+ { bin: 'dnf', hint: 'sudo dnf install tmux' },
15
+ { bin: 'pacman', hint: 'sudo pacman -S tmux' },
16
+ { bin: 'zypper', hint: 'sudo zypper install tmux' },
17
+ { bin: 'apk', hint: 'sudo apk add tmux' },
18
+ ];
19
+ const planTmuxInstall = (deps) => {
20
+ const path = deps.resolve('tmux');
21
+ if (path)
22
+ return { kind: 'present', path };
23
+ // tmux has no native Windows build. `zeph cc` is POSIX-only by way of tmux,
24
+ // so point at WSL rather than at a package that cannot be installed.
25
+ if (deps.platform === 'win32') {
26
+ return { kind: 'manual', hint: '`zeph cc` needs tmux, which has no Windows build — run it under WSL' };
27
+ }
28
+ if (deps.platform === 'darwin') {
29
+ return deps.resolve('brew')
30
+ ? { kind: 'command', run: ['brew', 'install', 'tmux'], label: 'brew install tmux' }
31
+ : { kind: 'manual', hint: 'install Homebrew (brew.sh), then: brew install tmux' };
32
+ }
33
+ const rootManager = ROOT_PACKAGE_MANAGERS.find((pm) => deps.resolve(pm.bin));
34
+ if (rootManager)
35
+ return { kind: 'manual', hint: rootManager.hint };
36
+ return { kind: 'manual', hint: 'install tmux with this system\'s package manager' };
37
+ };
38
+ exports.planTmuxInstall = planTmuxInstall;
39
+ /**
40
+ * Act on the plan. Everything the outside world touches is injected, because
41
+ * the interesting branch — "offer, then run a package manager" — is otherwise
42
+ * only reachable through an interactive install that no test can drive.
43
+ */
44
+ const ensureTmux = async (deps) => {
45
+ const { plan, report } = deps;
46
+ if (plan.kind === 'present')
47
+ return report.ok(`tmux found (${plan.path})`);
48
+ if (plan.kind === 'manual')
49
+ return report.fail(`tmux not found — \`zeph cc\` needs it. ${plan.hint}`);
50
+ if (deps.nonInteractive) {
51
+ return report.note(`tmux not found — \`zeph cc\` needs it. Run: ${plan.label}`);
52
+ }
53
+ const wanted = await deps.askConfirm(`tmux is missing and \`zeph cc\` needs it — run \`${plan.label}\`? (enter to confirm)`);
54
+ if (!wanted) {
55
+ return report.note(`tmux not installed — \`zeph cc\` will not work until you run: ${plan.label}`);
56
+ }
57
+ try {
58
+ deps.run(plan.run);
59
+ report.ok('tmux installed');
60
+ }
61
+ catch {
62
+ report.fail(`\`${plan.label}\` failed — run it by hand`);
63
+ }
64
+ };
65
+ exports.ensureTmux = ensureTmux;
@@ -1 +1 @@
1
- {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AA4DA;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,EAAE,KAAK,MAAM,KAAG,MAAM,EAAE,GAAG,IAa5E,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,OAQ5C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GACrB;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GAC7B;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAElE,wFAAwF;AACxF,eAAO,MAAM,uBAAuB,GAChC,MAAM,MAAM,EAAE,GAAG,IAAI,EACrB,UAAU,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,KACnC,eAAe,GAAG,IAMpB,CAAC;AAYF,eAAO,MAAM,YAAY,GAAU,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAG,OAAO,CAAC,MAAM,CA+GzF,CAAC"}
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAmEA;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,EAAE,KAAK,MAAM,KAAG,MAAM,EAAE,GAAG,IAa5E,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,OAQ5C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GACrB;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GAC7B;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAElE,wFAAwF;AACxF,eAAO,MAAM,uBAAuB,GAChC,MAAM,MAAM,EAAE,GAAG,IAAI,EACrB,UAAU,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,KACnC,eAAe,GAAG,IAMpB,CAAC;AAuCF,eAAO,MAAM,YAAY,GAAU,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAG,OAAO,CAAC,MAAM,CA8IzF,CAAC"}
package/dist/verify.js CHANGED
@@ -9,6 +9,8 @@ const config_js_1 = require("./config.js");
9
9
  const listener_service_js_1 = require("./listener-service.js");
10
10
  const zeph_hook_js_1 = require("./zeph-hook.js");
11
11
  const mcp_command_js_1 = require("./mcp-command.js");
12
+ const listener_process_js_1 = require("./listener-process.js");
13
+ const ws_url_js_1 = require("./ws-url.js");
12
14
  const HOME = (0, os_1.homedir)();
13
15
  const pass = (msg) => console.log(` ✓ ${msg}`);
14
16
  const warn = (msg) => console.log(` ! ${msg}`);
@@ -118,6 +120,34 @@ const activeMcpRegistrations = (isOnPath) => MCP_REGISTRIES.flatMap((registry) =
118
120
  const result = (0, exports.classifyMcpRegistration)((0, exports.registeredMcpArgv)(registry.path, registry.key), isOnPath);
119
121
  return result ? [{ agent: registry.agent, result }] : [];
120
122
  });
123
+ /** Where a resolved WebSocket URL came from, in the user's terms. */
124
+ const WS_SOURCE_LABEL = {
125
+ flag: '--ws-url',
126
+ config: '~/.zeph/config.json',
127
+ 'env-deprecated': 'ZEPH_WS_URL (deprecated)',
128
+ default: 'built-in default',
129
+ };
130
+ /**
131
+ * The URL the live daemon connected to, or null when none is running.
132
+ *
133
+ * The stamp first; the log only as a fallback, for a daemon started by a build
134
+ * that predates the stamp. Reading the log alone was not enough — it rotates at
135
+ * 5MB, and the daemon whose startup line has been rotated away is precisely the
136
+ * long-lived one whose config edit this check exists to catch.
137
+ */
138
+ const liveListenerWsUrl = () => {
139
+ if ((0, listener_process_js_1.runningListenerPid)() === null)
140
+ return null;
141
+ const stamped = (0, listener_process_js_1.runningListenerWsUrl)();
142
+ if (stamped)
143
+ return stamped;
144
+ try {
145
+ return (0, ws_url_js_1.parseListenerStartUrl)((0, fs_1.readFileSync)(listener_process_js_1.LISTENER_LOG_FILE, 'utf-8'));
146
+ }
147
+ catch {
148
+ return null;
149
+ }
150
+ };
121
151
  const handleVerify = async (args) => {
122
152
  const doPing = args.ping === true;
123
153
  const checks = [];
@@ -172,6 +202,35 @@ const handleVerify = async (args) => {
172
202
  for (const row of serviceRows)
173
203
  record(row.label, row.state);
174
204
  }
205
+ // ── WebSocket ────────────────────────────────────────────────
206
+ // The phone's Agents list is fed over this socket, so a machine on the
207
+ // wrong stage is simply absent from the app with nothing to explain it.
208
+ console.log('\n WebSocket:');
209
+ const wsBaseUrl = args['base-url'] || (0, config_js_1.resolvedEnv)('ZEPH_BASE_URL') || config.baseUrl || ws_url_js_1.DEFAULT_API_BASE;
210
+ const staleWsEnv = (0, ws_url_js_1.legacyWsEnvNotice)(config);
211
+ if (staleWsEnv)
212
+ record(staleWsEnv.replace(/^zeph: /, ''), 'warn');
213
+ const ws = (0, ws_url_js_1.resolveWsUrlDetailed)(args, config, wsBaseUrl);
214
+ if (!ws) {
215
+ record('no WebSocket URL, and none can be guessed for a custom API base — set "wsUrl" in ~/.zeph/config.json', 'fail');
216
+ }
217
+ else {
218
+ record(`${ws.url} (from ${WS_SOURCE_LABEL[ws.source]})`, 'pass');
219
+ // Socket on one stage and REST on another splits the device: pushes go
220
+ // one way, the agent list the other, and neither half looks broken.
221
+ const wsStage = (0, ws_url_js_1.endpointStage)(ws.url);
222
+ const apiStage = (0, ws_url_js_1.endpointStage)(wsBaseUrl);
223
+ record(wsStage === apiStage
224
+ ? `API base is the same stage (${apiStage})`
225
+ : `stage mismatch — socket is ${wsStage}, API base is ${apiStage} (${wsBaseUrl}). Pushes and the agent list would land in different environments`, wsStage === apiStage ? 'pass' : 'warn');
226
+ // The daemon reads this once, at startup. Editing the config does
227
+ // nothing to a listener that has been up since before the edit — which
228
+ // looks exactly like the config not being read at all.
229
+ const live = liveListenerWsUrl();
230
+ if (live && live !== ws.url) {
231
+ record(`the running listener is on ${live}, not the resolved URL — restart it: zeph listener --restart`, 'warn');
232
+ }
233
+ }
175
234
  // ── MCP registrations ────────────────────────────────────────
176
235
  const registrations = activeMcpRegistrations(resolves);
177
236
  if (registrations.length > 0) {
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Where the listener's WebSocket URL comes from.
3
+ *
4
+ * The listener reads this once, at startup, and four things can supply it —
5
+ * which is exactly why a machine can sit on the wrong stage for hours with
6
+ * nothing to show for it but a line buried in listener.log. `zeph verify`
7
+ * reports the answer AND its source, so "config isn't being read" stops being
8
+ * a guess.
9
+ *
10
+ * Its own module rather than listener.ts so `zeph verify` can ask without
11
+ * loading the 187KB daemon.
12
+ */
13
+ export declare const DEFAULT_API_BASE = "https://api.zeph.to/v1";
14
+ export declare const DEFAULT_WS_URL = "wss://ws.zeph.to";
15
+ /**
16
+ * Which input won. Reported to the user verbatim.
17
+ *
18
+ * `ZEPH_WS_URL` used to sit ABOVE the config file, so an `export` in a shell
19
+ * profile silently outranked `~/.zeph/config.json` — invisible in the file,
20
+ * invisible in the app, indistinguishable from "the config is not being read".
21
+ * It now sits BELOW it, and warns whenever it is what answered.
22
+ *
23
+ * Not removed outright, because for one real configuration it was the only
24
+ * answer: a self-hosted deployment (custom API base) with the URL only in the
25
+ * environment. Dropping the lane made that listener refuse to start, and on the
26
+ * `zeph cc` autostart path its stderr goes to the log file, so the machine
27
+ * would just vanish from the app — the very failure this change exists to end.
28
+ */
29
+ export type WsUrlSource = 'flag' | 'config' | 'env-deprecated' | 'default';
30
+ export interface ResolvedWsUrl {
31
+ readonly url: string;
32
+ readonly source: WsUrlSource;
33
+ }
34
+ /**
35
+ * A user who only set ZEPH_API_KEY (no `zeph login`, no config file) gets the
36
+ * prod socket by default — mirroring the DEFAULT_API_BASE fallback for REST.
37
+ * The default only applies when the base URL is also the prod default: with a
38
+ * custom base URL, silently pointing the listener at the prod socket while
39
+ * REST talks to another stage would split the device across environments, so
40
+ * that combination still errors loudly.
41
+ */
42
+ export declare const resolveWsUrlDetailed: (args: Record<string, string | boolean>, config: {
43
+ wsUrl?: string;
44
+ }, baseUrl: string) => ResolvedWsUrl | null;
45
+ /** The URL alone — the listener's own question. One precedence list, not two. */
46
+ export declare const resolveWsUrl: (args: Record<string, string | boolean>, config: {
47
+ wsUrl?: string;
48
+ }, baseUrl: string) => string | null;
49
+ export declare const endpointStage: (url: string) => string;
50
+ /**
51
+ * The URL the RUNNING listener actually connected to, read out of its own
52
+ * startup line. The daemon resolves this once and can outlive a config edit by
53
+ * hours, so "what the config says" and "what is connected" are different
54
+ * questions — and only the second one explains a machine missing from the app.
55
+ *
56
+ * Matches the line listener.ts writes: `[HH:MM:SS] zeph listener starting — vX — <url>`.
57
+ * Last one wins; the log accumulates every restart.
58
+ */
59
+ export declare const parseListenerStartUrl: (logText: string) => string | null;
60
+ /**
61
+ * A one-line notice for a machine that still exports `ZEPH_WS_URL`, or null.
62
+ *
63
+ * The variable is no longer read, and dropping it in silence would be the same
64
+ * failure it caused: a value that appears to be in effect while something else
65
+ * decides. Read only to say it is being ignored, never to use.
66
+ */
67
+ export declare const legacyWsEnv: (env?: NodeJS.ProcessEnv) => string | null;
68
+ /**
69
+ * What to tell a machine that still exports `ZEPH_WS_URL`, or null.
70
+ *
71
+ * Two different messages, because the two situations are not the same problem:
72
+ * the config file now wins, so an export alongside it is dead weight, while an
73
+ * export on its own is still holding the machine up and must not be deleted
74
+ * before the value is moved.
75
+ */
76
+ export declare const legacyWsEnvNotice: (config?: {
77
+ wsUrl?: string;
78
+ }, env?: NodeJS.ProcessEnv) => string | null;
79
+ //# sourceMappingURL=ws-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ws-url.d.ts","sourceRoot":"","sources":["../src/ws-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,2BAA2B,CAAC;AACzD,eAAO,MAAM,cAAc,qBAAqB,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,gBAAgB,GAAG,SAAS,CAAC;AAE3E,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAC7B,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EACtC,QAAQ;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1B,SAAS,MAAM,KAChB,aAAa,GAAG,IAalB,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,YAAY,GACrB,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EACtC,QAAQ;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1B,SAAS,MAAM,KAChB,MAAM,GAAG,IAAgE,CAAC;AAgB7E,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,MAmB3C,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,KAAG,MAAM,GAAG,IAIhE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,MAAK,MAAM,CAAC,UAAwB,KAAG,MAAM,GAAG,IAK3E,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAC1B,SAAQ;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,EAC/B,MAAK,MAAM,CAAC,UAAwB,KACrC,MAAM,GAAG,IAKX,CAAC"}
package/dist/ws-url.js ADDED
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.legacyWsEnvNotice = exports.legacyWsEnv = exports.parseListenerStartUrl = exports.endpointStage = exports.resolveWsUrl = exports.resolveWsUrlDetailed = exports.DEFAULT_WS_URL = exports.DEFAULT_API_BASE = void 0;
4
+ /**
5
+ * Where the listener's WebSocket URL comes from.
6
+ *
7
+ * The listener reads this once, at startup, and four things can supply it —
8
+ * which is exactly why a machine can sit on the wrong stage for hours with
9
+ * nothing to show for it but a line buried in listener.log. `zeph verify`
10
+ * reports the answer AND its source, so "config isn't being read" stops being
11
+ * a guess.
12
+ *
13
+ * Its own module rather than listener.ts so `zeph verify` can ask without
14
+ * loading the 187KB daemon.
15
+ */
16
+ exports.DEFAULT_API_BASE = 'https://api.zeph.to/v1';
17
+ exports.DEFAULT_WS_URL = 'wss://ws.zeph.to';
18
+ /**
19
+ * A user who only set ZEPH_API_KEY (no `zeph login`, no config file) gets the
20
+ * prod socket by default — mirroring the DEFAULT_API_BASE fallback for REST.
21
+ * The default only applies when the base URL is also the prod default: with a
22
+ * custom base URL, silently pointing the listener at the prod socket while
23
+ * REST talks to another stage would split the device across environments, so
24
+ * that combination still errors loudly.
25
+ */
26
+ const resolveWsUrlDetailed = (args, config, baseUrl) => {
27
+ const fromArg = typeof args['ws-url'] === 'string' ? args['ws-url'] : null;
28
+ if (fromArg)
29
+ return { url: fromArg, source: 'flag' };
30
+ if (config.wsUrl)
31
+ return { url: config.wsUrl, source: 'config' };
32
+ // Below the config file, and above the built-in default: a machine that
33
+ // only ever had the environment variable keeps the stage it was on instead
34
+ // of being silently relocated to prod (or refusing to start).
35
+ const legacyEnv = (0, exports.legacyWsEnv)();
36
+ if (legacyEnv)
37
+ return { url: legacyEnv, source: 'env-deprecated' };
38
+ return baseUrl === exports.DEFAULT_API_BASE ? { url: exports.DEFAULT_WS_URL, source: 'default' } : null;
39
+ };
40
+ exports.resolveWsUrlDetailed = resolveWsUrlDetailed;
41
+ /** The URL alone — the listener's own question. One precedence list, not two. */
42
+ const resolveWsUrl = (args, config, baseUrl) => (0, exports.resolveWsUrlDetailed)(args, config, baseUrl)?.url ?? null;
43
+ exports.resolveWsUrl = resolveWsUrl;
44
+ /**
45
+ * Stage label for a zeph endpoint. The two endpoints carry it differently, and
46
+ * both forms have to be read or a correctly paired dev setup reports as broken:
47
+ *
48
+ * - The REST base encodes it in the PATH PREFIX — `/v1` is prod, `/d1` is dev,
49
+ * on the same `api.zeph.to` host (see agent-rules-fetch.ts).
50
+ * - The socket encodes it in the HOSTNAME — `ws.zeph.to` vs `ws-dev.zeph.to`,
51
+ * with no path at all.
52
+ *
53
+ * Only used to notice that the two point at different stages — a split-brain
54
+ * device, pushes going one way and the agent list the other. Never blocks.
55
+ */
56
+ const API_STAGE_PREFIX = { v1: 'prod', d1: 'dev' };
57
+ const endpointStage = (url) => {
58
+ let host = url;
59
+ let path = '';
60
+ try {
61
+ const parsed = new URL(url);
62
+ host = parsed.hostname;
63
+ path = parsed.pathname;
64
+ }
65
+ catch { /* not a URL — fall through and read it as a hostname */ }
66
+ // Host marker first: it is explicit, and it outranks the path. An
67
+ // `api-staging.zeph.to/v1` is staging — the `/v1` there says "the v1 API of
68
+ // the staging deployment", not "prod".
69
+ const marked = host.match(/(?:^|[.-])(dev|stage|staging|local|test)(?:[.-]|$)/);
70
+ if (marked)
71
+ return marked[1];
72
+ // Unmarked host: the path prefix is the only thing left that carries a
73
+ // stage, and on api.zeph.to it is the whole distinction.
74
+ const prefix = path.split('/').filter(Boolean)[0];
75
+ return (prefix && API_STAGE_PREFIX[prefix]) || 'prod';
76
+ };
77
+ exports.endpointStage = endpointStage;
78
+ /**
79
+ * The URL the RUNNING listener actually connected to, read out of its own
80
+ * startup line. The daemon resolves this once and can outlive a config edit by
81
+ * hours, so "what the config says" and "what is connected" are different
82
+ * questions — and only the second one explains a machine missing from the app.
83
+ *
84
+ * Matches the line listener.ts writes: `[HH:MM:SS] zeph listener starting — vX — <url>`.
85
+ * Last one wins; the log accumulates every restart.
86
+ */
87
+ const parseListenerStartUrl = (logText) => {
88
+ const starts = [...logText.matchAll(/zeph listener starting\b.*?(\S+)\s*$/gm)];
89
+ const last = starts.at(-1);
90
+ return last ? last[1] : null;
91
+ };
92
+ exports.parseListenerStartUrl = parseListenerStartUrl;
93
+ /**
94
+ * A one-line notice for a machine that still exports `ZEPH_WS_URL`, or null.
95
+ *
96
+ * The variable is no longer read, and dropping it in silence would be the same
97
+ * failure it caused: a value that appears to be in effect while something else
98
+ * decides. Read only to say it is being ignored, never to use.
99
+ */
100
+ const legacyWsEnv = (env = process.env) => {
101
+ const value = env.ZEPH_WS_URL;
102
+ // Same guard resolvedEnv applies: an unexpanded "${ZEPH_WS_URL}" from an
103
+ // agent's env block is a placeholder, not a value.
104
+ return value && !value.startsWith('${') ? value : null;
105
+ };
106
+ exports.legacyWsEnv = legacyWsEnv;
107
+ /**
108
+ * What to tell a machine that still exports `ZEPH_WS_URL`, or null.
109
+ *
110
+ * Two different messages, because the two situations are not the same problem:
111
+ * the config file now wins, so an export alongside it is dead weight, while an
112
+ * export on its own is still holding the machine up and must not be deleted
113
+ * before the value is moved.
114
+ */
115
+ const legacyWsEnvNotice = (config = {}, env = process.env) => {
116
+ if (!(0, exports.legacyWsEnv)(env))
117
+ return null;
118
+ return config.wsUrl
119
+ ? 'zeph: ZEPH_WS_URL is set but ~/.zeph/config.json wins now — the export does nothing and can go.'
120
+ : 'zeph: ZEPH_WS_URL is deprecated and will stop being read — move the value to "wsUrl" in ~/.zeph/config.json.';
121
+ };
122
+ exports.legacyWsEnvNotice = legacyWsEnvNotice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeph-to/cli",
3
- "version": "2.12.1",
3
+ "version": "2.14.0",
4
4
  "description": "Zeph CLI + push notification SDK for AI agents",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",