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/CONTRIBUTING.md +5 -0
- package/PARITY.md +300 -16
- package/README.ja.md +75 -162
- package/README.ko.md +75 -249
- package/README.md +74 -275
- package/README.zh-CN.md +71 -158
- package/RELEASING.md +101 -5
- package/SECURITY.md +3 -2
- package/VALIDATION.md +236 -5
- package/dist/cli.d.ts +10 -1
- package/dist/cli.js +288 -48
- package/dist/diagnostics.d.ts +2 -0
- package/dist/diagnostics.js +10 -4
- package/dist/discovery.d.ts +1 -0
- package/dist/discovery.js +17 -4
- package/dist/help.js +32 -5
- package/dist/output.d.ts +1 -1
- package/dist/output.js +18 -2
- package/dist/process.d.ts +1 -0
- package/dist/process.js +90 -7
- package/dist/protocol.d.ts +6 -3
- package/dist/protocol.js +27 -7
- package/dist/replies.d.ts +30 -0
- package/dist/replies.js +283 -0
- package/dist/send.js +9 -2
- package/dist/ssh.d.ts +24 -0
- package/dist/ssh.js +114 -0
- package/dist/updates.d.ts +37 -0
- package/dist/updates.js +444 -0
- package/dist/windows.d.ts +2 -0
- package/dist/windows.js +31 -3
- package/docs/api.md +30 -0
- package/docs/design/remote-deployment.md +867 -0
- package/docs/guide.ja.md +310 -0
- package/docs/guide.ko.md +489 -0
- package/docs/guide.md +554 -0
- package/docs/guide.zh-CN.md +294 -0
- package/docs/shorthand.md +198 -0
- package/package.json +5 -3
- package/shorthand/sp.ps1 +11 -0
- package/shorthand/sp.sh +11 -0
package/CONTRIBUTING.md
CHANGED
|
@@ -61,6 +61,8 @@ SSH input/host boundaries and no retry after unknown outcomes. Never infer ACK
|
|
|
61
61
|
from queueing. Fixtures are not real-agent evidence. Live tests require explicit
|
|
62
62
|
authorization, dedicated targets and independent observation; CI never uses live
|
|
63
63
|
accounts, sessions or credentials. Security reports use SECURITY.md.
|
|
64
|
+
CodeQL default setup scans JavaScript/TypeScript and GitHub Actions; triage each
|
|
65
|
+
code-scanning alert with a fix PR or a documented dismissal reason.
|
|
64
66
|
|
|
65
67
|
Synchronize README.md, README.ko.md, README.ja.md and README.zh-CN.md. Update PARITY.md with feature/command/env/output changes, source baseline,
|
|
66
68
|
transport limits, evidence date and the relevant issue acceptance tests. Keep runtime
|
|
@@ -71,3 +73,6 @@ workflow has separate confirmation and environment-approval gates; see
|
|
|
71
73
|
RELEASING.md before dispatching it. Never add publish credentials to PR tests.
|
|
72
74
|
Dependabot automatic update PRs are not enabled; dependency changes are manual
|
|
73
75
|
reviewed PRs with lockfile, audit, native-load and platform tests.
|
|
76
|
+
Dependabot vulnerability alerts are enabled, and `.github/workflows/audit.yml`
|
|
77
|
+
runs `npm audit` and `npm audit signatures` weekly (and on manual dispatch) so
|
|
78
|
+
new advisories surface between commits. Triage an alert with a manual PR.
|
package/PARITY.md
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
# Python compatibility and npm migration
|
|
2
2
|
|
|
3
|
-
Updated 2026-
|
|
3
|
+
Updated 2026-10-03 KST. Python reference: **1.0.2**,
|
|
4
4
|
[`47c2371`](https://github.com/abruption/session-peer/tree/47c23713d0a2a3c11ebde6186afd8c43489b8b65/session_peer_core).
|
|
5
|
-
This matrix describes **TS 0.
|
|
5
|
+
This matrix describes **TS 0.3.0**: the 0.2.0 unified listing, safe home selection,
|
|
6
6
|
read-only doctor, text/help/positional input, Unicode 14.0.0 name matching and
|
|
7
|
-
separately managed TS skill guidance (#16/#17/#18/#19/#25)
|
|
7
|
+
separately managed TS skill guidance (#16/#17/#18/#19/#25), the
|
|
8
|
+
[0.2.1 reliability and hardening](#021-reliability-and-hardening) changes, and the
|
|
9
|
+
[0.3.0 remote usability and maintenance](#030-remote-usability-and-maintenance)
|
|
10
|
+
changes with their known limitations. Historical **0.1.0**
|
|
8
11
|
differences are called out explicitly. Public availability and tags must be
|
|
9
12
|
checked in the registry; this document does not assert a publication outcome.
|
|
10
|
-
SSH endpoints require the same version;
|
|
11
|
-
the same commit. `referenceVersion: "1.0.2"` identifies the comparison baseline,
|
|
13
|
+
SSH endpoints require the same version; builds from source between releases also
|
|
14
|
+
require the same commit. `referenceVersion: "1.0.2"` identifies the comparison baseline,
|
|
12
15
|
not complete parity. See [VALIDATION.md](VALIDATION.md) for dated evidence.
|
|
13
16
|
|
|
14
17
|
## Feature and command matrix
|
|
@@ -26,9 +29,9 @@ not a missing implementation. Issue links describe work, not available features.
|
|
|
26
29
|
| Implicit home / inactive queue | Select unique live home; explicit inactive opt-in under separate guards | Source: unique live selection; explicit saved inactive home with opt-in and verified inactive candidates. Public 0.1.0 has neither | Implemented in source for #17, 0.2.0; no wake/resume |
|
|
27
30
|
| `doctor` | Readiness diagnostics; return-route check is opt-in | Source: read-only local/SSH metadata, per-agent/home results, capabilities and bounded TS skill compatibility. Published 0.1.0 has no doctor | Implemented in source for [#18](https://github.com/abruption/session-peer-ts/issues/18), 0.2.0; no return-route probing |
|
|
28
31
|
| CLI input, help and names | Human text or JSON; positional or named/stdin message; Unicode casefold matching | 0.2.0: explicit JSON/text format, positional/named/stdin body, command help, exact Unicode 14.0.0 casefold with PID for ambiguity | Implemented; [#19](https://github.com/abruption/session-peer-ts/issues/19), 0.2.0. Published 0.1.0 help still says “preview”; source help now describes unified list |
|
|
29
|
-
| From / Reply-To | Caller detection, automatic return-route metadata, structured URI resolution | From uses Codex environment UUID only; explicit `--reply-address`; local/SSH Reply-To URI parsing with conflict checks |
|
|
30
|
-
| SSH | Python source streamed to POSIX remote Python; multiple hosts/options/host metadata | Same-version installed TS CLI required;
|
|
31
|
-
| Updates | Cached advisory client/skill notices;
|
|
32
|
+
| From / Reply-To | Caller detection, automatic return-route metadata, structured URI resolution | 0.2.1 and earlier: From uses Codex environment UUID only; explicit `--reply-address`; local/SSH Reply-To URI parsing with conflict checks. 0.3.0: Claude/Codex sender detection, generated routes, `--reply-to`, same-user self normalization, Tailscale routing hint and `doctor --check-return-route` ([details](#sender-context-and-return-routes-unreleased-source)) | Implemented for [#21](https://github.com/abruption/session-peer-ts/issues/21); no Antigravity identity, no executable `Reply:` line, 0.3.0 |
|
|
33
|
+
| SSH | Python source streamed to POSIX remote Python; multiple hosts/options/host metadata | Same-version installed TS CLI required; strict preflight; JSON stdin; explicit Windows PowerShell path. 0.3.0: ordered repeated `--host`, allowlisted `--ssh-opt`, typed single-hop `--ssh-jump` (POSIX clients), IPv6 literals and `sshUser`/`sshUserSource` ([details](#multi-host-ssh-and-connection-options-unreleased-source)) | Partial; [#20](https://github.com/abruption/session-peer-ts/issues/20) (no arbitrary options or multi-hop; `--ssh-jump` refused on Windows clients; Tailscale routing hint in #21), [#23](https://github.com/abruption/session-peer-ts/issues/23) deployment/version design ([proposed ADR](docs/design/remote-deployment.md)), 0.3.0 |
|
|
34
|
+
| Updates | Cached advisory client/skill notices (on by default); GitHub release check; standalone self-update and remote push; package-manager guidance | 0.3.0: `update --check` reads npm dist-tags (`latest`/`preview`) with installation-manager guidance; no self-update or remote update; cached client notices are opt-in (`SESSION_PEER_UPDATE_NOTICE=1`), honor `--no-update-notice`/`SESSION_PEER_NO_UPDATE_NOTICE`; no skill notices. 0.2.1 only accepts `--no-update-notice` as a no-op | Partial for [#22](https://github.com/abruption/session-peer-ts/issues/22), 0.3.0; [update boundaries](#source-update-checks--22) |
|
|
32
35
|
| Reusable execution API | Agent/transport capability adapters | Package root exposes pure protocol helpers only; no general typed execution API | Planned [#24](https://github.com/abruption/session-peer-ts/issues/24), Future — Agent integrations |
|
|
33
36
|
| Skill guidance/setup | Companion `session-peer` skill targets Python | Separate `session-peer-ts` companion PR and exact-commit setup; baseline/version/help gates | Source [#25](https://github.com/abruption/session-peer-ts/issues/25), 0.2.0; no tag/publish |
|
|
34
37
|
| MCP | Optional extra, restricted destinations; separate wake permission | Unsupported | Planned [#26](https://github.com/abruption/session-peer-ts/issues/26), Future — Agent integrations |
|
|
@@ -54,8 +57,12 @@ Source anchors at the baselines:
|
|
|
54
57
|
| `CLAUDE_CONFIG_DIR`, `ANTHROPIC_CONFIG_DIR` | Claude config precedence: first nonempty value in that order, otherwise `~/.claude`. No Codex home is required for Claude listing. |
|
|
55
58
|
| `CODEX_HOME`, default `~/.codex`, macOS Orca account homes | Source: bounded automatic Codex listing and writer safety inventory. Codex send selects a unique stable live home, or validates the explicit home against all competitors. Published 0.1.0 requires it for Codex list too. No recursive disk scan. |
|
|
56
59
|
| `SESSION_PEER_CODEX_HOMES` | Source: JSON array of absolute or `~/` paths adds required listing homes and writer candidates. Invalid list configuration is rejected as a whole with other sources preserved; send keeps fail-closed inventory. Published 0.1.0 uses it only for writer checks. |
|
|
57
|
-
| `CODEX_THREAD_ID`, `CODEX_SESSION_ID` | Valid UUID enables default From metadata; `--no-from` disables it. Claude
|
|
58
|
-
|
|
|
60
|
+
| `CODEX_THREAD_ID`, `CODEX_SESSION_ID` | Valid UUID enables default From metadata; `--no-from` disables it. 0.3.0: two different values, or Claude evidence at the same time, give no identity. |
|
|
61
|
+
| `CLAUDE_CODE_MESSAGING_SOCKET` | 0.3.0: must match exactly one live registered Claude session to give `From: claude:NAME` (PID when the name is not a unique printable target). Antigravity caller detection is not implemented. |
|
|
62
|
+
| `SESSION_PEER_REPLY_HOST`, `CC_PEER_REPLY_HOST` | 0.3.0: return host for generated Reply-To and `doctor --check-return-route`, after `--reply-to` and before the tailnet address. Invalid values are refused (`invalid_reply_host`). |
|
|
63
|
+
| `SESSION_PEER_TAILSCALE` | TS only, 0.3.0: `off` skips `tailscale status --json`, so every destination is ordinary SSH. |
|
|
64
|
+
| `SESSION_PEER_UPDATE_NOTICE`, `SESSION_PEER_NO_UPDATE_NOTICE`, `SESSION_PEER_CACHE_DIR`, `SESSION_PEER_UPDATE_REGISTRY` | 0.3.0 (#22): opt-in cached notices, opt-out (wins), absolute cache directory override, and npm registry mirror for update checks (HTTPS, or loopback HTTP; no credentials). Python's `XDG_CACHE_HOME` `update.json` is not read; TS uses its own `npm-update.json`. |
|
|
65
|
+
| Reply/update/Relay settings from Python | No blanket compatibility. Only the flags and environment reads above are implemented. Do not infer a route or permission from an environment variable or From header. |
|
|
59
66
|
| Runtime and native dependency | TS needs Node 22.13+ within 22.x or Node 24.x, plus a matching native lock binary. Python is not a TS runtime fallback. |
|
|
60
67
|
| CLI ownership | Both distributions install `session-peer`; npm does not remove Python/uv/pipx/venv installations. Select one path deliberately and update it through its owning manager. |
|
|
61
68
|
| Skills | Install separately and explicitly; no package `postinstall` downloads a skill or invokes another package manager. |
|
|
@@ -126,11 +133,11 @@ TS normal envelopes have `schemaVersion`, `host`, `command`, `ok`, `version`,
|
|
|
126
133
|
| `queueId` | Present if native queue stdout supplies an ID | Source #17: optional bounded native confirmation ID on successful queue only; absent in public 0.1.0 |
|
|
127
134
|
| `codexHomeResolution` | Resolution diagnostics on Codex success and some refusals | Source #17: sanitized resolution on success and failures after resolution begins; private owner fingerprints remain internal. Absent in public 0.1.0 |
|
|
128
135
|
| `remoteVersion` | Optional remote `list` metadata after version discovery (also update diagnostics); not universal on send | Absent; exact TS version banner must pass preflight; mismatch is a refusal |
|
|
129
|
-
| `replyRoute`, `addressResolution` | Optional metadata when route advertised / Reply-To destination resolved |
|
|
136
|
+
| `replyRoute`, `addressResolution` | Optional metadata when route advertised / Reply-To destination resolved | 0.2.1 and earlier: absent. 0.3.0: same names and values as Python for generated routes and URI destinations; an explicit `--reply-address` has no `replyRoute` |
|
|
130
137
|
| `wake` | Optional, opt-in; failed activation may still have `submitted:true` and `ok:false` | Absent; unsupported option |
|
|
131
|
-
| SSH metadata | Requested/resolved host and SSH metadata; multi-host list may be an array | Verified remote response adds `host`/`sshHost`; caught local SSH failure reports the local host;
|
|
138
|
+
| SSH metadata | Requested/resolved host and SSH metadata; multi-host list may be an array | Verified remote response adds `host`/`sshHost`; caught local SSH failure for one host reports the local host. 0.3.0 adds `sshUser`/`sshUserSource` and returns an ordered array for repeated `--host` (see #20 section); with a resolved Tailscale peer, `host` is its MagicDNS name and `sshHost` the requested alias (#21) |
|
|
132
139
|
| `error`, `retryAllowed` | Error/detail fields vary by path; submission may already have happened | Fixed error codes, caught failure has `retryAllowed:false`; native stderr/message body are not copied into errors |
|
|
133
|
-
| `clientUpdate`, `skillUpdates` | Optional advisory notice metadata |
|
|
140
|
+
| `clientUpdate`, `skillUpdates` | Optional advisory notice metadata | 0.3.0 (#22): client-local. Added by the invoking client to a flat (single-result) `list`/`send`/`doctor` JSON result, including a single `--host` result that failed or is unknown, when notices are opted in and a fresh npm cache shows a newer stable version. Never inside a repeated `--host` array, never on top-level parse/local caught failures, never produced by a `--stdio-request` receiver; a remote-supplied `clientUpdate` is dropped. It never changes status, exit code, consumption or retry decisions. `skillUpdates` absent |
|
|
134
141
|
|
|
135
142
|
An **absent** submission field is not `false`; `null` is not `false` either.
|
|
136
143
|
Check `ok`, command, status, exit code and presence separately. TS unknown means
|
|
@@ -149,7 +156,7 @@ Output sources: TS CLI/send above; Python
|
|
|
149
156
|
|
|
150
157
|
| Boundary | Python 1.0.2 | TS (source differences noted) |
|
|
151
158
|
| --- | --- | --- |
|
|
152
|
-
| Remote prerequisite | POSIX-compatible remote shell and usable Python; source delivered over stdin. Native Windows destination is not this SSH path | Installed same-version TS CLI + supported Node/native dependency. POSIX shell by default; explicit `--remote-platform win32` uses PowerShell and a `.cmd` launcher |
|
|
159
|
+
| Remote prerequisite | POSIX-compatible remote shell and usable Python; source delivered over stdin. Native Windows destination is not this SSH path | Installed same-version TS CLI + supported Node/native dependency. POSIX shell by default; explicit `--remote-platform win32` uses PowerShell and a `.cmd` launcher. Provisioning and a separate compatibility contract are proposed, not implemented, in the [remote deployment ADR](docs/design/remote-deployment.md) (#23) |
|
|
153
160
|
| Message on SSH | Base64 body in quoted remote argv; source on stdin | Message in UTF-8 stdin JSON; PowerShell's encoded command contains launcher/flag, not the message |
|
|
154
161
|
| Remote body/command | 90,000-character remote message cap; fully quoted UTF-8 SSH command capped at 131,071 bytes after base64/argument expansion | Stdin reader capped at 4,100,000 bytes, including JSON framing/escaping. No unlimited stream; OS argv limits still apply when invoking native queue |
|
|
155
162
|
| General message | At most 1,000,000 characters; Codex at most 32 KiB UTF-8 | At most 1,000,000 Unicode code points; Codex at most 32,768 UTF-8 bytes; rejects blank/NUL |
|
|
@@ -194,7 +201,7 @@ Windows support, WSL/POSIX SSH and TS native Windows SSH are separate paths.
|
|
|
194
201
|
`--remote-platform win32` and the `.cmd` path. Retain existing SSH host trust
|
|
195
202
|
and authentication; a control socket is not new authorization. Account for
|
|
196
203
|
the size limits above and lack of multi-host aggregation.
|
|
197
|
-
6. **Keep unsupported workflows on an explicit Python path.**
|
|
204
|
+
6. **Keep unsupported workflows on an explicit Python path.** Remote updates,
|
|
198
205
|
MCP, wake, Antigravity and paired devices need their existing implementation
|
|
199
206
|
until their issues are delivered. Doctor is available in 0.2.0; 0.1.0 lacked this command. Updating npm does not update Python, skills,
|
|
200
207
|
external Relay infrastructure or a remote host automatically. To return to
|
|
@@ -216,7 +223,8 @@ The implemented rows map to these repeatable checks:
|
|
|
216
223
|
- [transport.test.ts](https://github.com/abruption/session-peer-ts/blob/main/test/transport.test.ts): real POSIX inbox, guarded queue, wrong/competing writer, unknown native outcome, inert Reply-To, host boundaries, SSH preflight/framing/loss.
|
|
217
224
|
- [windows.test.ts](https://github.com/abruption/session-peer-ts/blob/main/test/windows.test.ts) and [windows-contract.test.ts](https://github.com/abruption/session-peer-ts/blob/main/test/windows-contract.test.ts): the bounded Windows native contracts described above.
|
|
218
225
|
- [input-boundaries.test.ts](https://github.com/abruption/session-peer-ts/blob/main/test/input-boundaries.test.ts): exact 1,000,000-code-point / 32,768-byte message bounds, envelope overhead, 4,100,000-byte escaped JSON wire bound and invalid UTF-8 refusal. Python SSH limits are source-inspected here; these TS tests do not exercise the Python transport.
|
|
219
|
-
- [types.test.ts](https://github.com/abruption/session-peer-ts/blob/main/test/types.test.ts), [package-smoke.ts](https://github.com/abruption/session-peer-ts/blob/main/test/package-smoke.ts), [release.test.ts](https://github.com/abruption/session-peer-ts/blob/main/test/release.test.ts): pure typed helpers, package/native loading, artifact and publication gates.
|
|
226
|
+
- [types.test.ts](https://github.com/abruption/session-peer-ts/blob/main/test/types.test.ts), [package-smoke.ts](https://github.com/abruption/session-peer-ts/blob/main/test/package-smoke.ts), [release.test.ts](https://github.com/abruption/session-peer-ts/blob/main/test/release.test.ts): pure typed helpers, package/native loading, artifact and publication gates. package-smoke also checks installed-path update guidance without network or file changes.
|
|
227
|
+
- [updates.test.ts](https://github.com/abruption/session-peer-ts/blob/main/test/updates.test.ts): #22 update checks and notices against a local fixture registry (see below).
|
|
220
228
|
|
|
221
229
|
Windows expansion belongs to [#34](https://github.com/abruption/session-peer-ts/issues/34);
|
|
222
230
|
this matrix belongs to [#33](https://github.com/abruption/session-peer-ts/issues/33).
|
|
@@ -394,3 +402,279 @@ and explicit project/user scope chosen before running the documented command.
|
|
|
394
402
|
exercises real Skills CLI project/global install, replacement-update, list and
|
|
395
403
|
removal for Codex/Claude Code while preserving a Python skill fixture. Those
|
|
396
404
|
are installation/contract fixtures, not live-agent delivery or ACK evidence.
|
|
405
|
+
|
|
406
|
+
## 0.2.1 reliability and hardening
|
|
407
|
+
|
|
408
|
+
0.2.1 (#49–#57, #59, #64, #65) tightens existing 0.2.0 behavior and adds no new
|
|
409
|
+
command, transport or JSON field. Callers may notice the stricter refusals below.
|
|
410
|
+
|
|
411
|
+
| Area | Source behavior |
|
|
412
|
+
| --- | --- |
|
|
413
|
+
| Codex body argv (#49) | Native queue receives `--message=<text>` as one argument, so bodies such as `- item`, `--help` or `-x` are queued as text. The SSH request forwards the body the same way. |
|
|
414
|
+
| Codex SQLite location (#50) | An inherited `CODEX_SQLITE_HOME` is removed from the native queue environment. A home whose `config.toml` sets `sqlite_home` is refused as `unsupported_codex_sqlite_home` (unreadable config: `codex_config_unreadable`) in dry-run and send, and `doctor` reports it as unsupported, because validation reads `<home>/state_5.sqlite`. A live writer started with its own `CODEX_SQLITE_HOME` cannot be observed. |
|
|
415
|
+
| Option values (#51) | A separate value that is exactly an option name (for example `--message --dry-run`) is `invalid_option` (exit 2), as in Python argparse. Use `--message=<text>`, stdin or `-- <text>` for such text. |
|
|
416
|
+
| SSH exit code (#52) | A verified remote response keeps its 0/1/2 exit code locally. |
|
|
417
|
+
| Reply-To `codexHome` (#53) | Must be a POSIX or Windows absolute path, matching Python; relative and `~` paths are `invalid_reply_uri`. |
|
|
418
|
+
| Text output (#54) | Also escapes U+061C, U+200B–U+200F, U+202A–U+202E, U+2060–U+2069 and U+FEFF. JSON is unchanged. |
|
|
419
|
+
| SSH preflight (#55) | Exit 0 with the exact version line passes even when login scripts write to stderr; stderr classification applies only to failed preflights. |
|
|
420
|
+
| Windows `--remote-bin` (#56) | Every PowerShell single-quote variant (`'`, U+2018–U+201B) is doubled inside the encoded command. |
|
|
421
|
+
| Windows batch shims (#57) | A `.cmd`/`.bat` executable found first on `PATH` (or given explicitly) is reported as `executable_unsupported` by `send` and `doctor`, because Node cannot spawn them without a shell and a shell would interpret the message. Use the native `codex.exe`. |
|
|
422
|
+
| Envelope trimming (#59, #64) | Leading/trailing `\n` is trimmed by index scanning instead of `/^\n+\|\n+$/`, which was quadratic on long interior newline runs (CodeQL `js/polynomial-redos`). Trimming semantics are unchanged. |
|
|
423
|
+
| Windows owner inspection (#65) | The compiling `Add-Type` owner inspection waits up to 20000 ms; the compile-free creation-time probe keeps 8000 ms. Timeouts still refuse. |
|
|
424
|
+
|
|
425
|
+
## 0.3.0 remote usability and maintenance
|
|
426
|
+
|
|
427
|
+
0.3.0 (#20, #21, #22, #74, #78/#79, #87; design #23) adds remote and
|
|
428
|
+
maintenance features to 0.2.1. Existing commands, exit codes and the delivery
|
|
429
|
+
boundaries (`posted`/`queued` are submission, never consumption or ACK) are
|
|
430
|
+
unchanged. SSH still requires the same version on both ends, so 0.2.1 and 0.3.0
|
|
431
|
+
endpoints refuse each other at preflight; upgrade them together.
|
|
432
|
+
|
|
433
|
+
| Area | 0.3.0 behavior |
|
|
434
|
+
| --- | --- |
|
|
435
|
+
| Multi-host SSH (#20) | Ordered repeated `--host` for `list`/`send`/`doctor` (array output for two or more), all hosts validated before any `ssh` starts, `duplicate_ssh_host`, IPv6 literals and `sshUser`/`sshUserSource`. See [details](#multi-host-ssh-and-connection-options--20--030) |
|
|
436
|
+
| Connection options (#20) | `--ssh-opt` is an allowlist (`-p`, `-l`, `-i`, `-o Port/User/IdentityFile/IdentitiesOnly`, `-4`, `-6`); everything else is refused. Typed single-hop `--ssh-jump USER@HOST[:PORT]` with a fixed hardened `ProxyCommand`, **POSIX clients only** |
|
|
437
|
+
| Sender context and return routes (#21) | Verified Claude/Codex sender identity (`From:`), generated structured Reply-To URIs, `--reply-to`, a Tailscale routing hint and opt-in `doctor --check-return-route`. No executable `Reply:` line. See [details](#sender-context-and-return-routes--21--030) |
|
|
438
|
+
| Update checks (#22) | `update --check` reads npm dist-tags once (3 s, no retries) and reports manager-specific guidance; nothing is installed. Cached client notices are **opt-in** (`SESSION_PEER_UPDATE_NOTICE=1`) and opt-out wins. See [details](#update-checks--22--030) |
|
|
439
|
+
| `sp` shorthand (#74) | Opt-in, shell-scoped Bash/zsh and PowerShell activation files; npm registers only `session-peer`. See [details](#optional-shorthand--74--030) |
|
|
440
|
+
| Bounded timeouts (#87) | On POSIX, external commands run in their own process group, and a timeout, output overflow or termination signal kills the whole group (including a jump `ProxyCommand`). On Windows only the direct child is killed; the call still returns at its deadline |
|
|
441
|
+
| Windows process probe (#78, #79) | The compile-free creation-time probe waits up to 15000 ms (was 8000 ms) after a CI cold-start timeout; the compiling owner inspection keeps 20000 ms. Timeouts still exclude the process |
|
|
442
|
+
| Remote deployment (#23) | Design only: a [proposed ADR](docs/design/remote-deployment.md) for Python-free deployment and version compatibility. No deployment code ships; the exact-version preflight is unchanged |
|
|
443
|
+
|
|
444
|
+
### Known limitations in 0.3.0
|
|
445
|
+
|
|
446
|
+
- **#20 — Partial.** `--ssh-jump` is refused on Windows clients
|
|
447
|
+
(`ssh_jump_unsupported_platform`) until Win32-OpenSSH `ProxyCommand` behavior
|
|
448
|
+
is verified. No multi-hop and no arbitrary ssh options.
|
|
449
|
+
- **#23 — Partial.** The remote deployment ADR is a proposal. Its POSIX cell
|
|
450
|
+
was exercised by hand ([record](VALIDATION.md#remote-deployment-workflow-posix-cell-23-f5--2026-10-02-kst));
|
|
451
|
+
the Windows cell and the newer receipt and recovery rules are unvalidated.
|
|
452
|
+
- **Update notices (#22).** The Windows refresh, refresh-failure and
|
|
453
|
+
forged-`clientUpdate` (injection) cells are unverified; Windows CI covers only
|
|
454
|
+
the array/flat shape and one text stderr line. Those cases have POSIX fixture
|
|
455
|
+
evidence only.
|
|
456
|
+
- Fixture and CI evidence is not a live-agent ACK.
|
|
457
|
+
|
|
458
|
+
<a id="sender-context-and-return-routes-unreleased-source"></a>
|
|
459
|
+
|
|
460
|
+
## Sender context and return routes — #21 / 0.3.0
|
|
461
|
+
|
|
462
|
+
[#21](https://github.com/abruption/session-peer-ts/issues/21) behavior added in
|
|
463
|
+
0.3.0; 0.2.1 and earlier do not have it. Compared with Python
|
|
464
|
+
1.0.2 `replies.py`/`diagnostics.py`:
|
|
465
|
+
|
|
466
|
+
| Area | Python 1.0.2 | TS source |
|
|
467
|
+
| --- | --- | --- |
|
|
468
|
+
| Claude sender | PID parsed from `CLAUDE_CODE_MESSAGING_SOCKET`, matched in the registry; name or PID | Same evidence. The match must be exactly one live row (exact socket match when the path has no PID). A name that is not unique by casefold, is all digits, contains `:` or a control character falls back to the PID |
|
|
469
|
+
| Codex sender | `CODEX_THREAD_ID`, else `CODEX_SESSION_ID`; `codexHome` from `CODEX_HOME` | Same, plus `codexHome` only for an absolute `CODEX_HOME`. Two different IDs give no identity |
|
|
470
|
+
| Nested agents | Claude wins over Codex variables | Both kinds of evidence give **no** identity (ambiguous), per #21 |
|
|
471
|
+
| From line | `From: agent:id @ user@host` with a local-hostname fallback | `From: agent:id` only. The return host appears only in the structured Reply-To |
|
|
472
|
+
| Reply-To | URI plus executable `Reply: python3 … send …` line | URI only; no executable line. Generated only with a sender; local sends without a configured host get `transport=local` |
|
|
473
|
+
| Host precedence | `--reply-to`, `SESSION_PEER_REPLY_HOST`, `CC_PEER_REPLY_HOST`, detected tailnet address; user added when missing | Same order. Detection reads only `tailscale status --json` (MagicDNS name, else 100.64.0.0/10 IPv4); no `tailscale ip`/`ip addr`/`ifconfig` scraping. `--reply-to` conflicts with `--reply-address`/`--no-reply-to` |
|
|
474
|
+
| Self normalization | User (if any) equals this user and host is local | The user is **required** and must equal this user, and the host must be an exact local form (`localhost`, canonical `127.x.y.z`, `::1`, `::ffff:127.x.y.z`, the host name or Tailscale self); non-canonical numerics and IPv4-compatible IPv6 (RFC 4291 section 2.5.5.1) never normalize to local. This strict predicate is separate from the fail-closed return-host refusal. Applies only when the route came from the URI alone (no `--host`/SSH options, including `--ssh-jump`) |
|
|
475
|
+
| Tailscale routing | Online peer: alias kept, `HostName`/`HostKeyAlias` added; offline/ambiguous refused; unknown unchanged; MagicDNS off means no lookup | Alias kept and `HostName` added only for `Online === true` with MagicDNS on. `HostKeyAlias` is added only when the same `ssh -G` used for `sshUser` read the config and found none; a configured alias is kept and an unread config is never overridden. `Online === false` is refused even with MagicDNS off; any other `Online` value is ordinary SSH. Status is queried at most once per command with a 3 s bound; `host` is the MagicDNS name and `sshHost` the requested alias. `SESSION_PEER_TAILSCALE=off` disables it. The macOS app CLI is used only when no `tailscale` is on `PATH` |
|
|
476
|
+
| Return-route probe | `doctor --check-return-route [--reply-to]`; fixed `true` command; `detail` may contain stderr | Same options plus `-T` and `ControlPath=none`. Fixed `exit 0` (a no-op in POSIX shells, cmd.exe and PowerShell; only POSIX return hosts have fixture coverage). The 8 s deadline covers the final `ssh` only; the Tailscale (3 s) and `ssh -G` (5 s) lookups are bounded separately. Same `returnRoute` statuses and reasons plus `return_host_is_receiver`; never includes stderr. With `--host`, a return host that might name a machine (fail closed, no DNS: localhost names, canonical 127.0.0.0/8 and 0.0.0.0/8, `::1`, `::`, `::ffff:`-mapped forms, IPv4-compatible IPv6 and every non-canonical numeric such as `127.1`, `0177.0.0.1`, `2130706433` or `4294967296`, whose meaning differs between resolvers) is `invalid_return_route` before SSH, on the receiver a known self name (exact OS host name or Tailscale self name/address, for any user; other DNS/LAN aliases are not detected) or an unprovable numeric form fails as `return_host_is_receiver` instead of normalizing to local, and the receiver gets only the return host through the JSON request. A remote send refuses a loopback or non-canonical numeric reply host (`invalid_reply_host`). Like every `ssh` this CLI starts, the probe and its `ssh -G` lookup use the probing machine's trusted ssh_config; see the #20 trust boundary |
|
|
477
|
+
|
|
478
|
+
Evidence: POSIX fake `ssh`/`tailscale` fixtures in `test/replies.test.ts`
|
|
479
|
+
(sender detection and ambiguity, name fallback, precedence and conflicts,
|
|
480
|
+
same-user/wrong-user self routes, offline/unknown/ambiguous peers, generated
|
|
481
|
+
and malformed URIs, probe argv and auth/host-key/timeout/other outcomes,
|
|
482
|
+
remote probe forwarding). A test preload sets `SESSION_PEER_TAILSCALE=off` and
|
|
483
|
+
clears `CLAUDE_CODE_MESSAGING_SOCKET`, `CODEX_THREAD_ID`, `CODEX_SESSION_ID` and the reply-host variables for every test; fixtures that need an identity set it explicitly. No real tailnet, SSH destination
|
|
484
|
+
or agent session was used.
|
|
485
|
+
|
|
486
|
+
<a id="multi-host-ssh-and-connection-options-unreleased-source"></a>
|
|
487
|
+
|
|
488
|
+
## Multi-host SSH and connection options — #20 / 0.3.0
|
|
489
|
+
|
|
490
|
+
[#20](https://github.com/abruption/session-peer-ts/issues/20) behavior added in
|
|
491
|
+
0.3.0; 0.2.1 and earlier do not have it. Compared with Python
|
|
492
|
+
1.0.2 `--host`/`--ssh-opt`:
|
|
493
|
+
|
|
494
|
+
| Area | Python 1.0.2 | TS source |
|
|
495
|
+
| --- | --- | --- |
|
|
496
|
+
| Repeated `--host` | Ordered per-host loop; one host stays flat, several return a JSON array; any failure exits 1 | Same shape and order for `list`, `send` and `doctor`. Every element keeps `schemaVersion`, `ok`, `host` (as requested) and `command`. Any failed host makes the overall exit 1; a single host keeps its own 0/1/2 exit code |
|
|
497
|
+
| Validation before dispatch | Host/option checks run inside the loop, so an earlier host may already be contacted. argparse syntax errors print usage to stderr (exit 2) without JSON; other pre-dispatch errors are attributed to each `--host` | Every host, `--ssh-opt`, message and remote option is validated before any `ssh` process starts (including `ssh -G`). TS always answers in JSON. Every `--host VALUE`/`--host=VALUE` before `--` is collected before any other check, so with two or more of them every pre-dispatch refusal, including syntax errors such as an unknown option or a missing value, is an array with one `submitted:false` element per host; with fewer it is one flat object |
|
|
498
|
+
| Duplicate destinations | Not checked | `duplicate_ssh_host` for a repeated destination string (user, case-insensitive host name, canonical IPv6). Syntactic only: aliases or addresses of the same physical host are not detected |
|
|
499
|
+
| Attempts | One attempt per host | One preflight and at most one request per destination. Refused/unknown hosts are reported in place; later hosts still get their single attempt. No failover, resend or retry after `unknown` |
|
|
500
|
+
| Timeouts | Python subprocess timeouts on the direct child | POSIX: each `ssh` (and every other external command) starts detached, in a new session and process group without a controlling terminal, registered as soon as its PID exists; cleanup covers that group only (a descendant that calls `setsid()` leaves it and is out of scope; no PID scanning); a timeout, an output overflow or SIGINT/SIGTERM/SIGHUP to the CLI kills the whole group, including a jump `ProxyCommand` that holds the pipes, and the call completes after the exit plus a 100 ms grace instead of waiting for the pipes. Windows: only the direct child is killed, descendants may linger, and the call still returns at the deadline. Preflight timeout stays a refusal and request timeout stays `unknown` without retry ([#87](https://github.com/abruption/session-peer-ts/issues/87)) |
|
|
501
|
+
| `--ssh-opt` | Arbitrary ssh arguments minus a substring blocklist (`proxycommand`, `localcommand`, `permitlocalcommand`) | Allowlist only: `-p PORT`, `-l USER`, `-i IDENTITY_FILE`, `-o Port=`/`User=`/`IdentityFile=`/`IdentitiesOnly=yes\|no`, `-4`, `-6`, as separate or attached tokens. Anything else is `unsupported_ssh_option`; a bad, duplicate or dash-leading value is `invalid_ssh_option`. Identity paths refuse `%` and `$` (OpenSSH token/environment expansion). Options are re-emitted canonically after the fixed `BatchMode=yes`, `StrictHostKeyChecking=yes` and `ConnectTimeout=10`, which OpenSSH therefore keeps |
|
|
502
|
+
| Jump hosts | `ProxyJump`/`-J` allowed through `--ssh-opt`; the hop gets no command-line `BatchMode`/`StrictHostKeyChecking` | **Done for POSIX clients:** typed `--ssh-jump USER@HOST[:PORT]` (one hop, explicit user, shell- and %-inert characters only). The CLI builds a fixed `ProxyCommand`: the shell-quoted, %-escaped `ssh` path with `BatchMode=yes`, `StrictHostKeyChecking=yes`, `UpdateHostKeys=no`, `ConnectTimeout=10`, `ConnectionAttempts=1`, `ProxyCommand=none`, `ProxyJump=none`, `ControlPath=none`, `ForwardAgent=no`, `ClearAllForwardings=yes`, `PermitLocalCommand=no`, `-W '[%h]:%p'`. It is placed with the fixed options, together with outer `ControlMaster=no`, `ControlPath=none` and `ProxyUseFdpass=no`, so it overrides a `ProxyJump`/`ProxyCommand` and any control master in ssh_config for the target (checked with `ssh -G -F <fixture>`). `-J`/`ProxyJump`/`ProxyCommand` through `--ssh-opt` stay refused. Refused with `--ssh-control-path` and on **Windows clients** (`ssh_jump_unsupported_platform`) until Win32-OpenSSH `ProxyCommand` behavior is verified. No multi-hop, and no Tailscale lookup for the hop (v1). Result field `sshJump`. `--ssh-opt` values (including `-4`/`-6`) apply to the target only, not the hop. Shell scope: the generated `ProxyCommand` was verified with sh, bash and zsh; other login shells are unverified. Unverified boundaries: Win32-OpenSSH clients. Python parity: Python accepts arbitrary `-J` hops; TS offers a stricter, typed single hop |
|
|
503
|
+
| User | `sshUser`/`sshUserSource`: `explicit` from `USER@HOST`, else `ssh -G` (`ssh_config_or_local_default`), else `unknown` | Same fields and sources; `-l USER` also counts as `explicit`. `-l` together with `USER@HOST` is `conflicting_ssh_user`, because `-l` silently wins. Without an explicit user, one local `ssh -G` runs per host (5 s limit). It does not connect, but per ssh(1)/ssh_config(5) it evaluates the user's ssh configuration, including `Match exec` commands, as Python's lookup does. A failed or unexpected lookup gives `unknown` for that host only |
|
|
504
|
+
| Trust boundary | Blocklisted command-line options; user ssh config trusted | The allowlist governs only options this CLI puts on the `ssh` command line. The user's and system ssh_config are trusted user configuration: `ProxyCommand`, `ProxyJump`, `Match exec`, `Include` and similar settings there apply to every `ssh` this CLI starts, as for the user's own `ssh` |
|
|
505
|
+
| IPv6 | Passed through to `ssh` | `2001:db8::1`, `[2001:db8::1]` and `user@[2001:db8::1]` are accepted; brackets are removed for `ssh`, `sshHost` shows the destination used. Zone IDs (`%`) are refused |
|
|
506
|
+
| Control socket / Windows | n/a | `--ssh-control-path` requires exactly one `--host`. `--remote-platform win32` and `--remote-bin` apply to every host with the same encoded PowerShell command |
|
|
507
|
+
| Text output | Per-host human blocks | Per-host blocks prefixed by `Host: <host>` |
|
|
508
|
+
|
|
509
|
+
Evidence: POSIX fake-`ssh` fixtures in `test/ssh-hosts.test.ts` (ordering,
|
|
510
|
+
argv, zero invocations on invalid input including syntax errors, flat versus
|
|
511
|
+
array refusals, partial results, per-host `ssh -G` failure, IPv6, POSIX/Windows
|
|
512
|
+
remote commands, body absent from argv) and a two-host case in the Windows
|
|
513
|
+
native fixture. `--ssh-jump` fixtures use a fake `ssh` (installed under a path
|
|
514
|
+
with spaces, a quote and `%`) that expands `%h`/`%p`/`%%` and runs the
|
|
515
|
+
`ProxyCommand` through `/bin/sh -c exec`, recording the exact hop argv;
|
|
516
|
+
injection attempts start no `ssh`. Before implementation, local
|
|
517
|
+
`ssh -G -F <fixture config>` (OpenSSH 10.3p1, no connection) confirmed that a
|
|
518
|
+
command-line `ProxyCommand` overrides the target's configured
|
|
519
|
+
`ProxyJump`/`ProxyCommand` without error, and that the hop's command-line
|
|
520
|
+
`ProxyCommand=none`/`ProxyJump=none` override the jump host's configured
|
|
521
|
+
proxies; ssh_config(5) does not list `ProxyCommand` among the keywords with
|
|
522
|
+
`${ENV}` expansion. The `unknown` case is a classification fixture: the fake exits
|
|
523
|
+
255 on the request without running the remote CLI, so it shows that `unknown`
|
|
524
|
+
is never retried, not that a delivered message's response was lost. No real
|
|
525
|
+
SSH destination was contacted.
|
|
526
|
+
|
|
527
|
+
<a id="source-update-checks--22"></a>
|
|
528
|
+
|
|
529
|
+
## Update checks — #22 / 0.3.0
|
|
530
|
+
|
|
531
|
+
Evidence date: 2026-10-02. Added in 0.3.0; 0.2.1 and earlier have no `update`
|
|
532
|
+
command. `session-peer update --check --json [--channel latest|preview]` makes one
|
|
533
|
+
GET to `<registry>/-/package/session-peer/dist-tags` (default
|
|
534
|
+
`https://registry.npmjs.org/`, 3-second timeout covering the body, 64 KiB body
|
|
535
|
+
limit, redirects refused, no retries). `latest` must be a stable npm semver;
|
|
536
|
+
`preview` may be a prerelease. Versions follow SemVer 2.0 precedence without a
|
|
537
|
+
`v` prefix or build metadata. Python 1.0.2's GitHub tags are a different stream
|
|
538
|
+
and are never compared; `referenceVersion` is unrelated to this check.
|
|
539
|
+
|
|
540
|
+
| Field | Meaning |
|
|
541
|
+
| --- | --- |
|
|
542
|
+
| `current`, `latest`, `channel`, `distTag` | Running TS version, the dist-tag's version, and the tag name |
|
|
543
|
+
| `source` | `npm_registry` |
|
|
544
|
+
| `status`, `outdated` | `update_available` (`outdated:true`), `up_to_date` or `ahead` |
|
|
545
|
+
| `updated` | Always `false`; nothing is installed |
|
|
546
|
+
| `managedBy`, `updateCommand`, `guidance` | Owner from the resolved CLI path, positively identified only: `npm` (global prefix whose `bin/session-peer` symlink or `session-peer.cmd` launcher targets this package: default, Homebrew, nvm, nvm-windows, fnm), `pnpm`/`yarn`/`bun` (global store whose `package.json` declares `session-peer`), `volta`, `npx`. Command only for those owners and only when outdated. `npm_project`/`pnpm_project` (project `package.json` declares the dependency), `source` (checkout) and `unknown` (anything else, such as an unconfirmed nvm-windows prefix) always get `null` plus a `guidance` sentence |
|
|
547
|
+
| `cache` | `written`, `skipped_locked`, `skipped_stale_lock`, `skipped_newer`, `failed`, or `not_applicable` (preview channel) |
|
|
548
|
+
| `skills`, `skillsManagedBy` | Same local TS skill metadata check as `doctor`; `separate` |
|
|
549
|
+
|
|
550
|
+
Failures use the standard caught-failure envelope with `registry_timeout`,
|
|
551
|
+
`registry_unreachable`, `registry_http_error`, `registry_response_invalid`,
|
|
552
|
+
`dist_tag_missing` (exit 1), or `invalid_update_registry`,
|
|
553
|
+
`unsupported_update_channel` (exit 2). Response bodies are never emitted.
|
|
554
|
+
`update` without `--check` is `self_update_unsupported` (exit 2) with `updated:false`,
|
|
555
|
+
`managedBy`, `updateCommand` (dist-tag spec, same owner rules), `guidance` and `checkCommand`; it makes no
|
|
556
|
+
request. `--host`, other list/send options and `--stdio-request` (error
|
|
557
|
+
`remote_update_unsupported`) are refused, so a remote destination never performs
|
|
558
|
+
update checks. `doctor` capabilities add `updateCheck:true`, `selfUpdate:false`.
|
|
559
|
+
|
|
560
|
+
Notices are deliberately **opt-in** (Python's are on by default): agents and
|
|
561
|
+
scripts call this CLI frequently, and an unrequested registry call or extra
|
|
562
|
+
stderr line would change its no-network default. With
|
|
563
|
+
`SESSION_PEER_UPDATE_NOTICE=1` (`1/true/yes/on`), completed local
|
|
564
|
+
`list`/`send`/`doctor` results read only the local cache. A fresh (24 h) cache
|
|
565
|
+
whose stable `latest` is newer adds `clientUpdate` (`schemaVersion`, `status`,
|
|
566
|
+
`current`, `latest`, `channel`, `checkedAt`, `source: "npm_registry_cache"`,
|
|
567
|
+
`managedBy`, `command`, `guidance`) to JSON, or one stderr line for text; stdout text is
|
|
568
|
+
unchanged. A missing, invalid, future-dated or expired cache spawns one detached
|
|
569
|
+
refresh and returns immediately. A failed refresh stores `latest:null`, which
|
|
570
|
+
suppresses attempts for 1 hour. Opt-out (`--no-update-notice`,
|
|
571
|
+
`SESSION_PEER_NO_UPDATE_NOTICE`) suppresses these background notices and
|
|
572
|
+
refreshes and wins over opt-in. An explicit `update --check` is an intended
|
|
573
|
+
request: it always contacts the registry and, on `latest`, writes the cache under
|
|
574
|
+
the same lock rules (reported as `cache`).
|
|
575
|
+
Cache and network failures never change results or exit codes.
|
|
576
|
+
|
|
577
|
+
Scope: notices belong to the invoking client. With `--host`, the client adds
|
|
578
|
+
`clientUpdate` (or its stderr line) to its own top-level output, including the
|
|
579
|
+
verified result obtained over SSH; the `--stdio-request` receiver never reads,
|
|
580
|
+
refreshes or produces a notice. The notice is computed once per invocation.
|
|
581
|
+
Multi-host and failures (integration candidate with #20/#21):
|
|
582
|
+
|
|
583
|
+
- Repeated `--host` JSON array: request order and every element's exact shape are
|
|
584
|
+
kept; no `clientUpdate` in elements and no wrapper object.
|
|
585
|
+
- Flat result: one destination (local or a single `--host`) gets the additive
|
|
586
|
+
field, also when that per-host result failed (preflight refusal, remote
|
|
587
|
+
`ok:false`) or is unknown. Top-level parse errors and local caught failures
|
|
588
|
+
(the top-level catch path in `cli.ts`) never get it.
|
|
589
|
+
- Text output: one stderr line per invocation, for flat or array output and
|
|
590
|
+
with failed, mixed or successful hosts; stdout is unchanged.
|
|
591
|
+
- The advisory never changes status, exit code, `submitted`,
|
|
592
|
+
`consumptionConfirmed` or `retryAllowed`.
|
|
593
|
+
- `clientUpdate` is reserved for the client: `remote()` deletes any
|
|
594
|
+
`clientUpdate` in a verified receiver response before it is shown.
|
|
595
|
+
- Refresh count: the notice is computed at a single call site after dispatch,
|
|
596
|
+
once per invocation. The fixture evidence is indirect: registry request counts
|
|
597
|
+
with the single-flight cache lock (one request for three hosts, none from
|
|
598
|
+
receivers). It does not instrument the call itself.
|
|
599
|
+
|
|
600
|
+
Evidence: POSIX `test/integration-multihost-updates.test.ts` (fake ssh).
|
|
601
|
+
Windows: `test/windows-contract.test.ts` checks one opted-in repeated `--host`
|
|
602
|
+
array (no element field), one text stderr line and a flat single-host field
|
|
603
|
+
through the encoded PowerShell fixture; it is not evidence for the refresh count
|
|
604
|
+
or the failure/forged-field cases, which are POSIX-only.
|
|
605
|
+
|
|
606
|
+
Single flight, fail closed (changed after review). Earlier revisions of this PR
|
|
607
|
+
reclaimed stale locks and used a takeover mutex; review found legal filesystem
|
|
608
|
+
interleavings that let a newer cache record be overwritten or another
|
|
609
|
+
generation's lock or mutex be deleted. That code is removed:
|
|
610
|
+
|
|
611
|
+
- One lock, `npm-update.lock`, created with `O_EXCL` and holding a random token.
|
|
612
|
+
The notice path creates it before spawning the detached refresh, which inherits
|
|
613
|
+
the token. `update --check` creates it around its own cache write.
|
|
614
|
+
- Every cache write (background or explicit) happens only while holding the
|
|
615
|
+
lock, and only when the existing record is older than the writer's start
|
|
616
|
+
(`checkedAt`); an explicit check that finds the lock held still reports its
|
|
617
|
+
result with `cache: "skipped_locked"`. A refresh without the current token does
|
|
618
|
+
nothing.
|
|
619
|
+
- No code path takes over, renames or deletes a lock, temporary file or other
|
|
620
|
+
resource it did not create, and no mutex exists. The shared cache record
|
|
621
|
+
`npm-update.json` is the one file that is replaced by design, by atomic
|
|
622
|
+
rename and only under the lock rules above. An existing lock of any age makes the background refresh skip.
|
|
623
|
+
The holder deletes its own lock after re-reading its token.
|
|
624
|
+
|
|
625
|
+
Guaranteed, with no automatic recovery: at most one lock holder at a time (`O_EXCL`), so
|
|
626
|
+
at most one background refresh and at most one cache writer at once; no writer
|
|
627
|
+
replaces a record newer than its own start; no invocation deletes or moves a
|
|
628
|
+
foreign lock, temporary file or other resource. Cost: a lock can be left behind
|
|
629
|
+
when its holder crashes (the detached child runs for at most about 3 seconds)
|
|
630
|
+
or when releasing it fails, for example because its token cannot be read back.
|
|
631
|
+
A failed token write right after creation is undone only for that same inode.
|
|
632
|
+
A left-behind lock blocks background refreshes until a user deletes
|
|
633
|
+
`npm-update.lock` by hand while no session-peer process runs. `update --check` reports `cache: "skipped_stale_lock"` once the lock is older
|
|
634
|
+
than 60 s; it never removes it. Manual deletion during a running refresh is the
|
|
635
|
+
only way to break the guarantee (the holder could then remove a lock created
|
|
636
|
+
after the deletion).
|
|
637
|
+
|
|
638
|
+
Cache: `npm-update.json` (0600, atomic temp-file rename) in a 0700 directory
|
|
639
|
+
owned by the user: `SESSION_PEER_CACHE_DIR` (absolute), else
|
|
640
|
+
`$XDG_CACHE_HOME/session-peer` on macOS/Linux, `~/Library/Caches/session-peer`,
|
|
641
|
+
`~/.cache/session-peer`, or `%LOCALAPPDATA%\session-peer\Cache`. It holds only
|
|
642
|
+
package name, channel, version and timestamp. Windows relies on the per-user
|
|
643
|
+
profile ACL instead of POSIX modes. No checks or notices modify npm-owned files,
|
|
644
|
+
Python installations, remote hosts or skills.
|
|
645
|
+
|
|
646
|
+
Acceptance evidence: `test/updates.test.ts` (POSIX and Windows CI) covers SemVer
|
|
647
|
+
ordering, stable/prerelease tags, invalid/oversized/HTTP/redirect/timeout/offline
|
|
648
|
+
registry responses without body leakage, manager guidance per install layout,
|
|
649
|
+
including nvm, nvm-windows, fnm, Volta and ambiguous prefixes (`unknown`, no command),
|
|
650
|
+
cache paths and modes, opt-in default off, flag/env opt-out, JSON additivity,
|
|
651
|
+
text stderr, offline/invalid/expired/future caches, concurrent single-flight
|
|
652
|
+
refresh, fail-closed live and stale locks (no refresh until manual removal),
|
|
653
|
+
review regressions: an explicit check while a background holder runs reports
|
|
654
|
+
`skipped_locked` and writes nothing, then the holder publishes; a holder whose
|
|
655
|
+
start predates a newer record publishes nothing; a stale lock is never taken
|
|
656
|
+
over, so its holder's release cannot remove a successor; a stale lock and a
|
|
657
|
+
leftover mutex keep the same inode and content after notices and an explicit
|
|
658
|
+
check; a non-holder token neither releases nor writes; multi-process
|
|
659
|
+
acquisition yields one owner (none for a stale lock), failure backoff, Python cache isolation, TS skill metadata,
|
|
660
|
+
wire isolation, and a POSIX fake-SSH `list --host` where only the client adds
|
|
661
|
+
the notice. `test/package-smoke.ts` checks the installed
|
|
662
|
+
package's guidance and unchanged files. All use a local fixture registry; no
|
|
663
|
+
test contacts npm.
|
|
664
|
+
|
|
665
|
+
<a id="source-optional-shorthand--74--planned-030"></a>
|
|
666
|
+
|
|
667
|
+
## Optional shorthand — #74 / 0.3.0
|
|
668
|
+
|
|
669
|
+
0.3.0 ships opt-in Bash/zsh and PowerShell aliases for `sp`. 0.2.1 and earlier
|
|
670
|
+
have no activation assets. npm still registers only canonical `session-peer`.
|
|
671
|
+
Sourcing in the caller's shell/scope refuses existing sp executables, aliases and
|
|
672
|
+
functions; no install hook, profile/PATH edits or runtime dispatcher is added.
|
|
673
|
+
The alias resolves the same canonical command with the same arguments, stdin,
|
|
674
|
+
output, exit codes and delivery boundaries. Automation/SSH/help/version retain
|
|
675
|
+
canonical identity. See [activation and lifecycle](docs/shorthand.md).
|
|
676
|
+
|
|
677
|
+
Python/TS co-installation is excluded; replacing an implementation respects its
|
|
678
|
+
original manager. This TS change does not implement additional Python features.
|
|
679
|
+
Package fixtures cover name equivalence, collisions, an in-place version update
|
|
680
|
+
and removal on every supported shell. They do not establish live delivery or ACK.
|