@zeph-to/cli 1.12.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.
Files changed (51) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +499 -0
  3. package/dist/agents.d.ts +8 -0
  4. package/dist/agents.d.ts.map +1 -0
  5. package/dist/agents.js +29 -0
  6. package/dist/check-update.d.ts +4 -0
  7. package/dist/check-update.d.ts.map +1 -0
  8. package/dist/check-update.js +80 -0
  9. package/dist/cli.d.ts +3 -0
  10. package/dist/cli.d.ts.map +1 -0
  11. package/dist/cli.js +374 -0
  12. package/dist/config.d.ts +14 -0
  13. package/dist/config.d.ts.map +1 -0
  14. package/dist/config.js +36 -0
  15. package/dist/crypto.d.ts +82 -0
  16. package/dist/crypto.d.ts.map +1 -0
  17. package/dist/crypto.js +291 -0
  18. package/dist/errors.d.ts +12 -0
  19. package/dist/errors.d.ts.map +1 -0
  20. package/dist/errors.js +28 -0
  21. package/dist/index.d.ts +4 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +9 -0
  24. package/dist/installer.d.ts +14 -0
  25. package/dist/installer.d.ts.map +1 -0
  26. package/dist/installer.js +464 -0
  27. package/dist/listener.d.ts +126 -0
  28. package/dist/listener.d.ts.map +1 -0
  29. package/dist/listener.js +1008 -0
  30. package/dist/login.d.ts +38 -0
  31. package/dist/login.d.ts.map +1 -0
  32. package/dist/login.js +182 -0
  33. package/dist/templates.d.ts +44 -0
  34. package/dist/templates.d.ts.map +1 -0
  35. package/dist/templates.js +257 -0
  36. package/dist/types.d.ts +54 -0
  37. package/dist/types.d.ts.map +1 -0
  38. package/dist/types.js +2 -0
  39. package/dist/uninstall.d.ts +2 -0
  40. package/dist/uninstall.d.ts.map +1 -0
  41. package/dist/uninstall.js +217 -0
  42. package/dist/verify.d.ts +2 -0
  43. package/dist/verify.d.ts.map +1 -0
  44. package/dist/verify.js +109 -0
  45. package/dist/wrapper.d.ts +26 -0
  46. package/dist/wrapper.d.ts.map +1 -0
  47. package/dist/wrapper.js +238 -0
  48. package/dist/zeph-hook.d.ts +23 -0
  49. package/dist/zeph-hook.d.ts.map +1 -0
  50. package/dist/zeph-hook.js +196 -0
  51. package/package.json +75 -0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 Zeph
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,499 @@
1
+ # @zeph-to/cli
2
+
3
+ [![npm](https://img.shields.io/npm/v/@zeph-to/cli.svg)](https://www.npmjs.com/package/@zeph-to/cli)
4
+ [![downloads](https://img.shields.io/npm/dm/@zeph-to/cli.svg)](https://www.npmjs.com/package/@zeph-to/cli)
5
+ [![node](https://img.shields.io/node/v/@zeph-to/cli.svg)](https://nodejs.org)
6
+ [![license](https://img.shields.io/npm/l/@zeph-to/cli.svg)](./LICENSE)
7
+
8
+ Push notification SDK + CLI for [Zeph](https://zeph.to), with an optional
9
+ resident listener that **drives Claude Code / Codex / Gemini sessions
10
+ from your phone** by injecting messages into named tmux sessions.
11
+
12
+ - `ZephHook` SDK — native `fetch`, no runtime deps. Send/list/dismiss pushes.
13
+ - `zeph` CLI — install Zeph plugins, send pushes, run agents under tmux,
14
+ and listen for inbound messages from your phone.
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install -g @zeph-to/cli
20
+ # or for one-off use
21
+ npx @zeph-to/cli notify --title "Hello"
22
+ ```
23
+
24
+ ## Quick Start
25
+
26
+ ```bash
27
+ # Sign in via browser — auto-fetches your API key + hook into
28
+ # ~/.zeph/config.json (no copy-paste)
29
+ npx @zeph-to/cli login
30
+
31
+ # Install for your AI agents (rules + hooks + MCP). Reuses the saved
32
+ # config; detects Claude Code / Cursor / Windsurf / Gemini / Codex / …
33
+ npx @zeph-to/cli install
34
+ ```
35
+
36
+ `login` opens a browser to the Zeph web app, asks you to confirm "connect
37
+ this computer", then issues a fresh API key (labelled with your hostname)
38
+ and reuses or creates a hook — writing both back to `~/.zeph/config.json`
39
+ over a localhost loopback. No credential ever gets pasted into the
40
+ terminal.
41
+
42
+ Prefer to paste credentials yourself (or on a headless box with no
43
+ browser)? Skip `login` and pass them to `install` directly:
44
+
45
+ ```bash
46
+ npx @zeph-to/cli install --key ak_... --hook hook_...
47
+ ```
48
+
49
+ Either way it saves to `~/.zeph/config.json`. All Zeph tools (CLI, MCP
50
+ server, plugin hooks, listener) read this file.
51
+
52
+ To **send** notifications:
53
+
54
+ ```bash
55
+ zeph notify --title "Deploy done" --body "v2.1.0 shipped"
56
+ ```
57
+
58
+ To **drive a Claude Code / Codex / Gemini session from your phone**, see
59
+ [Remote Control](#remote-control) below.
60
+
61
+ ## Remote Control
62
+
63
+ > Send messages from your phone *into* a live Claude Code / Codex /
64
+ > Gemini session — even after a `zeph_ask` polling window has expired.
65
+
66
+ The MCP tools `zeph_ask` / `zeph_prompt` / `zeph_input` open a polling
67
+ loop on a fixed timeout (120–600 s). Once that window closes the
68
+ session becomes unaddressable from the phone, even though it's still
69
+ running. The `zeph listener` daemon fixes this by keeping a persistent
70
+ WebSocket open to Zeph and injecting matching messages into a *named*
71
+ tmux session via `tmux send-keys`.
72
+
73
+ ### Architecture
74
+
75
+ ```
76
+ [phone — "Active Agents" picker on Zeph app]
77
+ │ selects session, types message
78
+ ▼ POST /pushes/send { type: 'agent.command',
79
+ │ agentSessionName: 'zeph-myapp',
80
+ │ body: '리팩토링 마무리해줘' }
81
+ [Zeph backend]
82
+ │ WebSocket fan-out (push.new)
83
+
84
+ [zeph listener — resident daemon, started by `zeph cc` automatically]
85
+ │ tmux send-keys -l -t zeph-myapp "리팩토링 마무리해줘" + Enter
86
+
87
+ [tmux session "zeph-myapp" running claude / codex / gemini]
88
+ ```
89
+
90
+ The listener also reports its tmux session inventory back to the server
91
+ every 5 seconds, so the phone picker stays in sync — no manual
92
+ configuration needed once a session is running.
93
+
94
+ ### Setup
95
+
96
+ 1. **Install tmux.** The listener uses `send-keys`; the wrapper spawns
97
+ named sessions. `brew install tmux` on macOS, `apt install tmux` on
98
+ Debian/Ubuntu.
99
+
100
+ 2. **Add `wsUrl` to `~/.zeph/config.json`** (the WebSocket endpoint of
101
+ your Zeph backend — CDK output `WsApiUrl`):
102
+
103
+ ```json
104
+ {
105
+ "apiKey": "ak_...",
106
+ "hookId": "hook_...",
107
+ "wsUrl": "wss://<api-id>.execute-api.<region>.amazonaws.com/<stage>"
108
+ }
109
+ ```
110
+
111
+ Alternatively set `ZEPH_WS_URL` in your shell env.
112
+
113
+ 3. **Run agents through the wrapper.** That's it.
114
+
115
+ ```bash
116
+ zeph cc # claude → tmux session "zeph-<project>"
117
+ zeph codex # codex → tmux session "zeph-<project>"
118
+ zeph gemini # gemini → tmux session "zeph-<project>"
119
+ ```
120
+
121
+ The first `zeph cc` on a machine **auto-spawns a background
122
+ listener** (singleton, PID file at `~/.zeph/listener.pid`,
123
+ stdout/stderr at `~/.zeph/listener.log`). You never run
124
+ `zeph listener` by hand — every `zeph cc` checks the PID file and
125
+ skips the spawn when one is already alive, so opening a dozen
126
+ terminals doesn't create a dozen daemons. The daemon survives
127
+ between `zeph cc` invocations.
128
+
129
+ Project name resolves from `CLAUDE_PROJECT_DIR` /
130
+ `CURSOR_PROJECT_DIR` / `WINDSURF_PROJECT_DIR` if set, else the git
131
+ repo root, else the cwd basename. Any extra args after the command
132
+ pass through to the agent verbatim:
133
+
134
+ ```bash
135
+ zeph cc --resume "abc123"
136
+ zeph cc --dangerously-skip-permissions
137
+ zeph codex --model gpt-5-high "fix the failing test"
138
+ ```
139
+
140
+ **Multiple sessions in one project.** Open another terminal in the
141
+ same folder, run `zeph cc` again, and the wrapper auto-suffixes:
142
+ first session is `zeph-encl`, the next attached one becomes
143
+ `zeph-encl-2`, then `zeph-encl-3`, etc. The phone picker shows them
144
+ as `encl · Claude`, `encl · Claude #2`, `encl · Claude #3`. If
145
+ `zeph-encl` already exists but is **detached** (no one attached),
146
+ the wrapper reattaches to it instead of spawning a new one — close
147
+ the terminal, come back later, pick up where you left off.
148
+
149
+ If you're already inside a tmux session (`$TMUX` set) the wrapper
150
+ skips the outer tmux and runs the agent in the current pane — the
151
+ listener can't target an unnamed session that way, but you keep your
152
+ existing multiplexer setup.
153
+
154
+ ### Diagnostics
155
+
156
+ The auto-spawned listener writes to two files under `~/.zeph/`:
157
+
158
+ - `listener.pid` — the running daemon's PID. `cat ~/.zeph/listener.pid`
159
+ + `ps -p <pid>` to confirm it's alive.
160
+ - `listener.log` — stdout + stderr from the daemon. `tail -f` to watch.
161
+
162
+ A healthy listener log shows one line per cycle:
163
+
164
+ ```
165
+ [xx:xx:xx] reported 2 session(s): zeph-myapp, zeph-otherapp
166
+ [xx:xx:xx] ✓ server persisted 2 session(s)
167
+ ```
168
+
169
+ If you see `! server rejected listener.sessions: ...` instead, the
170
+ message points at the failure (auth, missing device record, etc.) so
171
+ you can fix the actual problem instead of guessing.
172
+
173
+ To force a restart — e.g. after upgrading `@zeph-to/cli`:
174
+
175
+ ```bash
176
+ kill $(cat ~/.zeph/listener.pid)
177
+ rm ~/.zeph/listener.pid
178
+ zeph cc # autospawns the new build
179
+ ```
180
+
181
+ To run it in the foreground (for development of the SDK itself):
182
+
183
+ ```bash
184
+ zeph listener
185
+ ```
186
+
187
+ You'll get the same logs you'd otherwise tail from `listener.log`.
188
+
189
+ ### Custom tmux sockets
190
+
191
+ The listener auto-discovers the tmux socket — it probes the default
192
+ location, walks per-user `$TMPDIR` paths (macOS `/var/folders/.../T/`),
193
+ falls back to `/tmp/tmux-<uid>/`, and finally finds running tmux servers
194
+ via `lsof` so stale socket files don't trip discovery. If your tmux
195
+ uses `tmux -L <name>` or a non-standard `-S <path>`, set the override
196
+ explicitly:
197
+
198
+ ```bash
199
+ export ZEPH_TMUX_SOCKET=/path/to/socket
200
+ ```
201
+
202
+ (The wrapper passes the env to the auto-spawned listener, so setting
203
+ it in your shell rc is enough.)
204
+
205
+ ### Wire format
206
+
207
+ The listener only acts on pushes with `type='agent.command'` carrying
208
+ the tmux session name in `agentSessionName` and the message in `body`.
209
+ Other pushes (Stop-hook auto-pushes, `zeph_ask` responses, channel
210
+ broadcasts, plain notes) are ignored. End-to-end:
211
+
212
+ ```
213
+ tmux send-keys -l -t <agentSessionName> "<body>"
214
+ tmux send-keys -t <agentSessionName> Enter
215
+ ```
216
+
217
+ If you need to send one from the command line (debugging, scripting),
218
+ build the structured push directly:
219
+
220
+ ```bash
221
+ curl -X POST "$ZEPH_BASE_URL/pushes/send" \
222
+ -H "X-API-Key: $ZEPH_API_KEY" \
223
+ -H 'Content-Type: application/json' \
224
+ -d '{
225
+ "type": "agent.command",
226
+ "targetDeviceId": "dev_listener_<sha8(hostname)>",
227
+ "agentSessionName": "zeph-myapp",
228
+ "body": "테스트 통과시키고 PR 올려줘"
229
+ }'
230
+ ```
231
+
232
+ ### Defense
233
+
234
+ The listener is a remote-code-execution surface by design (it types
235
+ into a shell-adjacent pane). The defense is layered:
236
+
237
+ 1. **Pane guard** — before injecting, the listener checks
238
+ `tmux display-message -p '#{pane_current_command}'`. If the pane is
239
+ at an interactive shell (`bash`/`zsh`/`fish`/`sh`/`dash`/`ksh`/
240
+ `tcsh`/`csh`/`pwsh`), the inject is refused. CC/Codex/Gemini exited
241
+ ≠ phone gets free shell access.
242
+ 2. **Literal injection** — `tmux send-keys -l` takes the payload as
243
+ data; tmux escape sequences inside a message can't drive other tmux
244
+ commands.
245
+ 3. **Session-name allowlist** — only `[A-Za-z0-9._-]+` is accepted as
246
+ a session target, so shell metacharacters never reach the tmux argv.
247
+ 4. **Per-session rate limit** — 30 injections/minute/session token
248
+ bucket caps a runaway/compromised sender.
249
+ 5. **Agent permission gate stays on** — your CC/Codex/Gemini permission
250
+ prompt is still in front of every destructive tool call. The phone
251
+ can *talk* but can't approve `rm -rf` for you.
252
+
253
+ The transport (WS) is currently authenticated by API key + `push:read`
254
+ scope and is **not** end-to-end encrypted in v1 — your Zeph backend
255
+ sees the message plaintext. If you self-host or trust your backend,
256
+ that's fine. If you don't, hold off until per-device E2E ships.
257
+
258
+ ## CLI Usage
259
+
260
+ ```bash
261
+ # Send a notification
262
+ zeph notify --title "Deploy done" --body "v2.1.0 shipped"
263
+
264
+ # Send with priority
265
+ zeph notify --title "Build failed" --priority high --url https://ci.example.com/123
266
+
267
+ # List recent pushes
268
+ zeph list
269
+ zeph list --limit 10 --type note
270
+
271
+ # Dismiss a push
272
+ zeph dismiss push_01JXY...
273
+ zeph dismiss --all
274
+
275
+ # Test connection
276
+ zeph test
277
+
278
+ # Run an agent in a named tmux session (so the listener can reach it)
279
+ zeph cc # claude
280
+ zeph codex # codex
281
+ zeph gemini # gemini
282
+
283
+ # Run the resident listener (foreground; background it as you like)
284
+ zeph listener
285
+ zeph listener --ws-url wss://... # override config
286
+
287
+ # JSON output
288
+ zeph notify --title "Hello" --json
289
+ ```
290
+
291
+ ### Commands
292
+
293
+ | Command | Description |
294
+ |---------|-------------|
295
+ | `login` | Browser sign-in: auto-fetch API key + hook into `~/.zeph/config.json` over a localhost loopback (`--web-url`, `--timeout`). No copy-paste |
296
+ | `install` | One-command setup: detect agents, save config, install rules + hooks + MCP |
297
+ | `uninstall` | Remove Zeph from all detected agents (`--dry-run`, `--purge`) |
298
+ | `verify` | Check installation health across detected agents (`--ping` for a live API call) |
299
+ | `check-update` | Check whether a newer Zeph version is on npm |
300
+ | `notify` | Send a push notification |
301
+ | `list` | List recent push notifications |
302
+ | `dismiss <id>` | Dismiss a push (or `--all`) |
303
+ | `test` | Verify connection and API key |
304
+ | `cc` · `codex` · `gemini` | Run the agent in a `zeph-<project>` tmux session (auto-suffixed `-2`, `-3`, … on attached collisions). Auto-spawns the background listener on first invocation so the phone picker just works. Trailing args pass through to the agent (`zeph cc --resume "..."`) |
305
+ | `listener` | (Usually unnecessary — `zeph cc` autospawns it.) Resident daemon: subscribes via WebSocket, reports tmux session inventory every 5 s, injects `agent.command` pushes into the matching session. Run in the foreground for SDK development; otherwise let `zeph cc` manage it |
306
+
307
+ ### Notify Options
308
+
309
+ | Flag | Description |
310
+ |------|-------------|
311
+ | `--title <text>` | Push title (default: `"Task done"`) |
312
+ | `--body <text>` | Push body (default: `"<project> · <branch>"` if cwd is a git repo, else `"<project>"`) |
313
+ | `--url <url>` | URL to include |
314
+ | `--type <type>` | Push type: `note`, `link`, `file`, `hook` |
315
+ | `--priority <p>` | Priority: `low`, `normal`, `high`, `urgent` |
316
+ | `--device <id>` | Target device ID |
317
+
318
+ The defaults are tuned for hook-driven invocations (e.g. Stop hooks
319
+ calling `zeph notify --title "Task done"` without a body) — you'll see
320
+ which project + branch finished without writing per-IDE wrappers. Pass
321
+ `--body ""` explicitly to suppress.
322
+
323
+ ### Listener Options
324
+
325
+ | Flag | Description |
326
+ |------|-------------|
327
+ | `--ws-url <url>` | WebSocket endpoint (or set `ZEPH_WS_URL` env, or `wsUrl` in `~/.zeph/config.json`) |
328
+ | `--key <api-key>` | API key (or set `ZEPH_API_KEY` env) |
329
+
330
+ The listener reconnects with exponential backoff + jitter (1 s → 30 s
331
+ cap). Heartbeat is ping every 25 s with a 10 s pong timeout. On an
332
+ authentication failure close (4001/4002/4003) the listener exits with
333
+ code 3 instead of looping forever — fix the key and restart.
334
+
335
+ ### List Options
336
+
337
+ | Flag | Description |
338
+ |------|-------------|
339
+ | `--limit <n>` | Number of pushes (1-20, default 5) |
340
+ | `--type <type>` | Filter by push type |
341
+
342
+ ### Global Options
343
+
344
+ | Flag | Description |
345
+ |------|-------------|
346
+ | `--key <api-key>` | API key (or set `ZEPH_API_KEY` env) |
347
+ | `--base-url <url>` | API base URL (or set `ZEPH_BASE_URL` env) |
348
+ | `--json` | Output JSON format |
349
+ | `--version` | Print version |
350
+
351
+ ### Mute
352
+
353
+ Mute is project-scoped (uses project directory hash). Created by Claude
354
+ Code `/zeph-mute` command.
355
+
356
+ Notifications are silently skipped when a mute file exists for the
357
+ current project:
358
+
359
+ ```bash
360
+ # Mute (created by /zeph-mute in Claude Code plugin)
361
+ HASH=$(echo -n "$PROJECT_DIR" | cksum | cut -d' ' -f1)
362
+ touch /tmp/zeph-muted-$HASH
363
+
364
+ # Unmute
365
+ rm /tmp/zeph-muted-$HASH
366
+ ```
367
+
368
+ The CLI checks `CLAUDE_PROJECT_DIR`, `CURSOR_PROJECT_DIR`,
369
+ `WINDSURF_PROJECT_DIR`, and falls back to `cwd`.
370
+
371
+ ### Exit Codes
372
+
373
+ | Code | Meaning |
374
+ |------|---------|
375
+ | 0 | Success |
376
+ | 1 | General error |
377
+ | 2 | Quota exceeded |
378
+ | 3 | Authentication failed (also: listener auth close 4001/4002/4003) |
379
+ | 127 | A required external binary (e.g. `tmux`, `claude`) was not found on PATH |
380
+
381
+ ### Environment Variables
382
+
383
+ | Variable | Description |
384
+ |----------|-------------|
385
+ | `ZEPH_API_KEY` | API key (fallback when `--key` not provided) |
386
+ | `ZEPH_BASE_URL` | API base URL (default: `https://api.zeph.to/v1`) |
387
+ | `ZEPH_WS_URL` | WebSocket endpoint for `zeph listener` (no default — required) |
388
+ | `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>`) |
389
+ | `ZEPH_SESSION_ID` | AI session ID (fallback when `--session` not provided) |
390
+
391
+ ## SDK Usage
392
+
393
+ ```typescript
394
+ import { ZephHook } from '@zeph-to/cli';
395
+
396
+ const hook = new ZephHook({ apiKey: 'ak_...' });
397
+
398
+ // Notify
399
+ const result = await hook.notify({
400
+ title: 'Build Complete',
401
+ body: 'Deploy succeeded',
402
+ url: 'https://example.com/deploy/123',
403
+ priority: 'high',
404
+ });
405
+ console.log(result.pushId); // 'push_01JXY...'
406
+
407
+ // List
408
+ const list = await hook.list({ limit: 5 });
409
+ console.log(list.pushes);
410
+
411
+ // Dismiss
412
+ await hook.dismiss('push_01JXY...');
413
+ await hook.dismissAll();
414
+ ```
415
+
416
+ ### Constructor Options
417
+
418
+ | Field | Type | Description |
419
+ |-------|------|-------------|
420
+ | `apiKey` | `string` | Required — API key from Zeph settings |
421
+ | `baseUrl` | `string?` | API base URL (default: `https://api.zeph.to/v1`) |
422
+ | `timeout` | `number?` | Request timeout in ms (default: 30000) |
423
+
424
+ ### Notify Payload
425
+
426
+ | Field | Type | Description |
427
+ |-------|------|-------------|
428
+ | `title` | `string?` | Push title |
429
+ | `body` | `string?` | Push body |
430
+ | `url` | `string?` | URL to include |
431
+ | `type` | `'note' \| 'link' \| 'file' \| 'hook'?` | Push type (default: `hook`) |
432
+ | `priority` | `'low' \| 'normal' \| 'high' \| 'urgent'?` | Priority (default: `normal`) |
433
+ | `targetDeviceId` | `string?` | Send to specific device |
434
+
435
+ ### Error Handling
436
+
437
+ ```typescript
438
+ import { ZephHook, AuthenticationError, QuotaExceededError, ZephError } from '@zeph-to/cli';
439
+
440
+ try {
441
+ await hook.notify({ title: 'Hello' });
442
+ } catch (err) {
443
+ if (err instanceof AuthenticationError) { /* Invalid API key */ }
444
+ if (err instanceof QuotaExceededError) { /* Monthly limit reached */ }
445
+ if (err instanceof ZephError) { /* Other API error */ }
446
+ }
447
+ ```
448
+
449
+ ## Supported Agents
450
+
451
+ `zeph install` detects and configures these agents automatically:
452
+
453
+ | Agent | What gets installed |
454
+ |-------|-------------------|
455
+ | Claude Code | Plugin (hooks + MCP server) |
456
+ | Cursor | MCP server + stop hook + rules |
457
+ | Windsurf | MCP server + response hook |
458
+ | Gemini CLI | MCP server + AfterAgent hook |
459
+ | Codex CLI | Stop hook |
460
+ | Copilot CLI | Session end hook |
461
+ | Cline | Rules file |
462
+
463
+ For remote-control via `zeph listener` the per-agent setup is the same
464
+ across CC/Codex/Gemini — the wrapper just spawns them in a named tmux
465
+ session.
466
+
467
+ ## Encryption
468
+
469
+ Push bodies are encrypted with AES-256-GCM. The wrapping key is derived
470
+ via ECDH P-256 and synced across your own devices on first run so every
471
+ device can read the same push. Toggle encryption in the Zeph app
472
+ (Settings → Encryption); when disabled, the CLI sends plaintext. No
473
+ configuration needed.
474
+
475
+ **Threat model honesty:** keys are persisted on the Zeph backend to
476
+ enable cross-device sync, so this is *device-shared* encryption — not
477
+ true end-to-end. It protects push contents from passive network
478
+ observers and from a leaked database snapshot taken without the key
479
+ store, but it does **not** protect against the Zeph backend itself (it
480
+ has the keys it serves to your devices). A true E2E mode (per-device
481
+ keypairs, server stores only public keys, no key escrow) is on the
482
+ roadmap.
483
+
484
+ The `zeph listener` ignores `isEncrypted` pushes for now — it has no
485
+ per-device key to decrypt them. Stop-hook auto-pushes and `zeph_ask`
486
+ responses are not part of the `@<session>` injection path, so this
487
+ doesn't affect normal use.
488
+
489
+ ## Requirements
490
+
491
+ - **Node.js >= 18** (uses native `fetch`).
492
+ - **tmux** — required for `zeph cc` / `codex` / `gemini` and `zeph listener`.
493
+ - The `ZephHook` SDK has no runtime dependencies. The CLI depends on
494
+ `@inquirer/prompts` for the interactive `zeph install` picker and on
495
+ `ws` for the listener's WebSocket subscription.
496
+
497
+ ## License
498
+
499
+ Apache-2.0