session-peer 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,303 +14,94 @@
14
14
  <!-- docs-contract: stable-release-source; package=session-peer; bin=session-peer; node=22.13+/24; python-reference=1.0.2 -->
15
15
 
16
16
  **Find and message running Claude Code and Codex sessions, locally or over SSH.**
17
- This TypeScript client runs on Node.js without Python.
17
+ A Node.js client that runs without Python. Package and command: `session-peer`.
18
18
 
19
- This guide describes **0.2.0**. The npm package and CLI command are both **`session-peer`**. This
20
- project does not provide a Relay server or hosted service.
19
+ ## Demo
21
20
 
22
- ## Quick start
23
-
24
- Use Node **22.13+ within 22.x or 24.x**. Check which `session-peer` your PATH
25
- selects if the Python CLI is already installed; both packages use that command.
21
+ After installation, list sessions and replace `CLAUDE_PID` with the exact PID you selected:
26
22
 
27
23
  ```sh
28
- npm install --global --ignore-scripts session-peer@0.2.0
29
- session-peer --version # session-peer 0.2.0 (typescript)
30
24
  session-peer list --agent claude --json
31
- session-peer send --to CLAUDE_PID --message 'Please review the API contract.' --dry-run --json
25
+ session-peer send --to CLAUDE_PID --message 'Please review the API contract and reply.' --dry-run --json
32
26
  ```
33
27
 
