session-peer 0.2.0 → 0.3.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/docs/guide.md ADDED
@@ -0,0 +1,554 @@
1
+ # User guide — session-peer (TypeScript)
2
+
3
+ [Back to README](../README.md)
4
+
5
+ [English](guide.md) | [한국어](guide.ko.md) | [日本語](guide.ja.md) | [简体中文](guide.zh-CN.md)
6
+
7
+ This guide covers 0.3.0, which adds multi-host SSH, sender context and return routes, update checks and the optional `sp` shorthand to 0.2.1 ([changes](../PARITY.md#030-remote-usability-and-maintenance)). [Public 0.2.1 release evidence](../VALIDATION.md#public-021--2026-09-29-kst) records the previous publication. References to 0.1.0 below describe the older release.
8
+
9
+ ## Contents
10
+
11
+ - [Quick start](#quick-start)
12
+ - [What it does](#what-it-does)
13
+ - [Requirements](#requirements)
14
+ - [Build from source](#build-from-source)
15
+ - [Existing installations](#existing-installations)
16
+ - [Use](#use)
17
+ - [What success means](#what-success-means)
18
+ - [Development and verification](#development-and-verification)
19
+ - [Package release](#package-release)
20
+ - [Related project](#related-project)
21
+ - [Agent skill: explicit installation](#agent-skill-explicit-installation)
22
+
23
+
24
+ **Find and message running Claude Code and Codex sessions, locally or over SSH.**
25
+ This TypeScript client runs on Node.js without Python.
26
+
27
+ This guide describes **0.3.0**. The npm package and CLI command are both **`session-peer`**. This
28
+ project does not provide a Relay server or hosted service.
29
+
30
+ ## Quick start
31
+
32
+ Use Node **22.13+ within 22.x or 24.x**. Check which `session-peer` your PATH
33
+ selects if the Python CLI is already installed; both packages use that command.
34
+
35
+ ```sh
36
+ npm install --global --ignore-scripts session-peer@0.3.0
37
+ session-peer --version # session-peer 0.3.0 (typescript)
38
+ session-peer list --agent claude --json
39
+ session-peer send --to CLAUDE_PID --message 'Please review the API contract.' --dry-run --json
40
+ ```
41
+
42
+ 1. List sessions and replace `CLAUDE_PID` with the exact PID you selected.
43
+ 2. Run the send command with `--dry-run`; nothing is submitted.
44
+ 3. When delivery is intended, run that command once without `--dry-run`.
45
+ 4. If acknowledgement matters, ask for an explicit reply in the message and
46
+ verify the receiver's TUI response separately. `posted` / `queued` confirms
47
+ submission only. See [What success means](#what-success-means).
48
+
49
+ ### CLI usability in 0.2.0
50
+
51
+ Version 0.2.0 adds `list --help`, `send --help`, `doctor --help` and explicit
52
+ `--output-format text`. Output selection remains required: use `--json` or
53
+ `--output-format json|text`. Parse errors use JSON; valid text requests render
54
+ operation results/errors as text. SSH always exchanges JSON internally.
55
+
56
+ `send --to TARGET "message" --json` accepts one positional body. Do not combine
57
+ it with `--message`/`-m`; omit the body or use `-` for stdin, and use `--` before
58
+ an option-looking positional body. Empty/whitespace bodies are refused before
59
+ adding the sender envelope. Claude names use exact Unicode 14.0.0 default full
60
+ casefold (no normalization/fuzzy matching); collisions require a PID. This
61
+ source behavior is not retroactively available in the published 0.1.0 package.
62
+
63
+
64
+ ## What it does
65
+
66
+ - Discover local Claude/Codex sessions and known Codex homes (0.2.0; see below).
67
+ - Validate a destination with `--dry-run`, then submit one message to its native
68
+ inbox or queue. Codex normally requires a unique, stable live writer.
69
+ - Use the same commands over SSH to an explicitly installed remote client.
70
+ - Accept structured Reply-To URIs as destinations and provide JSON results.
71
+ - Refuse ambiguous targets and uncertain ownership; never automatically retry
72
+ an uncertain submission.
73
+
74
+ Not implemented: Relay transport, MCP, wake/resume,
75
+ Antigravity or automatic updates. Unsupported commands fail explicitly; this is not a general orchestrator.
76
+
77
+ Planned client gaps are tracked in the [versioned compatibility matrix and npm migration guide](../PARITY.md); a plan is not an available feature. Relay server/hosted-service delivery remains outside this client's scope.
78
+
79
+ ### Unified listing in 0.2.0
80
+
81
+ After building this source, `node dist/cli.js list --json` combines Claude and
82
+ Codex; `list --agent codex --json` searches known homes. Published npm **0.1.0**
83
+ still requires an explicit agent and a home for Codex listing; the install and
84
+ explicit list/send forms also work with that older release.
85
+
86
+ Sources are default `~/.codex`, `CODEX_HOME`, immediate macOS Orca account homes,
87
+ and the JSON array `SESSION_PEER_CODEX_HOMES`. `--codex-home` pins Codex listing
88
+ and bypasses unrelated inventory errors; `--agent claude` skips Codex entirely.
89
+ Aliases are deduplicated, but the same UUID in different homes stays separate.
90
+ Use each row's `codexHome` when sending. Optional absent homes are not failures;
91
+ explicitly configured missing/invalid homes produce partial results and exit 1,
92
+ retaining readable rows. Listing never selects a writer or submits a message.
93
+ See the [source listing contract](../PARITY.md#source-unified-listing-contract--16--020)
94
+ for ordering, diagnostics, `--all` and SSH behavior.
95
+
96
+ Source Codex send now selects the unique stable live writer when `--codex-home`
97
+ is omitted. Explicit homes still check all known competitors. Inactive queueing
98
+ requires both `--codex-home HOME` and `--allow-inactive-codex-home`, a saved thread,
99
+ and verified inactive candidates; it never wakes or resumes a session. Dry-run
100
+ submits nothing. JSON adds sanitized `codexHomeResolution` and, when supplied by
101
+ native queue output, `queueId`; neither confirms consumption. See the
102
+ [selection contract](../PARITY.md#source-codex-home-selection--17--020).
103
+ Published **0.1.0** still requires an explicit live home and has no inactive opt-in.
104
+ On SSH, both ends need the same TypeScript client version (0.3.0).
105
+
106
+ ## Requirements
107
+
108
+ macOS, Linux or native Windows; Node **22.13+ within 22.x or 24.x**. Node 26 is not supported.
109
+ The native flock dependency needs a matching prebuilt binary (x64/arm64); this
110
+ is not a pure-JavaScript package. Codex sends need `codex`; macOS/Linux also
111
+ need `lsof` and `ps`. Windows uses native lock and Restart Manager inspection.
112
+ Claude needs a live TUI with an accessible native inbox. SSH requires OpenSSH,
113
+ existing key/host trust and the **same client version** on the destination.
114
+
115
+ ## Build from source
116
+
117
+ To run a reviewed source checkout instead of the published npm package, build
118
+ it and optionally install its local tarball:
119
+
120
+ ```sh
121
+ git clone https://github.com/abruption/session-peer-ts.git
122
+ cd session-peer-ts
123
+ npm ci --ignore-scripts
124
+ npm run build
125
+ node dist/cli.js --version
126
+ npm pack --ignore-scripts
127
+ # Optional global install: first check which session-peer your PATH selects.
128
+ npm install --global --ignore-scripts ./session-peer-0.3.0.tgz
129
+ session-peer --version
130
+ ```
131
+
132
+ Expected: `session-peer 0.3.0 (typescript)`. Keep the `./...tgz` path to
133
+ select the locally built artifact. Check the checkout version before using
134
+ these commands for a later release.
135
+
136
+ ## Existing installations
137
+
138
+ Other implementations may also install `session-peer`. Check `type -a session-peer`
139
+ and `command -v session-peer` before and after installation. Choose one on PATH,
140
+ or call this build explicitly with `node /absolute/path/dist/cli.js`. Do not use
141
+ `--force` to overwrite another manager's files. No Python package, skill or service
142
+ is installed, removed or reconfigured automatically. To remove this npm install,
143
+ run `npm uninstall --global session-peer` and recheck PATH.
144
+
145
+ On Windows PowerShell, inspect competing commands with
146
+ `Get-Command session-peer -All`. To avoid replacing the Python CLI, use an isolated prefix:
147
+
148
+ ```powershell
149
+ npm ci --ignore-scripts
150
+ npm run build
151
+ npm pack --ignore-scripts
152
+ npm install --prefix "$env:TEMP\session-peer-ts-source" --ignore-scripts .\session-peer-0.3.0.tgz
153
+ & "$env:TEMP\session-peer-ts-source\node_modules\.bin\session-peer.cmd" --version
154
+ # Later: npm uninstall --prefix "$env:TEMP\session-peer-ts-source" session-peer
155
+ ```
156
+
157
+ ## Use
158
+
159
+ ```sh
160
+ session-peer list --agent claude --json
161
+ session-peer list --agent codex --codex-home "$HOME/.codex" --json
162
+ session-peer send --to CLAUDE_PID --message 'Please review the API contract.' --dry-run --json
163
+ session-peer send --to codex:THREAD_UUID --codex-home "$HOME/.codex" --message 'Please review the API contract.' --dry-run --json
164
+ ```
165
+
166
+ Remove `--dry-run` only when delivery is intended. Omit `--message` or use
167
+ `--message -` for UTF-8 stdin. `--all` includes stale/archived records for listing;
168
+ it does not authorize sending. Claude accepts a PID, `claude:PID`, or an
169
+ unambiguous Unicode 14.0.0 casefolded name. Use a PID for collisions. Codex
170
+ send requires a full UUID; home selection follows the guards above; `--codex-bin` selects an executable.
171
+ Output requires `--json` or `--output-format json|text`.
172
+
173
+ ### Another machine over SSH
174
+
175
+ ```sh
176
+ session-peer send --host user@machine --remote-bin /absolute/path/session-peer \
177
+ --to CLAUDE_PID --message 'Please review the API contract.' --dry-run --json
178
+ ```
179
+
180
+ The default remote command is `session-peer` on remote PATH. An absolute
181
+ `--remote-bin` can select a wrapper using supported Node. The handshake checks
182
+ the TypeScript marker and exact version; a different implementation is refused.
183
+ SSH uses BatchMode and StrictHostKeyChecking. It never accepts new host keys,
184
+ installs a remote runtime or invokes Python as a fallback. Messages travel in a
185
+ JSON stdin request, not remote shell arguments. Forward access does not
186
+ establish reverse access. Since 0.3.0, Tailscale is used only as a routing
187
+ hint; see [Replies](#replies).
188
+
189
+ For a Windows SSH destination, add `--remote-platform win32` and select a
190
+ Windows `--remote-bin 'C:\absolute\path\session-peer.cmd'` if needed. A previously
191
+ authenticated OpenSSH control socket can be selected with
192
+ `--ssh-control-path /absolute/local/socket` with exactly one `--host`; this
193
+ does not bypass host-key verification or grant a new login. For local Windows Codex commands, use a full
194
+ `C:\Users\...\.codex` path for `--codex-home`. The Python CLI, if present,
195
+ is not removed or replaced by this client.
196
+
197
+ ### Several hosts and connection options
198
+
199
+ Since 0.3.0 (not in 0.2.1 or earlier), the CLI accepts repeated `--host` and a constrained
200
+ `--ssh-opt`:
201
+
202
+ ```sh
203
+ session-peer list --host alpha --host user@[2001:db8::1] \
204
+ --ssh-opt=-p --ssh-opt=2222 --ssh-opt=-i --ssh-opt="$HOME/.ssh/id_ed25519" --json
205
+ ```
206
+
207
+ - One `--host` returns one object, as before. Repeated `--host` returns a JSON
208
+ array in the same order; every element has `schemaVersion`, `ok`, `host` and
209
+ `command`. If any host fails, the exit code is 1. Text output prints one
210
+ `Host: <host>` block per destination.
211
+ - All hosts and options are validated before any `ssh` process starts. One bad
212
+ value refuses the whole command with `submitted:false`. Every `--host VALUE`
213
+ or `--host=VALUE` before `--` is collected first, so with two or more of them
214
+ any refusal, including an unknown option or a missing value, is an array with
215
+ one element per host. With fewer, it is one flat object.
216
+ - The same destination twice is `duplicate_ssh_host`. This check compares the
217
+ destination text only (user, case-insensitive host name, canonical IPv6). Two
218
+ aliases or addresses for the same machine are not detected.
219
+ - `--ssh-jump USER@HOST[:PORT]` (once, POSIX clients) routes every `ssh` call
220
+ for every `--host` through one jump host. The user is required, IPv6 needs
221
+ brackets (`hop@[2001:db8::1]:22`), and `%`, `$`, quotes, spaces and other
222
+ shell characters are refused (`invalid_ssh_jump`). Instead of `-J`, the CLI
223
+ builds a fixed `ProxyCommand`. The hop runs `ssh` with `BatchMode=yes`,
224
+ `StrictHostKeyChecking=yes`, `UpdateHostKeys=no`, `ConnectTimeout=10`,
225
+ `ConnectionAttempts=1`, `ProxyCommand=none`, `ProxyJump=none`,
226
+ `ControlPath=none`, `ForwardAgent=no`, `ClearAllForwardings=yes` and
227
+ `PermitLocalCommand=no`, then `-W [target]:port`. The outer `ssh` also gets
228
+ `ControlMaster=no`, `ControlPath=none` and `ProxyUseFdpass=no`, so a
229
+ configured control master cannot bypass the hop. `ProxyCommand` runs through
230
+ your login shell (`$SHELL`). It was verified with sh, bash and zsh; other
231
+ login shells (for example fish or csh) are unverified. The hop needs its own
232
+ known_hosts entry. `--ssh-opt` values, including `-4`/`-6`, apply to the
233
+ target only and are not passed to the hop; the
234
+ hop otherwise uses your ssh config for that host. Only one hop is supported.
235
+ `--ssh-jump` conflicts with `--ssh-control-path` (`conflicting_ssh_jump`) and
236
+ is refused on Windows clients (`ssh_jump_unsupported_platform`) until
237
+ Win32-OpenSSH's `ProxyCommand` handling is verified. Results add `sshJump`.
238
+ - Timeouts are bounded. On POSIX each `ssh` starts detached: in a new session
239
+ and process group with no controlling terminal. Cleanup covers that group
240
+ only; a descendant that leaves it with `setsid()` is out of scope, and there
241
+ is no PID scanning. At
242
+ a timeout or output overflow the whole group is killed, including a jump
243
+ `ProxyCommand` or any other descendant still holding the output pipes, and the
244
+ call returns shortly after. Ctrl-C, SIGTERM or SIGHUP to the CLI also kills the
245
+ group before the CLI exits. On Windows only the direct child is killed, so
246
+ descendants may linger, but the call still returns at the deadline. A preflight
247
+ timeout is a refusal (`ssh_preflight_timeout`); a request timeout is `unknown`
248
+ and is never retried.
249
+ - Each destination gets one preflight and at most one request, in order. A
250
+ refused or `unknown` host does not stop the next host and is never retried or
251
+ resent elsewhere. Check each element before acting on it.
252
+ - `--ssh-opt` accepts only `-p PORT`, `-l USER`, `-i IDENTITY_FILE`,
253
+ `-o Port=…`, `-o User=…`, `-o IdentityFile=…`, `-o IdentitiesOnly=yes|no`,
254
+ `-4` and `-6`. Everything else, including `ProxyCommand`, `LocalCommand`,
255
+ `-F`, `Include`, `-J`/`ProxyJump` and any `BatchMode`/`StrictHostKeyChecking`
256
+ change, is refused (`unsupported_ssh_option`). Use `--ssh-jump` instead of
257
+ `-J`: OpenSSH's own `-J` hop does not receive the command-line `BatchMode` or
258
+ `StrictHostKeyChecking`.
259
+ - IPv6 literals may be bare (`2001:db8::1`) or bracketed (`[2001:db8::1]`,
260
+ `user@[2001:db8::1]`); zone IDs are refused.
261
+ - Results add `sshUser` and `sshUserSource`: `explicit` for `USER@HOST` or
262
+ `-l USER`, `ssh_config_or_local_default` from `ssh -G`, or `unknown` with
263
+ `sshUser:null`. `-l` together with `USER@HOST` is refused. Without an explicit
264
+ user, a local `ssh -G` runs once per host, limited to 5 s. It does not
265
+ connect, but as ssh(1) and ssh_config(5) describe, it evaluates your ssh
266
+ configuration, including `Match exec` commands, just as a normal `ssh` would.
267
+ - Two trust boundaries apply. The allowlist governs only the options this CLI
268
+ passes on the command line. Your own `~/.ssh/config` (and the system config)
269
+ is trusted user configuration: its `ProxyCommand`, `ProxyJump`, `Match exec`
270
+ and similar settings run for every `ssh` this CLI starts, exactly as they do
271
+ for your own `ssh` commands.
272
+
273
+ A proposed design for provisioning destinations without Python (a private,
274
+ versioned install directory, integrity checks, ownership and rollback rules)
275
+ and for a protocol compatibility contract separate from package versions is in
276
+ [Remote deployment ADR](design/remote-deployment.md). It is not implemented; the exact
277
+ same-version requirement above still applies.
278
+
279
+ ### Replies
280
+
281
+ Use a `session-peer://v1/reply?...` URI as `--to`. Unknown/duplicate fields,
282
+ unsafe hosts, malformed encoding and conflicting explicit routes are rejected.
283
+ Peer metadata is never authority, and a Reply-To URI is never executed as shell
284
+ text. A received Reply-To is data for the reader; no reply is observed or
285
+ confirmed automatically.
286
+
287
+ Since 0.3.0 (not in 0.2.1 or earlier), the CLI adds sender context and generated routes:
288
+
289
+ - **Sender.** Inside Claude Code, `CLAUDE_CODE_MESSAGING_SOCKET` must match
290
+ exactly one live registered session; its unique printable name (otherwise its
291
+ PID) becomes `From: claude:NAME`. Inside Codex, a valid `CODEX_THREAD_ID` (or
292
+ `CODEX_SESSION_ID`) gives `From: codex:UUID`. Conflicting, nested or invalid
293
+ evidence gives no identity, and then no generated Reply-To. `--no-from` omits
294
+ From only.
295
+ - **Generated Reply-To.** With a sender and no `--no-reply-to`, a local send gets
296
+ a `transport=local` URI. An SSH send, or `--reply-to`, gets a
297
+ `transport=ssh` URI whose host comes from `--reply-to HOST`, then
298
+ `SESSION_PEER_REPLY_HOST`, then `CC_PEER_REPLY_HOST`, then this machine's
299
+ tailnet name or address. A host without a user gets the current user. If no
300
+ host is found, no SSH route is added. `--reply-address URI` stays an explicit
301
+ alternative. `--reply-to`, `--reply-address` and `--no-reply-to` are mutually
302
+ exclusive. Every URI is checked by the same parser as `--to`.
303
+ - **JSON.** `replyRoute` reports the generated route: local routes are
304
+ `verified` (`same_machine_route`), SSH routes `unverified`
305
+ (`reverse_ssh_not_checked`). When `--to` is a URI, `addressResolution`
306
+ records its transport, and `normalizedFrom: "ssh_self"` when it was delivered
307
+ locally.
308
+ - **Same machine.** An SSH reply URI is delivered locally only when its host
309
+ includes this OS user and names this machine in an exact form (`localhost`,
310
+ canonical `127.x.y.z`, `::1`, `::ffff:127.x.y.z`, the host name or the
311
+ Tailscale self node; never a non-canonical numeric such as `127.1` or
312
+ `0177.0.0.1`, nor an IPv4-compatible address such as `::7f00:1`), and no `--host` or SSH option (including `--ssh-jump`) was given. A
313
+ different or missing user stays SSH.
314
+ - **Tailscale.** `tailscale status --json` (3 s bound) is a routing hint only.
315
+ A peer whose `Online` is the boolean `true` (with MagicDNS on) keeps your SSH
316
+ alias as the destination and adds `HostName=<MagicDNS name>`. It also adds
317
+ `HostKeyAlias=<original name>`, unless the same `ssh -G` that reads the user
318
+ shows a `HostKeyAlias` already set in your ssh config (that one is kept), or
319
+ that lookup fails (nothing is overridden). The result `host` is then the
320
+ MagicDNS name, and `sshHost` is the alias you gave. A peer whose `Online` is
321
+ the boolean `false`, even with MagicDNS off, or an ambiguous name, is refused
322
+ before SSH (`tailscale_peer_offline`, `tailscale_destination_ambiguous`). Any
323
+ other `Online` value, MagicDNS off, an unknown name, a stopped or missing
324
+ Tailscale, or `SESSION_PEER_TAILSCALE=off` means ordinary SSH.
325
+ - **Return route.** `doctor --check-return-route [--reply-to USER@HOST]` runs
326
+ `ssh … USER@HOST 'exit 0'` from the diagnosed machine (the `--host`
327
+ destination, or this one). It uses batch mode, no password or
328
+ keyboard-interactive prompts, strict host keys, no host-key updates, no
329
+ control socket and a 5 s connect timeout. The 8 s deadline applies to that
330
+ final `ssh` command only; the Tailscale status (3 s) and `ssh -G` (5 s)
331
+ lookups before it have their own limits. `exit 0` is a no-op in POSIX shells,
332
+ cmd.exe and PowerShell, so the return host may be any OpenSSH server with one
333
+ of those default shells (only POSIX return hosts have fixture coverage).
334
+ `returnRoute` is `verified` or `failed` with a reason
335
+ (`return_host_unavailable`, `return_host_is_receiver`,
336
+ `ssh_executable_missing`, `authentication_failed`, `host_key_failed`,
337
+ `timeout`, `transport_failed`, `remote_command_failed`). Locally, this user
338
+ on this machine is a local route without SSH. With `--host`, a loopback
339
+ return host that might name a machine is refused before SSH, without DNS:
340
+ `localhost`, `*.localhost`, canonical 127.0.0.0/8 and 0.0.0.0/8, `::1`,
341
+ `::`, their `::ffff:` mapped forms, IPv4-compatible IPv6 (`::a.b.c.d`), and
342
+ every non-canonical numeric (leading zeros, fewer than four parts, hex or
343
+ octal parts, single integers, overflow such as `127.1`, `0177.0.0.1`,
344
+ `2130706433` or `4294967296`), because resolvers disagree on those. It is
345
+ refused
346
+ (`invalid_return_route`), because the destination would read it as itself.
347
+ On the destination, a return host that is a known name of the destination
348
+ itself (for any user) or an unprovable numeric form fails as
349
+ `return_host_is_receiver` and is never reported as a verified local route.
350
+ "Known name" means only an exact match with the OS host name or the Tailscale
351
+ self names and addresses; other DNS or LAN aliases of a machine are not
352
+ detected. Likewise a remote send never advertises a loopback or non-canonical
353
+ numeric reply host (`invalid_reply_host`). It is never run automatically, never retried, and forward
354
+ reachability never implies it. Like every `ssh` this CLI starts, the probe
355
+ and its `ssh -G` user lookup use your trusted ssh configuration on the
356
+ probing machine, including `ProxyCommand` and `Match exec` (see the trust
357
+ boundaries above). The command-line allowlist does not apply to that file.
358
+
359
+ ## What success means
360
+
361
+ | Result | Meaning |
362
+ | --- | --- |
363
+ | `validated`, `submitted:false` | Dry-run checks passed; nothing sent. |
364
+ | `posted` / `queued` | Native inbox write / queue acceptance, **not consumption or ACK**. |
365
+ | `refused`, `submitted:false` | Rejected before submission. |
366
+ | `unknown`, `submitted:null` | Submission may have happened; do not automatically resend. |
367
+
368
+ After submission, a missing reply or a target exit alone does not establish
369
+ consumption or failure; do not automatically resend.
370
+
371
+ `consumptionConfirmed` is always false. Verify an actual ACK separately in the
372
+ receiver's TUI, not from queueing or transcript polling. Exit codes are 0/1/2
373
+ for success/error/usage. Errors use fixed codes instead of raw native stderr or
374
+ message content. Codex uses real kernel flock, file identity and same-user owner
375
+ start time across samples, then revalidates before queueing. No lock is deleted
376
+ and no owning agent process is signaled. Discovery output still contains local
377
+ names/paths/IDs: redact it before sharing.
378
+
379
+ ## Development and verification
380
+
381
+ ```sh
382
+ npm ci --ignore-scripts
383
+ npm run build
384
+ node scripts/check-repository.mjs
385
+ SESSION_PEER_PYTHON_ROOT=/path/to/python-reference npm test
386
+ npm run test:package
387
+ npm audit
388
+ ```
389
+
390
+ Python is only the development conformance oracle (v1.0.2 commit
391
+ `47c23713d0a2a3c11ebde6186afd8c43489b8b65`), never a runtime dependency. Tests also
392
+ need a C compiler and lsof for the POSIX contract suite. CI uses Node 22/24 on
393
+ macOS, Linux and Windows. macOS/Linux run the full contract suite and package
394
+ checks against the pinned reference. Windows x64 runs build/type checks, native
395
+ Claude inbox and held/free lock fixtures, writer ownership/revalidation races,
396
+ CLI queue outcomes, PowerShell/.cmd SSH framing through an isolated fake endpoint,
397
+ package install/native-load/uninstall checks and audit. These are fixture checks;
398
+ Windows does not run the POSIX/Python reference suite.
399
+ The Windows x64/Node 24 live ACKs are separate, one-shot evidence. Temporary
400
+ SQLite, Unix inbox and real lock fixtures are distinct from
401
+ the dedicated real-TUI evidence in [VALIDATION.md](../VALIDATION.md). A green fixture
402
+ test is not an ACK. Package tests inspect contents, repeat-pack hashes, clean
403
+ install and uninstall. The native dependency normally has an install script;
404
+ the verified prebuilt path uses `--ignore-scripts`. SQLite read-only readers may
405
+ participate in WAL shared-memory bookkeeping; they are not snapshots.
406
+
407
+ See [CONTRIBUTING.md](../CONTRIBUTING.md), [RELEASING.md](../RELEASING.md) and
408
+ [SECURITY.md](../SECURITY.md). Future publication remains manual and requires
409
+ separate approval. Licensed under [MIT](../LICENSE).
410
+
411
+ ## Package release
412
+
413
+ Version 0.2.1 was published and verified on 2026-09-29 KST and 0.2.0 on
414
+ 2026-09-28 KST; see the [0.2.1 public release record](../VALIDATION.md#public-021--2026-09-29-kst).
415
+ Later releases add their own dated records. Check the exact version and current
416
+ tags before installing:
417
+
418
+ ```sh
419
+ npm view session-peer@0.3.0 version dist.integrity
420
+ npm view session-peer dist-tags
421
+ ```
422
+
423
+ The immutable 0.1.0 archive retained pre-publication README wording. This
424
+ archive uses versioned feature descriptions; dated release evidence remains in
425
+ [VALIDATION.md](../VALIDATION.md#public-010--2026-09-27-kst).
426
+
427
+ The release workflow uses Trusted Publisher OIDC staging and a maintainer's
428
+ separate 2FA approval. A staged upload is not a public release. See
429
+ [RELEASING.md](../RELEASING.md) for the process.
430
+
431
+ ## Related project
432
+
433
+ [Python session-peer](https://github.com/abruption/session-peer) is maintained
434
+ and released independently; its own optional features and installation guide
435
+ remain there (for example `pipx install session-peer`). Its command is also
436
+ `session-peer`, so apply the PATH guidance above. This client does not depend on
437
+ that installation or claim complete feature/flag parity.
438
+
439
+ ### Read-only diagnostics in 0.2.0
440
+
441
+ ```sh
442
+ session-peer doctor --json
443
+ session-peer doctor --agent codex --codex-home /absolute/home --json
444
+ session-peer doctor --host user@host --json
445
+ ```
446
+
447
+ This source command is not in published npm 0.1.0. Diagnostic success (`ok:true`,
448
+ exit 0) is separate from agent readiness (`ready` and per-agent/home results).
449
+ It inspects bounded metadata and executable paths without executing Codex,
450
+ connecting to inboxes, acquiring writer locks or submitting messages. Windows
451
+ inbox readiness means a live process advertises a pipe; it does not prove the
452
+ pipe exists or accepts connections. `capabilities` explicitly excludes
453
+ wake/wait/ACK and consumption confirmation. Optional TS skill metadata checks
454
+ never install anything. See [diagnostic boundaries](../PARITY.md#source-read-only-doctor--18--020).
455
+ SSH requires the same TypeScript client version on both ends.
456
+ ### Update checks and notices (0.3.0, #22)
457
+
458
+ ```sh
459
+ session-peer update --check --json
460
+ session-peer update --check --channel preview --output-format text
461
+ ```
462
+
463
+ This command was added in 0.3.0; 0.2.1 and earlier do not have it. `update --check` makes one
464
+ request (3-second timeout, no retries) for the npm dist-tags of `session-peer`
465
+ and reports `current`, `latest`, `channel` (`latest` by default, or `preview`),
466
+ `source: "npm_registry"`, `status` (`update_available`, `up_to_date` or `ahead`),
467
+ `managedBy`, `updateCommand` and `guidance`. A command is given only when the
468
+ installation's owner is positively identified from the running CLI's path:
469
+ an npm global prefix whose own `session-peer` launcher points at this package
470
+ (default, Homebrew, nvm, nvm-windows and fnm prefixes), for example
471
+ `npm install --global --ignore-scripts session-peer@0.3.1`; a pnpm, Yarn or Bun
472
+ global store whose manifest declares `session-peer`; Volta; or the npx cache.
473
+ Project installs (`npm_project`, `pnpm_project`), source checkouts (`source`)
474
+ and anything else (`unknown`) get `updateCommand: null` and a `guidance`
475
+ sentence instead, so no command can modify an unrelated current directory.
476
+ Only npm versions are reported. Python `session-peer` releases are a separate
477
+ stream and are never compared. Registry failures exit 1 with
478
+ `registry_timeout`, `registry_unreachable`, `registry_http_error`,
479
+ `registry_response_invalid` or `dist_tag_missing`; response bodies are never printed.
480
+
481
+ `update` without `--check` does not modify anything: it refuses with
482
+ `self_update_unsupported` (exit 2) and returns `managedBy`, `updateCommand`,
483
+ `guidance` and `checkCommand`. `update` itself is local only: it rejects
484
+ `--host` and is refused over the SSH wire. Remote hosts, Python installations
485
+ and the separately managed `session-peer-ts` skill are never updated; the
486
+ result lists local TS skill metadata (`skills`, same contract as `doctor`) with
487
+ `skillsManagedBy: "separate"`.
488
+
489
+ Cached notices on `list`, `send` and `doctor` are **off by default** because
490
+ this CLI is mainly run by agents and scripts that should not make unrequested
491
+ network calls. Set `SESSION_PEER_UPDATE_NOTICE=1` to opt in. Then a fresh cache
492
+ (24 hours) that shows a newer stable npm version adds a `clientUpdate` object to
493
+ JSON results, or one line on stderr for text output. A missing, invalid or
494
+ expired cache starts one detached refresh and never delays or changes the
495
+ command's result or exit code; a failed refresh waits 1 hour before the next
496
+ attempt. Cache writes are single-flight and fail closed: every write, from a
497
+ background refresh or an explicit check, happens only while holding
498
+ `npm-update.lock`, and only over an older record. Nothing ever takes over or
499
+ removes a lock it did not create. If a refresh crashes, or an I/O error keeps it
500
+ from releasing the lock, the lock stays behind: background refreshes stop, and
501
+ `update --check` reports `cache: "skipped_stale_lock"`. Delete `npm-update.lock` by hand when no
502
+ session-peer process is running.
503
+
504
+ `--no-update-notice` and `SESSION_PEER_NO_UPDATE_NOTICE=1` suppress these
505
+ background notices and refreshes. An explicit `update --check` is an intended
506
+ request: it always contacts the registry and, for the `latest` channel, writes
507
+ the cache when the lock is free (`cache` reports `written`, `skipped_locked`,
508
+ `skipped_stale_lock`, `skipped_newer` or `failed`). Notices belong to the local client. With `--host` the client
509
+ adds `clientUpdate` (or the stderr line) to its own top-level output, including
510
+ results obtained over SSH. When repeated `--host` produces a JSON array, the
511
+ array and its elements keep their exact shape and no `clientUpdate` is added;
512
+ text output still gets the single stderr line. Each invocation refreshes at most
513
+ once, regardless of the number of hosts. A single-host result that failed
514
+ (for example a refused SSH preflight) can still carry the advisory, but parse
515
+ errors and local refusals never do, and the advisory never changes status, exit
516
+ code or retry decisions. A `clientUpdate` sent back by a remote host is
517
+ discarded. The receiver in `--stdio-request` mode never reads,
518
+ refreshes or produces a notice.
519
+
520
+ The cache is `npm-update.json` in `SESSION_PEER_CACHE_DIR` (absolute), otherwise
521
+ `$XDG_CACHE_HOME/session-peer`, `~/Library/Caches/session-peer` (macOS),
522
+ `~/.cache/session-peer` (Linux) or `%LOCALAPPDATA%\session-peer\Cache`
523
+ (Windows). It is written atomically with mode 0600 in a 0700 directory and
524
+ holds only public version data. `SESSION_PEER_UPDATE_REGISTRY` selects a mirror
525
+ (HTTPS, or HTTP on loopback only; no credentials). npm configuration and
526
+ `.npmrc` are not read. See [update boundaries](../PARITY.md#source-update-checks--22).
527
+
528
+ ## Agent skill: explicit installation
529
+
530
+ The separate `session-peer-ts` companion skill is tracked in [companion PR #14](https://github.com/abruption/session-peer-skill/pull/14); it is not a new npm or skill-tag release. It supports the published 0.1.0 baseline, detects the TypeScript implementation marker, and checks help before using development capabilities. The Python `session-peer` skill remains separate.
531
+
532
+ Review the [exact skill source](https://github.com/abruption/session-peer-skill/tree/081cc3c1d16a394bd92824333f4bc61c36951799/session-peer-ts),
533
+ then choose the agent and scope. This example selects **Codex, current project**;
534
+ run from that project directory. For Claude Code use `--agent claude-code`.
535
+ For user scope add `--global` consistently to add/list/remove. Inspect any existing
536
+ `session-peer-ts` copy for local edits before approving its replacement. Codex's
537
+ `.agents/skills` directory is shared with other clients that discover that path.
538
+
539
+ ```sh
540
+ npx -y skills@1.7.0 add https://github.com/abruption/session-peer-skill/tree/081cc3c1d16a394bd92824333f4bc61c36951799/session-peer-ts --skill session-peer-ts --agent codex --copy --yes
541
+ npx -y skills@1.7.0 list --agent codex --json
542
+ npx -y skills@1.7.0 remove session-peer-ts --agent codex --yes
543
+ ```
544
+
545
+ For a pinned update, review another exact commit and repeat `add` with the same
546
+ agent/scope. Restart the agent if its catalog is cached. Runtime and skill
547
+ lifecycles are independent: npm `--ignore-scripts` works, no postinstall invokes
548
+ Skills CLI, and installing this skill does not overwrite the Python skill or
549
+ install a runtime. See [compatibility and validation](../PARITY.md#source-ts-skill-guidance--25--020).
550
+
551
+ ## Optional sp shorthand
552
+
553
+ Optional `sp` shorthand ships with 0.3.0 and later (not 0.2.1 or earlier) and is
554
+ never enabled automatically. See [explicit activation and collisions](shorthand.md).