34
- 1. List sessions and replace `CLAUDE_PID` with the exact PID you selected.
35
- 2. Run the send command with `--dry-run`; nothing is submitted.
36
- 3. When delivery is intended, run that command once without `--dry-run`.
37
- 4. If acknowledgement matters, ask for an explicit reply in the message and
38
- verify the receiver's TUI response separately. `posted` / `queued` confirms
39
- submission only. See [What success means](#what-success-means).
40
-
41
- ### CLI usability in 0.2.0
42
-
43
- Version 0.2.0 adds `list --help`, `send --help`, `doctor --help` and explicit
44
- `--output-format text`. Output selection remains required: use `--json` or
45
- `--output-format json|text`. Parse errors use JSON; valid text requests render
46
- operation results/errors as text. SSH always exchanges JSON internally.
47
-
48
- `send --to TARGET "message" --json` accepts one positional body. Do not combine
49
- it with `--message`/`-m`; omit the body or use `-` for stdin, and use `--` before
50
- an option-looking positional body. Empty/whitespace bodies are refused before
51
- adding the sender envelope. Claude names use exact Unicode 14.0.0 default full
52
- casefold (no normalization/fuzzy matching); collisions require a PID. This
53
- source behavior is not retroactively available in the published 0.1.0 package.
54
-
55
-
56
- ## What it does
57
-
58
- - Discover local Claude/Codex sessions and known Codex homes (0.2.0; see below).
59
- - Validate a destination with `--dry-run`, then submit one message to its native
60
- inbox or queue. Codex normally requires a unique, stable live writer.
61
- - Use the same commands over SSH to an explicitly installed remote client.
62
- - Accept structured Reply-To URIs as destinations and provide JSON results.
63
- - Refuse ambiguous targets and uncertain ownership; never automatically retry
64
- an uncertain submission.
65
-
66
- Not implemented: Relay transport, MCP, wake/resume,
67
- Antigravity, automatic updates, or human text output. Unsupported commands fail explicitly; this is not a general orchestrator.
28
+ `--dry-run` validates without submitting. To send, run the command once without
29
+ `--dry-run`. Ask for an explicit reply when you need acknowledgement.
30
+ **`posted` / `queued` means submitted, not consumed or ACKed.** `unknown`
31
+ (`submitted:null`), no reply or a target exit must not trigger automatic retries.
32
+ `consumptionConfirmed` is always false; verify a reply in the receiver’s TUI.
68
33
 
69
- 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.
34
+ ## Quick Start
70
35
 
71
- ### Unified listing in 0.2.0
36
+ Requires macOS, Linux or Windows, **Node 22.13+ within 22.x or 24.x**, and a
37
+ matching native prebuilt dependency (x64/arm64). Claude needs a live TUI inbox;
38
+ Codex needs its CLI and a verifiable writer (also `lsof`/`ps` on macOS/Linux).
39
+ SSH requires existing key/host trust and the **same TypeScript client version**
40
+ on both machines. See the guide for platform requirements and inactive queueing.
72
41
 
73
- After building this source, `node dist/cli.js list --json` combines Claude and
74
- Codex; `list --agent codex --json` searches known homes. Published npm **0.1.0**
75
- still requires an explicit agent and a home for Codex listing; the install and
76
- explicit list/send forms also work with that older release.
42
+ ### Install
77
43
 
78
- Sources are default `~/.codex`, `CODEX_HOME`, immediate macOS Orca account homes,
79
- and the JSON array `SESSION_PEER_CODEX_HOMES`. `--codex-home` pins Codex listing
80
- and bypasses unrelated inventory errors; `--agent claude` skips Codex entirely.
81
- Aliases are deduplicated, but the same UUID in different homes stays separate.
82
- Use each row's `codexHome` when sending. Optional absent homes are not failures;
83
- explicitly configured missing/invalid homes produce partial results and exit 1,
84
- retaining readable rows. Listing never selects a writer or submits a message.
85
- See the [source listing contract](PARITY.md#source-unified-listing-contract--16--020)
86
- for ordering, diagnostics, `--all` and SSH behavior.
87
-
88
- Source Codex send now selects the unique stable live writer when `--codex-home`
89
- is omitted. Explicit homes still check all known competitors. Inactive queueing
90
- requires both `--codex-home HOME` and `--allow-inactive-codex-home`, a saved thread,
91
- and verified inactive candidates; it never wakes or resumes a session. Dry-run
92
- submits nothing. JSON adds sanitized `codexHomeResolution` and, when supplied by
93
- native queue output, `queueId`; neither confirms consumption. See the
94
- [selection contract](PARITY.md#source-codex-home-selection--17--020).
95
- Published **0.1.0** still requires an explicit live home and has no inactive opt-in.
96
- On SSH, use the same 0.2.0 build on both ends.
97
-
98
- ## Requirements
99
-
100
- macOS, Linux or native Windows; Node **22.13+ within 22.x or 24.x**. Node 26 is not supported.
101
- The native flock dependency needs a matching prebuilt binary (x64/arm64); this
102
- is not a pure-JavaScript package. Codex sends need `codex`; macOS/Linux also
103
- need `lsof` and `ps`. Windows uses native lock and Restart Manager inspection.
104
- Claude needs a live TUI with an accessible native inbox. SSH requires OpenSSH,
105
- existing key/host trust and the **same client version** on the destination.
106
-
107
- ## Build from source
108
-
109
- To run a reviewed source checkout instead of the published npm package, build
110
- it and optionally install its local tarball:
44
+ The [Python CLI](https://github.com/abruption/session-peer) uses the same command.
45
+ Check `type -a session-peer` on macOS/Linux or `Get-Command session-peer -All`
46
+ in PowerShell before installing. Choose the intended PATH entry; do not use
47
+ `--force` to overwrite another manager’s files.
111
48
 
112
49
  ```sh
113
- git clone https://github.com/abruption/session-peer-ts.git
114
- cd session-peer-ts
115
- npm ci --ignore-scripts
116
- npm run build
117
- node dist/cli.js --version
118
- npm pack --ignore-scripts
119
- # Optional global install: first check which session-peer your PATH selects.
120
- npm install --global --ignore-scripts ./session-peer-0.2.0.tgz
50
+ npm install --global --ignore-scripts session-peer@0.2.1
121
51
  session-peer --version
122
52
  ```
123
53
 
124
- Expected: `session-peer 0.2.0 (typescript)`. Keep the `./...tgz` path to
125
- select the locally built artifact. Check the checkout version before using
126
- these commands for a later release.
127
-
128
- ## Existing installations
54
+ Expected: `session-peer 0.2.1 (typescript)`. For isolated installation, source
55
+ builds, Windows and removal, see the detailed guide below.
129
56
 
130
- Other implementations may also install `session-peer`. Check `type -a session-peer`
131
- and `command -v session-peer` before and after installation. Choose one on PATH,
132
- or call this build explicitly with `node /absolute/path/dist/cli.js`. Do not use
133
- `--force` to overwrite another manager's files. No Python package, skill or service
134
- is installed, removed or reconfigured automatically. To remove this npm install,
135
- run `npm uninstall --global session-peer` and recheck PATH.
57
+ ### Update
136
58
 
137
- On Windows PowerShell, inspect competing commands with
138
- `Get-Command session-peer -All`. To avoid replacing the Python CLI, use an isolated prefix:
139
-
140
- ```powershell
141
- npm ci --ignore-scripts
142
- npm run build
143
- npm pack --ignore-scripts
144
- npm install --prefix "$env:TEMP\session-peer-ts-source" --ignore-scripts .\session-peer-0.2.0.tgz
145
- & "$env:TEMP\session-peer-ts-source\node_modules\.bin\session-peer.cmd" --version
146
- # Later: npm uninstall --prefix "$env:TEMP\session-peer-ts-source" session-peer
147
- ```
148
-
149
- ## Use
150
-
151
- ```sh
152
- session-peer list --agent claude --json
153
- session-peer list --agent codex --codex-home "$HOME/.codex" --json
154
- session-peer send --to CLAUDE_PID --message 'Please review the API contract.' --dry-run --json
155
- session-peer send --to codex:THREAD_UUID --codex-home "$HOME/.codex" --message 'Please review the API contract.' --dry-run --json
156
- ```
157
-
158
- Remove `--dry-run` only when delivery is intended. Omit `--message` or use
159
- `--message -` for UTF-8 stdin. `--all` includes stale/archived records for listing;
160
- it does not authorize sending. Claude accepts a PID, `claude:PID`, or an
161
- unambiguous Unicode 14.0.0 casefolded name. Use a PID for collisions. Codex
162
- send requires a full UUID; home selection follows the guards above; `--codex-bin` selects an executable.
163
- Output requires `--json` or `--output-format json|text`.
164
-
165
- ### Another machine over SSH
59
+ Use npm for an npm-managed installation. Check the available tags and review
60
+ the target version, then install that exact version; this example updates an
61
+ older npm installation to 0.2.1. The CLI has no self-update command.
166
62
 
167
63
  ```sh
168
- session-peer send --host user@machine --remote-bin /absolute/path/session-peer \
169
- --to CLAUDE_PID --message 'Please review the API contract.' --dry-run --json
170
- ```
171
-
172
- The default remote command is `session-peer` on remote PATH. An absolute
173
- `--remote-bin` can select a wrapper using supported Node. The handshake checks
174
- the TypeScript marker and exact version; a different implementation is refused.
175
- SSH uses BatchMode and StrictHostKeyChecking. It never accepts new host keys,
176
- installs a remote runtime or invokes Python as a fallback. Messages travel in a
177
- JSON stdin request, not remote shell arguments. Arbitrary `--ssh-opt`, IPv6
178
- literals and Tailscale canonical-name enrichment are not supported; use an SSH
179
- alias/hostname. Forward access does not establish reverse access.
180
-
181
- For a Windows SSH destination, add `--remote-platform win32` and select a
182
- Windows `--remote-bin 'C:\absolute\path\session-peer.cmd'` if needed. A previously
183
- authenticated OpenSSH control socket can be selected with
184
- `--ssh-control-path /absolute/local/socket`; this does not bypass host-key
185
- verification or grant a new login. For local Windows Codex commands, use a full
186
- `C:\Users\...\.codex` path for `--codex-home`. The Python CLI, if present,
187
- is not removed or replaced by this client.
188
-
189
- ### Replies
190
-
191
- Use a `session-peer://v1/reply?...` URI as `--to`. Unknown/duplicate fields,
192
- unsafe hosts, malformed encoding and conflicting explicit routes are rejected.
193
- `--reply-address URI` adds an explicit return address; no route is inferred or
194
- verified automatically. Use `--no-reply-to` when replying without a new address.
195
- A valid CODEX_THREAD_ID/CODEX_SESSION_ID supplies informational From metadata;
196
- `--no-from` omits it. Unknown senders are not invented. Peer metadata is never
197
- authority, and a Reply-To URI is never executed as shell text.
198
-
199
- ## What success means
200
-
201
- | Result | Meaning |
202
- | --- | --- |
203
- | `validated`, `submitted:false` | Dry-run checks passed; nothing sent. |
204
- | `posted` / `queued` | Native inbox write / queue acceptance, **not consumption or ACK**. |
205
- | `refused`, `submitted:false` | Rejected before submission. |
206
- | `unknown`, `submitted:null` | Submission may have happened; do not automatically resend. |
207
-
208
- After submission, a missing reply or a target exit alone does not establish
209
- consumption or failure; do not automatically resend.
210
-
211
- `consumptionConfirmed` is always false. Verify an actual ACK separately in the
212
- receiver's TUI, not from queueing or transcript polling. Exit codes are 0/1/2
213
- for success/error/usage. Errors use fixed codes instead of raw native stderr or
214
- message content. Codex uses real kernel flock, file identity and same-user owner
215
- start time across samples, then revalidates before queueing. No lock is deleted
216
- and no owning agent process is signaled. Discovery output still contains local
217
- names/paths/IDs: redact it before sharing.
218
-
219
- ## Development and verification
220
-
221
- ```sh
222
- npm ci --ignore-scripts
223
- npm run build
224
- node scripts/check-repository.mjs
225
- SESSION_PEER_PYTHON_ROOT=/path/to/python-reference npm test
226
- npm run test:package
227
- npm audit
228
- ```
229
-
230
- Python is only the development conformance oracle (v1.0.2 commit
231
- `47c23713d0a2a3c11ebde6186afd8c43489b8b65`), never a runtime dependency. Tests also
232
- need a C compiler and lsof for the POSIX contract suite. CI uses Node 22/24 on
233
- macOS, Linux and Windows. macOS/Linux run the full contract suite and package
234
- checks against the pinned reference. Windows x64 runs build/type checks, native
235
- Claude inbox and held/free lock fixtures, writer ownership/revalidation races,
236
- CLI queue outcomes, PowerShell/.cmd SSH framing through an isolated fake endpoint,
237
- package install/native-load/uninstall checks and audit. These are fixture checks;
238
- Windows does not run the POSIX/Python reference suite.
239
- The Windows x64/Node 24 live ACKs are separate, one-shot evidence. Temporary
240
- SQLite, Unix inbox and real lock fixtures are distinct from
241
- the dedicated real-TUI evidence in [VALIDATION.md](VALIDATION.md). A green fixture
242
- test is not an ACK. Package tests inspect contents, repeat-pack hashes, clean
243
- install and uninstall. The native dependency normally has an install script;
244
- the verified prebuilt path uses `--ignore-scripts`. SQLite read-only readers may
245
- participate in WAL shared-memory bookkeeping; they are not snapshots.
246
-
247
- See [CONTRIBUTING.md](CONTRIBUTING.md), [RELEASING.md](RELEASING.md) and
248
- [SECURITY.md](SECURITY.md). Future publication remains manual and requires
249
- separate approval. Licensed under [MIT](LICENSE).
250
-
251
- ## Package release
252
-
253
- This document describes 0.2.0; public availability is determined by the registry.
254
- On 2026-09-28 KST, the verified prior release was 0.1.0 and the preview tag was
255
- 0.1.0-preview.1. Check the exact version and current tags before installing:
256
-
257
- ```sh
258
- npm view session-peer@0.2.0 version dist.integrity
259
64
  npm view session-peer dist-tags
65
+ npm install --global --ignore-scripts session-peer@0.2.1
66
+ session-peer --version
260
67
  ```
261
68
 
262
- The immutable 0.1.0 archive retained pre-publication README wording. This
263
- archive uses versioned feature descriptions; dated release evidence remains in
264
- [VALIDATION.md](VALIDATION.md#public-010--2026-09-27-kst).
265
-
266
- The release workflow uses Trusted Publisher OIDC staging and a maintainer's
267
- separate 2FA approval. A staged upload is not a public release. See
268
- [RELEASING.md](RELEASING.md) for the process.
269
-
270
- ## Related project
271
-
272
- [Python session-peer](https://github.com/abruption/session-peer) is maintained
273
- and released independently; its own optional features and installation guide
274
- remain there (for example `pipx install session-peer`). Its command is also
275
- `session-peer`, so apply the PATH guidance above. This client does not depend on
276
- that installation or claim complete feature/flag parity.
277
-
278
- ### Read-only diagnostics in 0.2.0
279
-
280
- ```sh
281
- session-peer doctor --json
282
- session-peer doctor --agent codex --codex-home /absolute/home --json
283
- session-peer doctor --host user@host --json
284
- ```
285
-
286
- This source command is not in published npm 0.1.0. Diagnostic success (`ok:true`,
287
- exit 0) is separate from agent readiness (`ready` and per-agent/home results).
288
- It inspects bounded metadata and executable paths without executing Codex,
289
- connecting to inboxes, acquiring writer locks or submitting messages. Windows
290
- inbox readiness means a live process advertises a pipe; it does not prove the
291
- pipe exists or accepts connections. `capabilities` explicitly excludes
292
- wake/wait/ACK and consumption confirmation. Optional TS skill metadata checks
293
- never install anything. See [diagnostic boundaries](PARITY.md#source-read-only-doctor--18--020).
294
- SSH requires the same source build on both ends.
295
- ## Agent skill: explicit installation
296
-
297
- 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.
298
-
299
- Review the [exact skill source](https://github.com/abruption/session-peer-skill/tree/081cc3c1d16a394bd92824333f4bc61c36951799/session-peer-ts),
300
- then choose the agent and scope. This example selects **Codex, current project**;
301
- run from that project directory. For Claude Code use `--agent claude-code`.
302
- For user scope add `--global` consistently to add/list/remove. Inspect any existing
303
- `session-peer-ts` copy for local edits before approving its replacement. Codex's
304
- `.agents/skills` directory is shared with other clients that discover that path.
305
-
306
- ```sh
307
- 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
308
- npx -y skills@1.7.0 list --agent codex --json
309
- npx -y skills@1.7.0 remove session-peer-ts --agent codex --yes
310
- ```
311
-
312
- For a pinned update, review another exact commit and repeat `add` with the same
313
- agent/scope. Restart the agent if its catalog is cached. Runtime and skill
314
- lifecycles are independent: npm `--ignore-scripts` works, no postinstall invokes
315
- Skills CLI, and installing this skill does not overwrite the Python skill or
316
- install a runtime. See [compatibility and validation](PARITY.md#source-ts-skill-guidance--25--020).
69
+ The companion skill is installed and updated separately; npm installation
70
+ does not install a skill. Review its pinned-source instructions in the guide.
71
+
72
+ <!-- Preserve links to the former detailed sections; their contents are in the guide. -->
73
+ <a id="cli-usability-in-020"></a>
74
+ <a id="what-it-does"></a>
75
+ <a id="unified-listing-in-020"></a>
76
+ <a id="requirements"></a>
77
+ <a id="build-from-source"></a>
78
+ <a id="existing-installations"></a>
79
+ <a id="use"></a>
80
+ <a id="another-machine-over-ssh"></a>
81
+ <a id="replies"></a>
82
+ <a id="what-success-means"></a>
83
+ <a id="development-and-verification"></a>
84
+ <a id="package-release"></a>
85
+ <a id="related-project"></a>
86
+ <a id="read-only-diagnostics-in-020"></a>
87
+ <a id="agent-skill-explicit-installation"></a>
88
+
89
+ ## Docs
90
+
91
+ - [User guide](docs/guide.md) — CLI options, discovery, Codex homes, SSH, replies, installation variants and skill setup.
92
+ - [API reference (English)](docs/api.md).
93
+ - [Compatibility, migration and planned features](PARITY.md).
94
+ - [Release evidence and platform validation](VALIDATION.md).
95
+ - [Development and contributions](CONTRIBUTING.md).
96
+ - [Release process](RELEASING.md).
97
+
98
+ ## License
99
+
100
+ Licensed under the [MIT License](LICENSE).
101
+
102
+ ## Support and security
103
+
104
+ For usage questions and reproducible bugs, [open an issue](https://github.com/abruption/session-peer-ts/issues).
105
+ For vulnerabilities, use [private reporting](https://github.com/abruption/session-peer-ts/security/advisories/new)
106
+ or [support@abruption.dev](mailto:support@abruption.dev?subject=%5Bsession-peer-ts%5D%20Security).
107
+ Read [SECURITY.md](SECURITY.md) and redact credentials, messages and personal paths.
package/README.zh-CN.md CHANGED
@@ -13,186 +13,92 @@
13
13
 
14
14
  <!-- docs-contract: stable-release-source; package=session-peer; bin=session-peer; node=22.13+/24; python-reference=1.0.2 -->
15
15
 
16
- 向正在运行的 **Claude Code 和 Codex 会话**发送消息,支持本机和跨机器 SSH。这是运行于 Node.js 的 TypeScript 客户端,不需要 Python。
16
+ **发现正在运行的 Claude Code 和 Codex 会话,并在本机或通过 SSH 发送消息。**
17
+ 这是不需要 Python 的 Node.js 客户端。包名与命令名均为 `session-peer`。
17
18
 
18
- **这是 0.2.0 使用指南。**包名为 `session-peer`,CLI 命令为 **`session-peer`**。本项目不提供 Relay 服务器或托管服务。
19
+ ## Demo
19
20
 
20
- ## 功能与边界
21
-
22
- - 发现本机 Claude/Codex 会话与已知 Codex home(面向 0.2.0 的功能,见下文)。
23
- - 先用 `--dry-run` 验证目标,再向原生 inbox / queue 提交一次消息。Codex 要求唯一且稳定的活跃 writer。
24
- - 通过 SSH 调用远端已安装的同版本客户端,支持结构化 Reply-To URI 和 JSON 输出。
25
- - 目标或进程归属不明确时拒绝操作;不会自动重试结果不确定的提交。
26
-
27
- 未实现 Relay 传输、MCP、wake/resume、Antigravity、自动更新及面向人的文本输出。不支持的命令会明确失败;这不是通用编排器。
28
-
29
- 客户端功能计划见 [版本化兼容性表与 npm 迁移指南](PARITY.md);计划不代表当前支持。提供 Relay 服务器或托管服务不属于本客户端范围。
30
-
31
- ### 0.2.0 统一列表
32
-
33
- 构建后,`node dist/cli.js list --json` 合并列出 Claude/Codex,`list --agent codex --json` 查找已知 home。公开 npm **0.1.0** 仍要求显式 agent,以及 Codex 列表所需的 home;0.2.0 也支持显式命令格式。
34
-
35
- 范围仅限默认 `~/.codex`、`CODEX_HOME`、macOS Orca 下的直接账户 home,以及 JSON 数组 `SESSION_PEER_CODEX_HOMES`。`--codex-home` 固定 Codex 列表并绕过无关配置错误;`--agent claude` 完全跳过 Codex 探索。同一 home 的别名合并,不同 home 的相同 UUID 保留。发送时使用每行的 `codexHome`。可选 home 缺失不是错误;显式 home 缺失或无效会保留成功读取的行,并返回退出码 1。列表不会选择 writer 或提交消息。[列表契约](PARITY.md#source-unified-listing-contract--16--020)说明排序、诊断、`--all` 和 SSH 行为。0.2.0的 Codex 发送在省略 `--codex-home` 时选择唯一且稳定的 live writer;显式 home 仍会检查所有已知竞争 home。非活动队列提交需要已保存的线程、所有候选均确认非活动,以及 `--codex-home HOME --allow-inactive-codex-home`,不会执行 wake/resume。Dry-run 不提交。JSON 新增诊断 `codexHomeResolution`,且仅在原生输出提供时包含 `queueId`;两者均不代表消费确认。请参阅[选择契约](PARITY.md#source-codex-home-selection--17--020)。公开 **0.1.0** 仍需要显式 live home,且没有非活动许可选项。SSH 两端请使用同一0.2.0 构建。
36
-
37
- ### 0.2.0 CLI 易用性
38
-
39
- 0.2.0新增 `list --help`、`send --help`、`doctor --help` 和 `--output-format text`。
40
- 仍须明确选择输出格式:`--json` 或 `--output-format json|text`。解析错误
41
- 使用 JSON;有效 text 请求的操作结果和错误使用文本。SSH 内部始终传输 JSON。
42
- 支持 `send --to TARGET "message" --json` 位置正文,不可同时使用
43
- `--message`/`-m`。省略正文或使用 `-` 从 stdin 读取;选项形式的位置正文
44
- 前须加 `--`。空或纯空白正文在添加发件人信息前被拒绝。Claude 名称使用
45
- Unicode 14.0.0 默认 full casefold 精确匹配,不进行规范化或模糊匹配;
46
- 冲突时须指定 PID。这些源码功能不会追溯到已经发布的 0.1.0 包。
47
-
48
-
49
- ## 环境要求
50
-
51
- macOS、Linux 或 Windows native;Node **22.x 中的 22.13 及以上,或 24.x**。不支持 Node 26。原生锁依赖需要匹配的 x64/arm64 预编译二进制,本包不是纯 JavaScript 实现。Codex 发送需要 `codex`,macOS/Linux 还需要 `lsof`、`ps`;Windows 使用原生锁和 Restart Manager 验证所有者。Claude 需要运行中的 TUI 及可访问的原生 inbox。SSH 使用已有密钥和主机信任,远端必须安装**同版本**客户端。
52
-
53
- ## 安装
54
-
55
- 已验证的稳定版可在 Node 22.x 的 22.13 及以上或 24.x 上安装。Python CLI 也使用同一个命令名;若已有安装,请先检查 PATH。
56
-
57
- ```sh
58
- npm install --global --ignore-scripts session-peer@0.2.0
59
- session-peer --version
60
- ```
61
-
62
- 预期输出:`session-peer 0.2.0 (typescript)`。
63
-
64
- 1. 用 `session-peer list --agent claude --json` 查找目标并选择准确 PID。
65
- 2. 用 `session-peer send --to CLAUDE_PID --message 'Please reply after checking.' --dry-run --json` 验证,不提交。
66
- 3. 确定发送时使用选定 PID,移除同一命令中的 `--dry-run`,只执行一次。
67
- 4. 若需要 ACK,在消息中明确请求回复,并单独确认目标 TUI 的响应。`posted` / `queued` 仅表示提交。
68
-
69
- ### 从源码构建
70
-
71
- 若要使用经审查的源码而非公开的 npm 包,请构建源码,并按需安装本地 tarball:
72
-
73
- ```sh
74
- git clone https://github.com/abruption/session-peer-ts.git
75
- cd session-peer-ts
76
- npm ci --ignore-scripts
77
- npm run build
78
- node dist/cli.js --version
79
- npm pack --ignore-scripts
80
- # 可选:全局安装前先检查 PATH 选择的现有命令
81
- npm install --global --ignore-scripts ./session-peer-0.2.0.tgz
82
- session-peer --version
83
- ```
84
-
85
- 保留 `./...tgz` 路径以选择本地产物。使用后续版本的源码时,请先确认检出的版本。
86
-
87
- ### 与已有安装共存
88
-
89
- 安装前后用 `type -a session-peer` 和 `command -v session-peer` 检查实际执行项。其他实现也可能提供同名命令;请选择 PATH 上的一种,或显式运行 `node /absolute/path/dist/cli.js`。不要用 `--force` 覆盖其他管理器的文件。本包不会自动安装、删除或调整 Python 包、技能或服务。卸载使用 `npm uninstall --global session-peer`,随后再次检查 PATH。
90
-
91
- 在 Windows PowerShell 中用 `Get-Command session-peer -All` 检查已有命令。为了不替换 Python CLI,可先执行 `npm ci --ignore-scripts`、`npm run build`、`npm pack --ignore-scripts`,再用 `npm install --prefix "$env:TEMP\session-peer-ts-source" --ignore-scripts .\session-peer-0.2.0.tgz` 安装到隔离目录。以 `& "$env:TEMP\session-peer-ts-source\node_modules\.bin\session-peer.cmd" --version` 验证,并可用 `npm uninstall --prefix "$env:TEMP\session-peer-ts-source" session-peer` 卸载。
92
-
93
- ## 使用
21
+ 安装后列出会话,将 `CLAUDE_PID` 替换为选中的准确 PID:
94
22
 
95
23
  ```sh
96
24
  session-peer list --agent claude --json
97
- session-peer list --agent codex --codex-home "$HOME/.codex" --json
98
- session-peer send --to CLAUDE_PID --message 'Please review the API contract.' --dry-run --json
99
- session-peer send --to codex:THREAD_UUID --codex-home "$HOME/.codex" --message 'Please review the API contract.' --dry-run --json
100
- ```
101
-
102
- 只有确定要投递时才移除 `--dry-run`。省略 `--message` 或使用 `--message -` 会读取 UTF-8 stdin。`--all` 仅让列表包含陈旧 / 已归档记录,不授予发送权限。Claude 支持 PID、`claude:PID` 或唯一的 Unicode 14.0.0 casefold 名称;冲突时使用 PID。Codex 发送需要完整 UUID,home 遵循上述选择规则;`--codex-bin` 可指定可执行文件。输出必须选择 `--json` 或 `--output-format json|text`。
103
-
104
- ### 跨机器 SSH
105
-
106
- ```sh
107
- session-peer send --host user@machine --remote-bin /absolute/path/session-peer \
108
- --to CLAUDE_PID --message 'Please review the API contract.' --dry-run --json
25
+ session-peer send --to CLAUDE_PID --message '请检查 API 契约并回复。' --dry-run --json
109
26
  ```
110
27
 
111
- 默认远程命令是 PATH 中的 `session-peer`。绝对路径 `--remote-bin` 也可选择使用受支持 Node 的包装器。握手检查 TypeScript 标记及精确版本,不同实现会被拒绝。SSH 使用 BatchMode 和 StrictHostKeyChecking,不自动接受新主机密钥、不安装远程运行时,也不会退回 Python。消息通过 JSON stdin 传输,不放进远程 shell 参数。不支持任意 `--ssh-opt`、IPv6 字面量或 Tailscale 规范名补全,请使用 SSH 别名 / 主机名。正向访问不意味着反向访问已配置。
28
+ `--dry-run` 仅验证,不提交。实际发送时移除同一命令中的 `--dry-run`,执行一次。
29
+ 需要确认时,请明确要求回复。**`posted` / `queued` 仅表示提交,不代表消费或 ACK。**
30
+ 遇到 `unknown` (`submitted:null`)、没有回复或目标退出时,不要自动重试。
31
+ `consumptionConfirmed` 始终为 false,请在接收方 TUI 中确认实际回复。
112
32
 
113
- 对于 Windows SSH 目标,请指定 `--remote-platform win32`;若远端 PATH 中没有命令,再使用 `--remote-bin 'C:\absolute\path\session-peer.cmd'`。可用 `--ssh-control-path /local/absolute/socket` 选择已认证的 OpenSSH 控制套接字;这不会跳过主机密钥验证或授予新登录。Windows 本机的 Codex home 使用完整 `C:\Users\...\.codex` 路径。已有 Python CLI 不会被自动删除或替换。
33
+ ## Quick Start
114
34
 
115
- ### 回复
35
+ 需要 macOS/Linux/Windows、**Node 22.x 中的 22.13 及以上或 24.x**,以及匹配的
36
+ 原生预编译依赖(x64/arm64)。Claude 需要运行中的 TUI inbox;Codex 需要 CLI 和
37
+ 可验证的 writer(macOS/Linux 还需要 `lsof`、`ps`)。SSH 需要已有密钥、主机信任
38
+ 以及两端**同版本的 TypeScript 客户端**。平台要求与显式非活动队列提交见详细指南。
116
39
 
117
- 可将 `session-peer://v1/reply?...` URI 用作 `--to`。未知 / 重复字段、不安全主机、错误编码及与显式路由的冲突都会被拒绝。`--reply-address URI` 添加显式回信地址,不自动推断或验证回程。回复时不附加新地址可用 `--no-reply-to`。有效的 CODEX_THREAD_ID / CODEX_SESSION_ID 可提供参考性 From 信息,`--no-from` 可省略;不会虚构未知发送者。peer 元数据不是授权,Reply-To URI 也不会作为 shell 文本执行。
40
+ ### Install
118
41
 
119
- ## 成功含义与安全性
120
-
121
- | 结果 | 含义 |
122
- | --- | --- |
123
- | `validated`, `submitted:false` | dry-run 检查通过,尚未发送。 |
124
- | `posted` / `queued` | inbox 已写入 / queue 已接受,**不是消费确认或 ACK**。 |
125
- | `refused`, `submitted:false` | 提交前被拒绝。 |
126
- | `unknown`, `submitted:null` | 可能已经提交,不要自动重发。 |
127
-
128
- 提交后没有回复或目标退出,都不能单独证明消息已消费或失败。不要自动重发。
129
-
130
- `consumptionConfirmed` 始终为 false。必须在目标 TUI 中另行确认实际 ACK,不可由排队或轮询 transcript 推断。退出码 0/1/2 分别表示成功/错误/用法错误。错误只返回固定代码,不返回原生 stderr 或消息内容。Codex 使用真实内核 flock、文件身份和同用户进程开始时间进行多次核验,排队前再次检查。不删除 lock,也不向拥有它的代理进程发送信号。发现结果仍包含本地名称、路径、ID,分享前请脱敏。
131
-
132
- ## 开发与验证
42
+ [Python CLI](https://github.com/abruption/session-peer)也使用同名命令。
43
+ 安装前,macOS/Linux 使用 `type -a session-peer`,PowerShell 使用
44
+ `Get-Command session-peer -All` 检查 PATH。选择所需实现,不要用 `--force`
45
+ 覆盖其他安装管理器的文件。
133
46
 
134
47
  ```sh
135
- npm ci --ignore-scripts
136
- npm run build
137
- node scripts/check-repository.mjs
138
- SESSION_PEER_PYTHON_ROOT=/path/to/python-reference npm test
139
- npm run test:package
140
- npm audit
48
+ npm install --global --ignore-scripts session-peer@0.2.1
49
+ session-peer --version
141
50
  ```
142
51
 
143
- Python 只用作开发时的兼容性基准(v1.0.2,`47c23713d0a2a3c11ebde6186afd8c43489b8b65`),不是运行时依赖。POSIX 契约测试还需要 C 编译器和 lsof。CI 在三种 OS 上使用 Node 22/24。macOS/Linux 对固定基准执行完整契约与包检查;Windows x64 执行构建、类型检查、原生 Claude inbox、持有/空闲锁、writer 归属与提交前竞争、CLI 队列结果、隔离模拟 SSH 目标的实际 PowerShell/.cmd 帧处理、包安装/原生加载/卸载及 audit。这些属于 fixture 检查;Windows 不运行 POSIX/Python 参考测试套件。Windows x64/Node 24 实机 ACK 是单独的一次性证据。临时 SQLite、Unix inbox、真实锁 fixture 与 [VALIDATION.md](VALIDATION.md) 中专用真实 TUI 的证据分开记录;fixture 通过不是 ACK。包测试检查文件清单、重复打包哈希、全新安装与卸载。原生依赖通常有安装脚本,已验证的预编译路径使用 `--ignore-scripts`。SQLite 只读连接仍可能参与 WAL 共享内存管理,不能视为快照。
144
-
145
- 参见 [CONTRIBUTING.md](CONTRIBUTING.md)、[RELEASING.md](RELEASING.md) 和 [SECURITY.md](SECURITY.md)。后续版本的发布需单独批准,未启用自动 npm 发布。采用 [MIT](LICENSE) 许可证。
52
+ 预期输出:`session-peer 0.2.1 (typescript)`。隔离安装、源码构建、Windows 和
53
+ 卸载步骤见下方详细指南。
146
54
 
147
- ## npm 版本
55
+ ### Update
148
56
 
149
- 本文描述 0.2.0 功能;公开状态请查询注册表。
150
- 2026-09-28 KST 验证的前一稳定版为 0.1.0,preview 标签为 0.1.0-preview.1。
57
+ 使用 npm 更新由 npm 管理的安装。先检查标签并审阅目标版本,再安装指定版本。
58
+ 下面示例将旧 npm 安装更新至 0.2.1。CLI 没有自更新命令。
151
59
 
152
60
  ```sh
153
- npm view session-peer@0.2.0 version dist.integrity
154
61
  npm view session-peer dist-tags
62
+ npm install --global --ignore-scripts session-peer@0.2.1
63
+ session-peer --version
155
64
  ```
156
65
 
157
- 0.1.0 tarball 的历史措辞差异和验证保留在[日期记录](VALIDATION.md#public-010--2026-09-27-kst)。
158
- 发布使用 OIDC staging 和单独的 2FA 批准。Staging 成功不等于公开发布。
159
- 请参阅 [RELEASING.md](RELEASING.md)。
160
-
161
- ## 相关项目
162
-
163
- [Python session-peer](https://github.com/abruption/session-peer) 独立维护和发布,其可选功能与安装指南(例如 `pipx install session-peer`)见该项目。同样使用 `session-peer` 命令,请注意上述 PATH 规则。本客户端不依赖该安装,也不承诺功能和参数完全对等。
164
-
165
- ### 0.2.0 只读诊断
166
-
167
- ```sh
168
- session-peer doctor --json
169
- session-peer doctor --agent codex --codex-home /absolute/home --json
170
- session-peer doctor --host user@host --json
171
- ```
172
-
173
- 公开 npm 0.1.0 不包含此命令。诊断成功(`ok:true`、退出码 0)与代理就绪状态
174
- (`ready`、各代理和 home 的结果)分开报告。只检查限定的元数据和可执行文件路径,
175
- 不会执行 Codex、连接 inbox、获取 writer 锁或提交消息。Windows 就绪状态只表示
176
- 存活进程公布了 pipe,并不证明 pipe 存在或可以连接。`capabilities` 明确将
177
- wake/wait/ACK 和消费确认标为不支持。可选的 TS 技能元数据检查也不会安装任何内容。
178
- 参见[诊断边界](PARITY.md#source-read-only-doctor--18--020)。SSH 两端需要相同的源码构建。
179
- ## 显式安装代理技能
180
-
181
- 独立的 `session-peer-ts` 技能在配套 PR 中管理,不代表新 npm 或技能标签发布。它支持已发布的 0.1.0 基础功能,通过 TypeScript 标识和帮助检查开发功能。Python 的 `session-peer` 技能仍独立保留。
182
-
183
- 先检查[固定提交的技能源码](https://github.com/abruption/session-peer-skill/tree/081cc3c1d16a394bd92824333f4bc61c36951799/session-peer-ts),再选择代理和安装范围。
184
- 以下示例选择 **Codex、当前项目**;请在该项目目录中运行。
185
- Claude Code 使用 `--agent claude-code`。用户范围安装应在 add/list/remove 中一致添加 `--global`。
186
- 批准替换已有的 `session-peer-ts` 副本前,请检查本地修改。
187
- Codex 的 `.agents/skills` 目录与其他扫描该路径的客户端共享。
188
-
189
- ```sh
190
- 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
191
- npx -y skills@1.7.0 list --agent codex --json
192
- npx -y skills@1.7.0 remove session-peer-ts --agent codex --yes
193
- ```
194
-
195
- 更新固定版本时,请检查另一个准确的提交,然后以相同代理和范围重新运行 `add`。
196
- 如果代理缓存了技能目录,请重启代理。运行时和技能独立管理:npm `--ignore-scripts` 可正常使用,
197
- postinstall 不会调用 Skills CLI,安装此技能不会覆盖 Python 技能或安装运行时。
198
- 参见[兼容性和验证](PARITY.md#source-ts-skill-guidance--25--020)。
66
+ 配套技能需单独安装和更新;npm 安装不会安装技能。请参阅指南中固定提交的技能安装步骤。
67
+
68
+ <!-- Preserve links to the former detailed sections; their contents are in the guide. -->
69
+ <a id="功能与边界"></a>
70
+ <a id="020-统一列表"></a>
71
+ <a id="020-cli-易用性"></a>
72
+ <a id="环境要求"></a>
73
+ <a id="安装"></a>
74
+ <a id="从源码构建"></a>
75
+ <a id="与已有安装共存"></a>
76
+ <a id="使用"></a>
77
+ <a id="跨机器-ssh"></a>
78
+ <a id="回复"></a>
79
+ <a id="成功含义与安全性"></a>
80
+ <a id="开发与验证"></a>
81
+ <a id="npm-版本"></a>
82
+ <a id="相关项目"></a>
83
+ <a id="020-只读诊断"></a>
84
+ <a id="显式安装代理技能"></a>
85
+
86
+ ## Docs
87
+
88
+ - [用户指南](docs/guide.zh-CN.md) — CLI 选项、发现、Codex home、SSH、回复、安装方式和技能设置.
89
+ - [API 参考(英文)](docs/api.md).
90
+ - [兼容性、迁移和功能计划](PARITY.md).
91
+ - [发布证据与平台验证](VALIDATION.md).
92
+ - [开发与贡献](CONTRIBUTING.md).
93
+ - [发布流程](RELEASING.md).
94
+
95
+ ## License
96
+
97
+ 采用 [MIT 许可证](LICENSE)。
98
+
99
+ ## Support and security
100
+
101
+ 使用问题和可复现的缺陷请提交到[议题](https://github.com/abruption/session-peer-ts/issues)。
102
+ 漏洞请使用[私密报告](https://github.com/abruption/session-peer-ts/security/advisories/new)或
103
+ [support@abruption.dev](mailto:support@abruption.dev?subject=%5Bsession-peer-ts%5D%20Security)。
104
+ 请阅读 [SECURITY.md](SECURITY.md),并移除凭据、消息内容和个人路径。