session-peer 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/PARITY.md +20 -5
  2. package/README.ja.md +8 -8
  3. package/README.ko.md +8 -8
  4. package/README.md +8 -8
  5. package/README.zh-CN.md +8 -8
  6. package/RELEASING.md +73 -0
  7. package/VALIDATION.md +102 -1
  8. package/dist/cli.js +54 -4
  9. package/dist/diagnostics.js +17 -98
  10. package/dist/discovery.d.ts +32 -0
  11. package/dist/discovery.js +405 -68
  12. package/dist/handoff-operations.js +23 -3
  13. package/dist/help.js +18 -2
  14. package/dist/macos-acl.d.ts +10 -0
  15. package/dist/macos-acl.js +75 -0
  16. package/dist/output.js +6 -1
  17. package/dist/protocol.d.ts +2 -2
  18. package/dist/protocol.js +1 -1
  19. package/dist/receipt-collector.d.ts +12 -0
  20. package/dist/receipt-collector.js +283 -0
  21. package/dist/receipt-command.d.ts +10 -0
  22. package/dist/receipt-command.js +246 -0
  23. package/dist/receipt-producer.d.ts +7 -0
  24. package/dist/receipt-producer.js +107 -0
  25. package/dist/receipt-protocol.d.ts +219 -0
  26. package/dist/receipt-protocol.js +374 -0
  27. package/dist/receipt-send.d.ts +26 -0
  28. package/dist/receipt-send.js +375 -0
  29. package/dist/receipt-state.d.ts +89 -0
  30. package/dist/receipt-state.js +503 -0
  31. package/dist/receipt-store.d.ts +32 -0
  32. package/dist/receipt-store.js +286 -0
  33. package/dist/replies.js +3 -1
  34. package/dist/send.d.ts +5 -2
  35. package/dist/send.js +34 -49
  36. package/dist/skill-metadata.js +4 -3
  37. package/docs/api.md +32 -7
  38. package/docs/design/typescript-skill-compatibility.md +29 -0
  39. package/docs/guide.ja.md +41 -15
  40. package/docs/guide.ko.md +43 -17
  41. package/docs/guide.md +42 -16
  42. package/docs/guide.zh-CN.md +41 -15
  43. package/docs/shorthand.md +1 -1
  44. package/package.json +3 -3
package/PARITY.md CHANGED
@@ -90,7 +90,7 @@ the installation pin; runtime publication is not companion-skill publication.
90
90
  <a id="current-scoped-feature-matrix"></a>
91
91
  ## Current scoped feature matrix
92
92
 
93
- Current source/package version: **0.5.2**.
93
+ Current source/package version: **0.6.0**.
94
94
 
95
95
  Reviewed **2026-10-29 KST** against TS **0.5.1** source
96
96
  [`90481b148584926ea328ed956327f3050d9be9cb`](https://github.com/abruption/session-peer-ts/tree/90481b148584926ea328ed956327f3050d9be9cb)
@@ -111,7 +111,7 @@ An issue or Python feature alone does not authorize implementation.
111
111
  | Surface | Reviewed TS behavior and Python comparison | Status / boundary |
112
112
  | --- | --- | --- |
113
113
  | Ordinary discovery, input and submission | Unified Claude/Codex list, bounded Codex-home inventory, text/JSON and positional/stdin input, Unicode name matching, Claude inbox and guarded Codex queue submission | Shipped within existing platform/native contracts; submission never proves consumption |
114
- | macOS Claude Orca profiles | TS reads one environment-selected/default registry; Python additionally inventories bounded known macOS Orca profiles when no override is set ([TS source](https://github.com/abruption/session-peer-ts/blob/90481b148584926ea328ed956327f3050d9be9cb/src/discovery.ts#L78-L117), [Python source](https://github.com/abruption/session-peer/blob/f5e7c49554ff02771990a151e00b52f2abf3df0a/session_peer_core/claude.py#L44-L84)) | Partial; [#165](https://github.com/abruption/session-peer-ts/issues/165) is a separate discovery/provenance extension |
114
+ | macOS Claude Orca profiles | Source adds bounded known Orca profile inventory when no explicit Claude directory override is set; original registry provenance follows selection and handoff revalidation. The dated 0.5.1 baseline above used one selected/default registry; Python comparison remains pinned to [f5e7c49](https://github.com/abruption/session-peer/blob/f5e7c49554ff02771990a151e00b52f2abf3df0a/session_peer_core/claude.py#L44-L84). | [#165](https://github.com/abruption/session-peer-ts/issues/165) source extension; incomplete/conflicting inventory refuses send; no additional native/ACK qualification |
115
115
  | Codex storage classification | TS rejects selected-home root `sqlite_home` and malformed TOML, and strips `CODEX_SQLITE_HOME` from native child environments; Python additionally checks system/requirements, managed-preference and project/cwd layers ([TS source](https://github.com/abruption/session-peer-ts/blob/90481b148584926ea328ed956327f3050d9be9cb/src/discovery.ts#L13-L24), [Python source](https://github.com/abruption/session-peer/blob/f5e7c49554ff02771990a151e00b52f2abf3df0a/session_peer_core/codex.py#L272-L494)) | Partial in published baseline; post-baseline #166 source adds bounded local-layer classification and refusal of unclassifiable storage ([scope](docs/api.md#codex-storage-configuration)). Selected-home or local-layer validation is not whole effective-storage attestation |
116
116
  | Doctor and return routes | Read-only local/SSH diagnostics, generated From/Reply-To metadata, explicit reply URI and opt-in return-route probe | Shipped bounded behavior; no executable `Reply:` instruction or Antigravity sender identity |
117
117
  | Ordered SSH and typed jump | Repeated hosts, allowlisted options, IPv6 and POSIX-client single-hop jump; Windows-client jump refuses before effect | Partial; remaining Windows-client qualification in [#20](https://github.com/abruption/session-peer-ts/issues/20); no arbitrary options or multi-hop |
@@ -313,6 +313,12 @@ Historical 0.2.0 source anchors and the then-pinned Python oracle:
313
313
  | 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. |
314
314
  | Skills | Install separately and explicitly; no package `postinstall` downloads a skill or invokes another package manager. |
315
315
 
316
+ ## Claude profile discovery — #165 source scope
317
+
318
+ With neither nonempty Claude directory override set, inventory includes the default `~/.claude/sessions` and the immediate `home/sessions` directories of known macOS Orca profiles under `~/Library/Application Support/orca/claude-profiles`. `CLAUDE_CONFIG_DIR` takes precedence over `ANTHROPIC_CONFIG_DIR`; an explicit nonempty override excludes all other Claude registries. Other platforms retain single-directory discovery. Inventory processes at most 128 Orca profile entries and 4,096 registry entries in total, including non-record entries; enumeration reads one extra entry to detect limit exhaustion, each registration JSON remains limited to 1 MiB. Limit exhaustion is incomplete inventory. Automatic profile directories and registry records require current-user ownership and no group/world write permissions, including when a default-path alias reaches the same automatic source; unsafe automatic evidence is incomplete. macOS extended ACLs on automatic sources are conservatively rejected, including owner-only entries. The fixed `/bin/ls -ldebn` metadata helper uses bounded path batches, output and a five-second inspection budget; unknown inspection is incomplete inventory. This is not an agent invocation or an arbitrary-kernel-I/O deadline guarantee. This does not silently strengthen the legacy default/explicit-only policy or establish hostile-same-user protection. This is not a recursive disk scan or a claim of additional native platform qualification.
319
+
320
+ Successful rows survive incomplete inventory, but listing reports failure and neither target selection nor inferred sender identity may use an incomplete or conflicting inventory. Aliases of the same canonical registry merge; distinct live records claiming the same PID or endpoint remain conflicts even if their text matches; conflicting PID, socket-string or underlying endpoint claims never select a winner by traversal order. Ordinary name ambiguity still refuses. Original registry provenance remains private continuity evidence through selection and the final pre-submission recheck; it does not create an authenticated model identity or a public generation. Listing and dry-run never connect to an inbox. Ordinary posted/queued and ACK semantics remain unchanged.
321
+
316
322
  ## Source unified listing contract — #16 / 0.2.0
317
323
 
318
324
  `node dist/cli.js list --json` combines Claude and saved Codex rows. Use
@@ -737,13 +743,12 @@ it does not replace send's stricter competitor checks. Codex executable paths
737
743
  are inspected for accessibility and never executed, even with `--codex-bin`.
738
744
  An accessible DB and executable do not verify a live writer (`writerVerified:false`).
739
745
 
740
- Claude checks bounded numeric session records (regular files, maximum 64 KiB),
741
- process identity and inbox metadata. POSIX checks the socket file; Windows checks
746
+ The #165 source shares Claude inventory across list, send, sender detection and doctor: bounded numeric session records (regular files, maximum 1 MiB), process identity and inbox metadata. Earlier doctor revisions used a separate 64 KiB reader. POSIX checks the socket file; Windows checks
742
747
  process identity and a named-pipe advertisement, **not pipe existence or availability
743
748
  for connection**. `verification` states this distinction. Invalid records and
744
749
  unknown/permission inspections are counted. There is no inbox connection, queue
745
750
  submission, lock acquisition, chmod, configuration mutation, wake, login, or
746
- credential read. Native process arguments, stderr and session names/bodies are
751
+ standalone credential-store read. Session-registration JSON may contain extra fields; raw records are not persisted or emitted by doctor. Native process arguments, stderr and session names/bodies are
747
752
  not emitted. Host/home and executable paths are intentionally reported.
748
753
 
749
754
  `capabilities` describes implementation support: `list/send/doctor:true`,
@@ -1400,6 +1405,8 @@ scope, not a publication claim or blanket Python runtime parity.
1400
1405
  | Windows handoff storage | Required capability reports unsupported; ordinary published Windows send/SSH are separate | Private DACL/reparse storage and owned cleanup qualification [#131](https://github.com/abruption/session-peer-ts/issues/131) |
1401
1406
  | SSH handoff | Explicit same-version destination preparation/ledger, strict binding and one send; unsupported goals refuse before effect | Real remote native client-ID observation remains unqualified; actual Linux queues/manual ACK do not establish it |
1402
1407
 
1408
+ The [#132 local receipt-bootstrap design proposal](https://github.com/abruption/session-peer-ts/blob/db11695d7c33ef375f62eb099497cb1a6b27c4cd/docs/design/receipt-bootstrap.md) records the owner-selected manual collector and explicit authority delegation, with a separate proposed Claude receipt-context contract. It does not enable a producer/collector, change v1 generation rules or qualify a platform.
1409
+
1403
1410
  An automatic receipt collector, if later implemented, still records only a
1404
1411
  receiver's explicit receipt. Visible replies, arbitrary message text, queue
1405
1412
  deletions and turn completion never authorize ACK promotion. The frozen design
@@ -1419,3 +1426,11 @@ the exact proposed skill 0.3.0/min0.1.0/full0.4.0/probe-help tuple after design/
1419
1426
  review of the complete Draft #37 fixture. That fixture is not a published skill
1420
1427
  or installation pin; final skill bytes require renewed exact review. A new runtime
1421
1428
  version is never automatically compatible by numerical ordering.
1429
+
1430
+ ## Explicit local receipts — #132 source implementation
1431
+
1432
+ The implementation candidate follows the owner-selected [local bootstrap design](https://github.com/abruption/session-peer-ts/blob/d922d6e20345f10b914ee9cf4da40476fd044f5d/docs/design/receipt-bootstrap.md): manual local collector, explicit private-input authority delegation and a separately invoked receipt-only handler. Existing generation-bound Codex v1 semantics remain intact; Claude delegated-context v2 keeps native generation unknown and proves only token possession. This is separate from manual `operator_confirmed` evidence.
1433
+
1434
+ Managed format-2 state has one live collector owner and no migration/import/recovery path. Original user-payload digests remain privately encrypted; raw capability values are never persisted by sender/collector. Fast pre-outcome receipts cannot promote an unknown native submission, reopen an effect fence or rewrite terminal wait results. Receipt/status/wait operations have no native submission path. Codex token delivery uses qualified private-stdin RPC only; ordinary argv-based queue submission is never a token-bearing fallback.
1435
+
1436
+ The [operator guide](docs/guide.md#explicit-local-receipts) and [API contract](docs/api.md#explicit-local-receipt-bootstrap-source-implementation) describe the opt-in scope. Existing platform/native qualification, same-version SSH rules and independent skill pins remain unchanged. Windows managed storage, reverse-SSH collectors, automatic services, wake, automatic model ACK, resend and exactly-once claims remain outside this implementation. Transcript-derived Claude observation #73 was explicitly closed NO-GO; that decision does not prohibit voluntary receipt submission.
package/README.ja.md CHANGED
@@ -14,9 +14,9 @@
14
14
 
15
15
  <!-- docs-contract: stable-release-source; package=session-peer; bin=session-peer; node=22.13+/24; python-reference=1.1.0 -->
16
16
 
17
- **文書・ソースのバージョン: 0.5.2。** インストール前に、選択したリリースとレジストリのメタデータを確認してください。日付付きの準備・検証記録は [VALIDATION.md](VALIDATION.md)、リリース手順は [RELEASING.md](RELEASING.md) にあります。SSH の両端には同じ TypeScript クライアントのバージョンが必要で、0.3.6 と 0.5.2 は互いの SSH 事前確認を拒否します。
17
+ **文書・ソースのバージョン: 0.6.0。** インストール前に、選択したリリースとレジストリのメタデータを確認してください。日付付きの準備・検証記録は [VALIDATION.md](VALIDATION.md)、リリース手順は [RELEASING.md](RELEASING.md) にあります。SSH の両端には同じ TypeScript クライアントのバージョンが必要で、0.3.6 と 0.6.0 は互いの SSH 事前確認を拒否します。
18
18
 
19
- **0.4.0 handoff の範囲:** 任意の native 観測は macOS arm64 の厳密な Codex 0.160.1/0.162.1 に限定し、明示的な `operator_confirmed` 受領確認には対応する POSIX ledger を使います。Linux・Windows の native 観測と自動 ACK 収集は未対応です。 0.5.2 のソースは選択できない Linux arm64 の Codex 0.162.1 候補(固定された上流 `aarch64-unknown-linux-musl` 実行ファイル、スキーマ、注入テスト 1 回)を記録しますが、Linux 観測を有効化しません。Linux の native 観測は引き続き未対応です。
19
+ **0.4.0 handoff の範囲:** 任意の native 観測は macOS arm64 の厳密な Codex 0.160.1/0.162.1 に限定し、明示的な `operator_confirmed` 受領確認には対応する POSIX ledger を使います。Linux・Windows の native 観測と自動 ACK 収集は未対応です。 0.6.0 のソースは選択できない Linux arm64 の Codex 0.162.1 候補(固定された上流 `aarch64-unknown-linux-musl` 実行ファイル、スキーマ、注入テスト 1 回)を記録しますが、Linux 観測を有効化しません。Linux の native 観測は引き続き未対応です。
20
20
 
21
21
  **実行中の Claude Code・Codex セッションを見つけ、ローカルまたは SSH でメッセージを送信します。**
22
22
  Python 不要の Node.js クライアントです。パッケージ名とコマンド名は `session-peer` です。
@@ -61,15 +61,15 @@ SSH は既存の鍵・ホスト信頼設定と両端の**同じバージョン
61
61
  `Get-Command session-peer -All` で PATH を確認してください。利用する実装を選び、
62
62
  別の管理ツールのファイルを `--force` で上書きしないでください。
63
63
 
64
- **0.5.2 のインストール:** npm の導入・更新例を実行する前に、レジストリで公開状況と選択したリリースを確認してください。利用できない場合は[レビュー済みソースビルド](docs/guide.ja.md#ソースからビルド)を使います。
64
+ **0.6.0 のインストール:** npm の導入・更新例を実行する前に、レジストリで公開状況と選択したリリースを確認してください。利用できない場合は[レビュー済みソースビルド](docs/guide.ja.md#ソースからビルド)を使います。
65
65
 
66
66
  ```sh
67
- npm view session-peer@0.5.2 version dist.integrity
68
- npm install --global --ignore-scripts session-peer@0.5.2
67
+ npm view session-peer@0.6.0 version dist.integrity
68
+ npm install --global --ignore-scripts session-peer@0.6.0
69
69
  session-peer --version
70
70
  ```
71
71
 
72
- 期待する出力: `session-peer 0.5.2 (typescript)`。分離インストール・ソースビルド・
72
+ 期待する出力: `session-peer 0.6.0 (typescript)`。分離インストール・ソースビルド・
73
73
  Windows・削除の手順は以下の詳細ガイドを参照してください。
74
74
 
75
75
  任意の `sp` 短縮名は 0.3.0 以降に含まれ(0.2.1 以前にはありません)、自動では有効になりません。
@@ -78,12 +78,12 @@ Windows・削除の手順は以下の詳細ガイドを参照してください
78
78
  ### Update
79
79
 
80
80
  npm で導入したクライアントは npm で更新します。タグと対象バージョンを確認してから
81
- 正確なバージョンを指定してください。以下は古い npm 版を選択した 0.5.2 に更新する例です。
81
+ 正確なバージョンを指定してください。以下は古い npm 版を選択した 0.6.0 に更新する例です。
82
82
  CLI は更新をインストールせず、`session-peer update --check` は確認のみ行います。
83
83
 
84
84
  ```sh
85
85
  npm view session-peer dist-tags
86
- npm install --global --ignore-scripts session-peer@0.5.2
86
+ npm install --global --ignore-scripts session-peer@0.6.0
87
87
  session-peer --version
88
88
  ```
89
89
 
package/README.ko.md CHANGED
@@ -23,9 +23,9 @@ Python을 설치하지 않아도 Node.js에서 실행되는 TypeScript 클라이
23
23
 
24
24
  <!-- docs-contract: stable-release-source; package=session-peer; bin=session-peer; node=22.13+/24; python-reference=1.1.0 -->
25
25
 
26
- **문서·소스 기준 버전: 0.5.2.** 설치 전에 선택한 릴리스와 레지스트리 메타데이터를 확인하세요. 날짜별 준비·검증 기록은 [VALIDATION.md](VALIDATION.md), 릴리스 절차는 [RELEASING.md](RELEASING.md)에 있습니다. SSH 양쪽에는 같은 TypeScript 클라이언트 버전이 필요하며, 0.3.6 버전과 0.5.2 버전은 서로의 SSH 사전 확인을 거부합니다.
26
+ **문서·소스 기준 버전: 0.6.0.** 설치 전에 선택한 릴리스와 레지스트리 메타데이터를 확인하세요. 날짜별 준비·검증 기록은 [VALIDATION.md](VALIDATION.md), 릴리스 절차는 [RELEASING.md](RELEASING.md)에 있습니다. SSH 양쪽에는 같은 TypeScript 클라이언트 버전이 필요하며, 0.3.6 버전과 0.6.0 버전은 서로의 SSH 사전 확인을 거부합니다.
27
27
 
28
- **0.4.0 handoff 범위:** 선택 기능인 native 관측은 macOS arm64의 정확한 Codex 0.160.1/0.162.1에 한정되며, 명시적 `operator_confirmed` 수령 확인에는 지원되는 POSIX ledger를 사용합니다. Linux·Windows의 native 관측과 자동 ACK 수집은 미지원입니다. 0.5.2 소스는 선택할 수 없는 Linux arm64 Codex 0.162.1 후보(고정된 업스트림 `aarch64-unknown-linux-musl` 실행 파일, 스키마, 주입 테스트 1회)를 기록하며 Linux 관측을 활성화하지 않습니다. Linux native 관측은 계속 미지원입니다.
28
+ **0.4.0 handoff 범위:** 선택 기능인 native 관측은 macOS arm64의 정확한 Codex 0.160.1/0.162.1에 한정되며, 명시적 `operator_confirmed` 수령 확인에는 지원되는 POSIX ledger를 사용합니다. Linux·Windows의 native 관측과 자동 ACK 수집은 미지원입니다. 0.6.0 소스는 선택할 수 없는 Linux arm64 Codex 0.162.1 후보(고정된 업스트림 `aarch64-unknown-linux-musl` 실행 파일, 스키마, 주입 테스트 1회)를 기록하며 Linux 관측을 활성화하지 않습니다. Linux native 관측은 계속 미지원입니다.
29
29
 
30
30
  <a id="demo"></a>
31
31
  ## 시연
@@ -70,15 +70,15 @@ PowerShell에서는 `Get-Command session-peer -All`로 PATH(명령 검색 경로
70
70
  실행 파일을 찾는지 확인하세요. 사용할 구현을 선택하고 다른 패키지 관리자가 설치한
71
71
  파일을 `--force`로 덮어쓰지 마세요. 설치와 갱신은 사용자가 npm으로 직접 수행합니다.
72
72
 
73
- **0.5.2 설치:** npm 설치·업데이트 예시를 실행하기 전에 레지스트리 제공 여부와 선택한 릴리스를 확인하세요. 해당 버전이 제공되지 않으면 [검토한 소스 빌드](docs/guide.ko.md#소스에서-빌드)를 사용하세요.
73
+ **0.6.0 설치:** npm 설치·업데이트 예시를 실행하기 전에 레지스트리 제공 여부와 선택한 릴리스를 확인하세요. 해당 버전이 제공되지 않으면 [검토한 소스 빌드](docs/guide.ko.md#소스에서-빌드)를 사용하세요.
74
74
 
75
75
  ```sh
76
- npm view session-peer@0.5.2 version dist.integrity
77
- npm install --global --ignore-scripts session-peer@0.5.2
76
+ npm view session-peer@0.6.0 version dist.integrity
77
+ npm install --global --ignore-scripts session-peer@0.6.0
78
78
  session-peer --version
79
79
  ```
80
80
 
81
- 예상 결과는 `session-peer 0.5.2 (typescript)`입니다. 별도 경로에 설치하거나,
81
+ 예상 결과는 `session-peer 0.6.0 (typescript)`입니다. 별도 경로에 설치하거나,
82
82
  소스에서 빌드하거나, Windows에서 설치·제거하는 방법은 [사용자 가이드](docs/guide.ko.md#설치)를 참고하세요.
83
83
 
84
84
  선택 사항인 `sp` 단축 명령은 0.3.0 이상에 포함되며(0.2.1 이하에는 없음) 자동으로
@@ -89,13 +89,13 @@ session-peer --version
89
89
  ### 업데이트
90
90
 
91
91
  npm으로 설치한 클라이언트는 사용자가 직접 npm으로 업데이트합니다. 사용 가능한 배포 태그
92
- (dist-tag)와 대상 버전을 확인한 뒤 해당 버전을 지정해 설치하세요. 아래 예시는 이전 npm 설치본을 선택한 0.5.2 버전으로
92
+ (dist-tag)와 대상 버전을 확인한 뒤 해당 버전을 지정해 설치하세요. 아래 예시는 이전 npm 설치본을 선택한 0.6.0 버전으로
93
93
  업데이트합니다. `session-peer` CLI는 업데이트를 설치하지 않습니다. `session-peer
94
94
  update --check`는 새 버전이 있는지 확인할 뿐입니다.
95
95
 
96
96
  ```sh
97
97
  npm view session-peer dist-tags
98
- npm install --global --ignore-scripts session-peer@0.5.2
98
+ npm install --global --ignore-scripts session-peer@0.6.0
99
99
  session-peer --version
100
100
  ```
101
101
 
package/README.md CHANGED
@@ -14,9 +14,9 @@
14
14
 
15
15
  <!-- docs-contract: stable-release-source; package=session-peer; bin=session-peer; node=22.13+/24; python-reference=1.1.0 -->
16
16
 
17
- **Documentation and source version: 0.5.2.** Review the selected release and registry metadata before installation. Dated preparation and validation records are in [VALIDATION.md](VALIDATION.md); release procedures are in [RELEASING.md](RELEASING.md). SSH endpoints require the same TypeScript client version; 0.3.6 and 0.5.2 refuse each other’s SSH preflight.
17
+ **Documentation and source version: 0.6.0.** Review the selected release and registry metadata before installation. Dated preparation and validation records are in [VALIDATION.md](VALIDATION.md); release procedures are in [RELEASING.md](RELEASING.md). SSH endpoints require the same TypeScript client version; 0.3.6 and 0.6.0 refuse each other’s SSH preflight.
18
18
 
19
- **0.4.0 handoff scope:** opt-in native observation is limited to exact Codex 0.160.1/0.162.1 on macOS arm64; explicit `operator_confirmed` receipts use supported POSIX ledgers. Linux/Windows native observation and automatic ACK collection remain unsupported. The 0.5.2 source records a non-selectable Linux arm64 Codex 0.162.1 candidate (pinned upstream `aarch64-unknown-linux-musl` executable, schema and one injection test); it does not enable Linux observation. Linux native observation remains unsupported.
19
+ **0.4.0 handoff scope:** opt-in native observation is limited to exact Codex 0.160.1/0.162.1 on macOS arm64; explicit `operator_confirmed` receipts use supported POSIX ledgers. Linux/Windows native observation and automatic ACK collection remain unsupported. The 0.6.0 source records a non-selectable Linux arm64 Codex 0.162.1 candidate (pinned upstream `aarch64-unknown-linux-musl` executable, schema and one injection test); it does not enable Linux observation. Linux native observation remains unsupported.
20
20
 
21
21
  **Find and message running Claude Code and Codex sessions, locally or over SSH.**
22
22
  A Node.js client that runs without Python. Package and command: `session-peer`.
@@ -61,15 +61,15 @@ Check `type -a session-peer` on macOS/Linux or `Get-Command session-peer -All`
61
61
  in PowerShell before installing. Choose the intended PATH entry; do not use
62
62
  `--force` to overwrite another manager’s files.
63
63
 
64
- **Version 0.5.2 installation:** check registry availability and review the chosen release before running the npm install/update examples. If that version is unavailable, use the [reviewed source build](docs/guide.md#build-from-source).
64
+ **Version 0.6.0 installation:** check registry availability and review the chosen release before running the npm install/update examples. If that version is unavailable, use the [reviewed source build](docs/guide.md#build-from-source).
65
65
 
66
66
  ```sh
67
- npm view session-peer@0.5.2 version dist.integrity
68
- npm install --global --ignore-scripts session-peer@0.5.2
67
+ npm view session-peer@0.6.0 version dist.integrity
68
+ npm install --global --ignore-scripts session-peer@0.6.0
69
69
  session-peer --version
70
70
  ```
71
71
 
72
- Expected: `session-peer 0.5.2 (typescript)`. For isolated installation, source
72
+ Expected: `session-peer 0.6.0 (typescript)`. For isolated installation, source
73
73
  builds, Windows and removal, see the detailed guide below.
74
74
 
75
75
  Optional `sp` shorthand ships with 0.3.0 and later (not 0.2.1 or earlier) and is
@@ -79,12 +79,12 @@ never enabled automatically. See [explicit activation and collisions](docs/short
79
79
 
80
80
  Use npm for an npm-managed installation. Check the available tags and review
81
81
  the target version, then install that exact version; this example updates an
82
- older npm installation to the selected 0.5.2 release. The CLI does not install updates;
82
+ older npm installation to the selected 0.6.0 release. The CLI does not install updates;
83
83
  `session-peer update --check` only reports them.
84
84
 
85
85
  ```sh
86
86
  npm view session-peer dist-tags
87
- npm install --global --ignore-scripts session-peer@0.5.2
87
+ npm install --global --ignore-scripts session-peer@0.6.0
88
88
  session-peer --version
89
89
  ```
90
90
 
package/README.zh-CN.md CHANGED
@@ -14,9 +14,9 @@
14
14
 
15
15
  <!-- docs-contract: stable-release-source; package=session-peer; bin=session-peer; node=22.13+/24; python-reference=1.1.0 -->
16
16
 
17
- **文档和源码版本:0.5.2。** 安装前,请审核所选发布版本和注册表元数据。按日期记录的准备与验证结果见 [VALIDATION.md](VALIDATION.md),发布流程见 [RELEASING.md](RELEASING.md)。SSH 两端必须使用相同的 TypeScript 客户端版本;0.3.6 与 0.5.2 会拒绝彼此的 SSH 预检。
17
+ **文档和源码版本:0.6.0。** 安装前,请审核所选发布版本和注册表元数据。按日期记录的准备与验证结果见 [VALIDATION.md](VALIDATION.md),发布流程见 [RELEASING.md](RELEASING.md)。SSH 两端必须使用相同的 TypeScript 客户端版本;0.3.6 与 0.6.0 会拒绝彼此的 SSH 预检。
18
18
 
19
- **0.4.0 handoff 范围:** 可选 native 观测仅限 macOS arm64 上精确 Codex 0.160.1/0.162.1 版本;明确的 `operator_confirmed` 收件确认使用受支持的 POSIX ledger。Linux、Windows 的 native 观测和自动 ACK 收集仍不支持。 0.5.2 源码记录了不可选用的 Linux arm64 Codex 0.162.1 候选(固定的上游 `aarch64-unknown-linux-musl` 可执行文件、schema 及一次注入测试),但不启用 Linux 观测;Linux native 观测仍不支持。
19
+ **0.4.0 handoff 范围:** 可选 native 观测仅限 macOS arm64 上精确 Codex 0.160.1/0.162.1 版本;明确的 `operator_confirmed` 收件确认使用受支持的 POSIX ledger。Linux、Windows 的 native 观测和自动 ACK 收集仍不支持。 0.6.0 源码记录了不可选用的 Linux arm64 Codex 0.162.1 候选(固定的上游 `aarch64-unknown-linux-musl` 可执行文件、schema 及一次注入测试),但不启用 Linux 观测;Linux native 观测仍不支持。
20
20
 
21
21
  **发现正在运行的 Claude Code 和 Codex 会话,并在本机或通过 SSH 发送消息。**
22
22
  这是不需要 Python 的 Node.js 客户端。包名与命令名均为 `session-peer`。
@@ -59,15 +59,15 @@ session-peer send --to CLAUDE_PID --message '请检查 API 契约并回复。' -
59
59
  `Get-Command session-peer -All` 检查 PATH。选择所需实现,不要用 `--force`
60
60
  覆盖其他安装管理器的文件。
61
61
 
62
- **安装 0.5.2:** 运行 npm 安装或更新示例前,请确认注册表可用性并审核所选发布版本。如该版本不可用,请使用[已审核的源码构建](docs/guide.zh-CN.md#从源码构建)。
62
+ **安装 0.6.0:** 运行 npm 安装或更新示例前,请确认注册表可用性并审核所选发布版本。如该版本不可用,请使用[已审核的源码构建](docs/guide.zh-CN.md#从源码构建)。
63
63
 
64
64
  ```sh
65
- npm view session-peer@0.5.2 version dist.integrity
66
- npm install --global --ignore-scripts session-peer@0.5.2
65
+ npm view session-peer@0.6.0 version dist.integrity
66
+ npm install --global --ignore-scripts session-peer@0.6.0
67
67
  session-peer --version
68
68
  ```
69
69
 
70
- 预期输出:`session-peer 0.5.2 (typescript)`。隔离安装、源码构建、Windows 和
70
+ 预期输出:`session-peer 0.6.0 (typescript)`。隔离安装、源码构建、Windows 和
71
71
  卸载步骤见下方详细指南。
72
72
 
73
73
  可选的 `sp` 简写包含在 0.3.0 及更高版本中(0.2.1 及更早版本没有),不会自动启用。
@@ -76,11 +76,11 @@ session-peer --version
76
76
  ### Update
77
77
 
78
78
  使用 npm 更新由 npm 管理的安装。先检查标签并审阅目标版本,再安装指定版本。
79
- 下面示例将旧 npm 安装更新至所选的 0.5.2。CLI 不会安装更新,`session-peer update --check` 只做检查。
79
+ 下面示例将旧 npm 安装更新至所选的 0.6.0。CLI 不会安装更新,`session-peer update --check` 只做检查。
80
80
 
81
81
  ```sh
82
82
  npm view session-peer dist-tags
83
- npm install --global --ignore-scripts session-peer@0.5.2
83
+ npm install --global --ignore-scripts session-peer@0.6.0
84
84
  session-peer --version
85
85
  ```
86
86
 
package/RELEASING.md CHANGED
@@ -9,6 +9,79 @@ the historical 0.3.2 settings-read exception is recorded below. The workflow
9
9
  uses OIDC and no npm token. The protected GitHub environment requires a reviewer
10
10
  and permits deployments from `main` only.
11
11
 
12
+ ## 0.6.0 preparation — 2026-11-03 KST
13
+
14
+ This is release preparation, not a publication record or authorization to
15
+ publish. Issue [#175](https://github.com/abruption/session-peer-ts/issues/175)
16
+ tracks the candidate. The merged Orca Claude profile work
17
+ ([#165](https://github.com/abruption/session-peer-ts/issues/165),
18
+ [#173](https://github.com/abruption/session-peer-ts/pull/173)) and explicit local
19
+ receipt implementation [#176](https://github.com/abruption/session-peer-ts/pull/176)
20
+ for [#132](https://github.com/abruption/session-peer-ts/issues/132) are separate
21
+ review checkpoints. Final integrated-source checks, archive identity and the
22
+ exact merged-main release gate must be recorded before source approval.
23
+
24
+ The receipt collector is an explicitly started local foreground process. Codex
25
+ uses the generation-bound v1 receipt contract only on its qualified private
26
+ owned-queue path; Claude uses a separate v2 delegated receipt context and does
27
+ not claim a native generation. A valid receipt authenticates the delegated
28
+ receipt submission within that context; it does not prove model identity,
29
+ message consumption, injection or task completion. It does not turn native
30
+ submission or a queued message into an automatic ACK. Unknown effects must not
31
+ be retried, resent or rerouted. Native observation, platform and SSH
32
+ qualification are not expanded by these local receipt contracts.
33
+
34
+ [#73](https://github.com/abruption/session-peer-ts/issues/73) is closed as
35
+ NO-GO for transcript/body-based probing. That research is not a runtime feature
36
+ or a source of receipt authority. The existing published companion skill and
37
+ its immutable source pin stay unchanged; a finite doctor compatibility row is
38
+ not evidence that the skill covers the new receipt workflow.
39
+
40
+ Before any publication, use a new exact-source approval for
41
+ `session-peer@0.6.0`, `stable-stage` and eventual latest promotion to 0.6.0.
42
+ Require current-head macOS/Ubuntu Node 22/24, Windows Node 22/24, repository
43
+ policy, CodeQL and release-gate checks plus reviews of the final changes.
44
+ Verify the reproducible archive, packaged Markdown/source identity and isolated
45
+ package lifecycle against that same source. Fresh npm ownership, pending-stage,
46
+ stage-only Trusted Publisher, package publish-MFA and protected npm environment
47
+ checks remain separate gates; historical exceptions and approvals do not carry
48
+ forward. Protected-environment and final npm stage approvals remain separate.
49
+ Do not dispatch, approve a stage, create `v0.6.0` or publish a GitHub Release
50
+ until their required approvals are obtained. Both SSH endpoints must use the
51
+ same exact runtime version. No global or fleet installation is part of this
52
+ preparation.
53
+
54
+ ## Public 0.5.2 checkpoint — 2026-10-30 KST
55
+
56
+ [GitHub v0.5.2](https://github.com/abruption/session-peer-ts/releases/tag/v0.5.2)
57
+ and npm 0.5.2 are public from
58
+ `d5c40ecd09baa831315266d0debf63eb1c4a1e59`. The annotated tag peels to that
59
+ same immutable source. Reviewed, exact-main, retained Actions, staged and public
60
+ raw tarballs are byte-identical: SHA-256
61
+ `c799e4f7ed96794928e5780732f8d230e6eac8502301a75f44c0d55393c85d8b`.
62
+ [Stage-only run 40988011234](https://github.com/abruption/session-peer-ts/actions/runs/40988011234)
63
+ ran once after exact-source approval. Public integrity/signature/provenance,
64
+ source/workflow/run linkage and isolated installation/removal passed;
65
+ latest=0.5.2 and preview=0.1.0-preview.1 is preserved. The
66
+ [public validation record](VALIDATION.md#public-052--2026-10-30-kst) records the
67
+ exact chronology and evidence limits. No new native/platform/ACK or fleet
68
+ qualification is implied.
69
+
70
+ Ownership, no pending stages before dispatch, stage-only Trusted Publisher and
71
+ protected GitHub npm environment/main restriction were freshly checked. The
72
+ user confirmed the protected environment approval. The separate browser package
73
+ publish-MFA policy read was explicitly skipped for this 0.5.2 publication and is
74
+ not freshly audited. This is a settings-read exception only, not a change to
75
+ publisher permissions or approval requirements. The agent did not execute the
76
+ final npm stage approval; publication was observed after that stage became
77
+ unavailable. Full public provenance trust/signature checks completed afterward.
78
+
79
+ This later GitHub checkpoint is not part of the immutable published tarball,
80
+ which retains its dated preparation evidence. Do not replay the completed
81
+ preparation or stage, reuse these approvals for a later release, move the tag or
82
+ republish 0.5.2. A future version needs its own reviewed source/artifact and
83
+ approvals. No user global/fleet runtime or skill installation was changed.
84
+
12
85
  ## 0.5.2 storage guards and release consistency preparation — 2026-10-30 KST
13
86
 
14
87
  Preparation baseline is merged main
package/VALIDATION.md CHANGED
@@ -1,4 +1,105 @@
1
- # Validation record — updated 2026-10-30 KST
1
+ # Validation record — updated 2026-11-03 KST
2
+
3
+ ## 0.6.0 preparation scope — 2026-11-03 KST
4
+
5
+ The candidate tracks [#175](https://github.com/abruption/session-peer-ts/issues/175)
6
+ and combines merged Orca Claude profile discovery
7
+ ([#165](https://github.com/abruption/session-peer-ts/issues/165),
8
+ [#173](https://github.com/abruption/session-peer-ts/pull/173)) with
9
+ [#176](https://github.com/abruption/session-peer-ts/pull/176)'s staged local
10
+ receipt implementation for [#132](https://github.com/abruption/session-peer-ts/issues/132).
11
+ The integrated source `ef1ba36b7d9b4f4ac7917527fdb8d2db009d5def` passed
12
+ 660 tests: 648 pass, 0 fail, 11 skip and 1 existing TODO on Node 24/macOS arm64,
13
+ using the pinned Python reference `8ca77cf31254c8287a2593fe484bb30a7dba2727`.
14
+ Build/types, scoped versions and repository links/structure passed. The exact
15
+ 95-file package passed reproducible packing, isolated install, native binding,
16
+ shorthand lifecycle and uninstall. Final PR-head CI/reviews and exact merged-main
17
+ release evidence remain separate gates; the candidate archive identity is
18
+ recorded in the release PR and its source-bound manifest, not inferred from an
19
+ earlier feature or metadata-only artifact.
20
+
21
+ The new collector is explicitly started and stopped by its operator; it does
22
+ not start a service, wake a session or resend messages. Codex retains the v1
23
+ non-null generation contract on the qualified owned native queue route.
24
+ Claude's v2 delegated receipt context deliberately does not prove a native
25
+ generation. Authenticated receipt submission proves neither model identity nor
26
+ message consumption, injection or completion. Sender/collector output does not
27
+ publish the private capability; the intended recipient's native input/history
28
+ may retain it. Unknown effects keep the no-retry/no-resend boundary.
29
+
30
+ The implementation's local CLI, private IPC, storage and synthetic transport
31
+ checks do not establish new live native/model/SSH receipt or ACK qualification.
32
+ Existing platform refusals and native observation profiles remain bounded;
33
+ Linux/Windows observation and Windows managed receipt storage are not enabled.
34
+ [#73](https://github.com/abruption/session-peer-ts/issues/73)'s transcript/body
35
+ probe is closed NO-GO and is not included as a runtime feature. Existing
36
+ companion skill publication and its immutable source/hash pin remain separate
37
+ and unchanged; metadata compatibility is not new workflow coverage.
38
+
39
+ This preparation makes no public 0.6.0 availability, fresh npm authentication or
40
+ publisher/MFA-policy audit, stage approval, installation or operational claim.
41
+ Exact merged-source approval, protected-environment approval, final npm stage
42
+ approval, publication verification and any authorized tag/release remain future
43
+ release gates. Historical publication records below retain their original
44
+ versions, dates and evidence limits.
45
+
46
+ <a id="public-052--2026-10-30-kst"></a>
47
+
48
+ ## Public 0.5.2 — 2026-10-30 KST
49
+
50
+ `session-peer@0.5.2` was published at `2026-10-30T01:54:47.513Z` from
51
+ `d5c40ecd09baa831315266d0debf63eb1c4a1e59`.
52
+ [Run 40988011234](https://github.com/abruption/session-peer-ts/actions/runs/40988011234)
53
+ ran once; both prepare and publish succeeded, with npm stage
54
+ `333968c3-29bd-4fbe-afeb-134da02924a5`. The
55
+ [GitHub release](https://github.com/abruption/session-peer-ts/releases/tag/v0.5.2)
56
+ was published at `2026-10-30T02:04:15Z`. Annotated tag object
57
+ `b19877a806154afecbd35b7754333d23b55ebd31` peels to the same source commit.
58
+
59
+ The reviewed local, exact-main, retained Actions, staged and public tarball raw
60
+ bytes all matched. All 79 archive files, including 18 Markdown files, matched
61
+ the selected source. The immutable archive contains the correct release source;
62
+ this later GitHub public record is not in the 0.5.2 archive and does not imply
63
+ republishing it.
64
+
65
+ - SHA-256: `c799e4f7ed96794928e5780732f8d230e6eac8502301a75f44c0d55393c85d8b`
66
+ - Registry integrity: `sha512-4cgqyU7AaSVUnTZvsFeP5Ocyri9XNqUQCxV+WDZOhHK0aJ8c/CkeMiv7isVtZns3RYu58TyU0sAoz4oBbQLhAA==`
67
+
68
+ The full suite recorded 503 tests: 491 pass, 0 fail, 11 platform skips and
69
+ 1 existing TODO. Exact-main
70
+ [CLI CI run 40984539326](https://github.com/abruption/session-peer-ts/actions/runs/40984539326)
71
+ and [CodeQL run 40984538915](https://github.com/abruption/session-peer-ts/actions/runs/40984538915)
72
+ succeeded. The release helper's public verification with pinned npm 11.15.0
73
+ passed signature/provenance checks, an isolated installation, CLI version and
74
+ empty Claude-list checks, and uninstallation.
75
+
76
+ The actual registry SLSA bundle passed `sigstore.verify` certificate-chain,
77
+ certificate-transparency and transparency-log verification, including the
78
+ GitHub OIDC issuer and workflow identity. Its subject SHA-512, source commit,
79
+ repository, `main` ref, `publish.yml`, `workflow_dispatch` trigger and invocation
80
+ `40988011234` matched the release. Rekor entry: `3581769908`. The staged-byte
81
+ comparison completed at `01:53:47Z`, before publication; full provenance trust
82
+ verification completed after publication. These results do not establish that
83
+ all checks preceded user approval.
84
+
85
+ The user explicitly confirmed source approval and GitHub environment approval.
86
+ Fresh checks established authenticated owner `abruption`, no pre-existing
87
+ stages, a stage-only `createStagedPackage` publisher and the GitHub environment's
88
+ required reviewer and main-only restriction. For 0.5.2 the user explicitly
89
+ skipped only the web read of npm's publish-MFA policy; that setting was not
90
+ freshly audited. No protection or setting was changed. The stage later returned
91
+ 404 and public `latest=0.5.2` was observed. The agent did not execute final
92
+ `npm stage approve`; this record claims neither that action nor an explicit
93
+ chat confirmation of npm 2FA approval.
94
+
95
+ At public verification, `latest=0.5.2` and `preview=0.1.0-preview.1` (unchanged).
96
+ Registry `readmeFilename=README.zh-CN.md` and the registry README exactly matched
97
+ the packaged 0.5.2 Chinese README. Public npm HTML returned HTTP 403, so rendered
98
+ npm-page inspection is not claimed. These checks establish source/package
99
+ identity and public package availability only: no new native/model, SSH, delivery/ACK,
100
+ fleet-installation or global-installation test is claimed. Historical evidence
101
+ and the dated preparation checkpoint below retain their original scope.
102
+
2
103
 
3
104
  ## 0.5.2 preparation scope — 2026-10-30 KST
4
105
 
package/dist/cli.js CHANGED
@@ -1,11 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { handoffCommand, handoffSend, prepareHandoff, privateMessage } from './handoff-operations.js';
3
+ import { receiptCommand } from './receipt-command.js';
4
+ import { managedReceiptSend } from './receipt-send.js';
3
5
  import { canonicalId, closed, HANDOFF_LIMITS, HandoffBudget, parseStrictJson, parseWaitTimeout, safeInteger, systemClock } from './handoff.js';
4
6
  import { doctor } from './diagnostics.js';
5
7
  import { help } from './help.js';
6
8
  import { renderOutput } from './output.js';
7
9
  import { hostname } from 'node:os';
8
10
  import { lstatSync } from 'node:fs';
11
+ import { isAbsolute } from 'node:path';
9
12
  import { listing, Refusal } from './discovery.js';
10
13
  import { executable, run, UnknownOutcome } from './process.js';
11
14
  import { checkMessage, send, CodexUnknownOutcome } from './send.js';
@@ -16,7 +19,7 @@ import { CHANNELS, checkUpdate, noticeText, refreshCache, refuseSelfUpdate, REFR
16
19
  import { jumpOptions, sshConfig, sshJump, sshOptions } from './ssh.js';
17
20
  import { configuredHost, detectedHost, isSelf, probeReturnRoute, unsafeReturnHost, replyUri, returnHost, route, sender, tailnet } from './replies.js';
18
21
  const FLAGS = ['--json', '--all', '--dry-run', '--no-from', '--no-reply-to', '--no-update-notice', '--allow-inactive-codex-home', '--check-return-route', '--check', '--request-ack', '--observe-delivery'];
19
- const VALUES = ['--agent', '--codex-home', '--codex-bin', '--output-format', '--to', '--message', '-m', '--host', '--remote-bin', '--remote-platform', '--ssh-control-path', '--reply-address', '--ssh-opt', '--ssh-jump', '--reply-to', '--return-route-host', '--channel', '--correlation-id', '--wait-for', '--wait-timeout', '--message-file'];
22
+ const VALUES = ['--agent', '--codex-home', '--codex-bin', '--output-format', '--to', '--message', '-m', '--host', '--remote-bin', '--remote-platform', '--ssh-control-path', '--reply-address', '--ssh-opt', '--ssh-jump', '--reply-to', '--return-route-host', '--channel', '--correlation-id', '--wait-for', '--wait-timeout', '--message-file', '--receipt-collector'];
20
23
  // Repeated in order; every other value option is single.
21
24
  const REPEATED = ['--host', '--ssh-opt'];
22
25
  // Requested destinations, so a command-wide refusal can be attributed to each.
@@ -91,6 +94,16 @@ export function parse(args) {
91
94
  if (!flags.has('--json') && !values.has('--output-format'))
92
95
  throw new Refusal('json_output_required');
93
96
  const handoff = flags.has('--request-ack') || flags.has('--observe-delivery') || values.has('--correlation-id') || values.has('--wait-for') || values.has('--wait-timeout');
97
+ if (values.has('--receipt-collector')) {
98
+ const selector = values.get('--receipt-collector');
99
+ if (command !== 'send' || !isAbsolute(selector) || selector.includes('\0') || hosts.length ||
100
+ repeated.get('--ssh-opt').length || values.has('--remote-bin') || values.has('--remote-platform') ||
101
+ values.has('--ssh-control-path') || values.has('--ssh-jump') || values.has('--correlation-id') ||
102
+ flags.has('--observe-delivery') || values.get('--wait-for') === 'delivered' || flags.has('--allow-inactive-codex-home'))
103
+ throw new Refusal('inapplicable_option');
104
+ if (!flags.has('--dry-run') && !flags.has('--request-ack') && values.get('--wait-for') !== 'acknowledged')
105
+ throw new Refusal('receipt_opt_in_required', 2);
106
+ }
94
107
  if (handoff) {
95
108
  if (command !== 'send')
96
109
  throw new Refusal('inapplicable_option');
@@ -172,6 +185,8 @@ export function parse(args) {
172
185
  if (process.platform === 'win32' || values.get('--remote-platform') === 'win32')
173
186
  throw new Refusal('remote_handoff_unsupported', 1);
174
187
  }
188
+ if (values.has('--receipt-collector') && hosts.length)
189
+ throw new Refusal('remote_receipt_unsupported', 1);
175
190
  if (command === 'send' && flags.has('--allow-inactive-codex-home')) {
176
191
  if (!values.get('--to').startsWith('codex:'))
177
192
  throw new Refusal('inapplicable_option');
@@ -469,8 +484,35 @@ try {
469
484
  else if (args.length === 1 && args[0] === '--version')
470
485
  console.log(VERSION_LINE);
471
486
  else if ((args.length === 1 && ['--help', '-h'].includes(args[0])) ||
472
- (args.length === 2 && ['list', 'send', 'doctor', 'update', 'handoff', 'ack'].includes(args[0]) && ['--help', '-h'].includes(args[1])))
487
+ (args.length === 2 && ['list', 'send', 'doctor', 'update', 'handoff', 'ack', 'receipt'].includes(args[0]) && ['--help', '-h'].includes(args[1])))
473
488
  console.log(help(args.length === 2 ? args[0] : undefined));
489
+ else if (args[0] === 'receipt') {
490
+ command = 'receipt';
491
+ const operation = await receiptCommand(args, (limit, privateInput, timeoutMs) => input(limit, privateInput ?? true, timeoutMs));
492
+ console.log(JSON.stringify(operation.raw ? operation.value : { schemaVersion: 1, host: hostname(), command, ok: operation.exitCode === 0, ...operation.value }));
493
+ process.exitCode = operation.exitCode;
494
+ if (operation.collector) {
495
+ const collector = operation.collector;
496
+ let stopping = false;
497
+ const stop = (code) => {
498
+ if (stopping)
499
+ return;
500
+ stopping = true;
501
+ void collector.close().then(result => {
502
+ process.removeListener('SIGINT', interrupt);
503
+ process.removeListener('SIGTERM', terminate);
504
+ process.exitCode = code;
505
+ if (result.cleanup !== 'confirmed') {
506
+ console.error('receipt_cleanup_unconfirmed');
507
+ process.exit(code || 1);
508
+ }
509
+ }, () => { console.error('receipt_cleanup_unconfirmed'); process.exit(code || 1); });
510
+ };
511
+ const interrupt = () => stop(130), terminate = () => stop(143);
512
+ process.once('SIGINT', interrupt);
513
+ process.once('SIGTERM', terminate);
514
+ }
515
+ }
474
516
  else if (args[0] === 'handoff' || args[0] === 'ack') {
475
517
  command = args[0];
476
518
  const operation = await handoffCommand(args, limit => input(limit, true));
@@ -530,6 +572,8 @@ try {
530
572
  }
531
573
  command = ['list', 'send', 'doctor', 'update'].includes(args[0] ?? '') ? args[0] : 'unknown';
532
574
  const options = parse(args);
575
+ if (wire && options.values.has('--receipt-collector'))
576
+ throw new Refusal('remote_receipt_unsupported', 1);
533
577
  const handoffEnabled = options.flags.has('--request-ack') || options.flags.has('--observe-delivery') || options.values.has('--correlation-id') || options.values.has('--wait-for') || options.values.has('--wait-timeout');
534
578
  if (wire && (handoffEnabled !== !!wireContext || handoffEnabled !== !!wireBudget))
535
579
  throw new Refusal('remote_handoff_context_required', 1);
@@ -649,6 +693,12 @@ try {
649
693
  const enabled = options.flags.has('--request-ack') || options.flags.has('--observe-delivery') || options.values.has('--correlation-id') || options.values.has('--wait-for') || options.values.has('--wait-timeout');
650
694
  if (wireContext?.preparation)
651
695
  ({ value: result, exitCode } = await prepareHandoff(settings, undefined, options.values.get('--correlation-id'), handoffBudget));
696
+ else if (options.values.has('--receipt-collector'))
697
+ ({ value: result, exitCode } = await managedReceiptSend(settings, {
698
+ collector: options.values.get('--receipt-collector'), requestAck: options.flags.has('--request-ack'),
699
+ waitFor: options.values.get('--wait-for'),
700
+ seconds: parseWaitTimeout(options.values.get('--wait-timeout') ?? '30'), payload: rawMessage, budget: handoffBudget
701
+ }));
652
702
  else if (enabled)
653
703
  ({ value: result, exitCode } = await handoffSend(settings, { remote: wireContext !== undefined, correlationId: options.values.get('--correlation-id'), requestAck: options.flags.has('--request-ack'), observeDelivery: options.flags.has('--observe-delivery'), waitFor: options.values.get('--wait-for'), seconds: parseWaitTimeout(options.values.get('--wait-timeout') ?? '30'), payload: rawMessage, budget: handoffBudget, resultOverhead: Buffer.byteLength(JSON.stringify(routing)) + 1024 }));
654
704
  else
@@ -691,8 +741,8 @@ try {
691
741
  }
692
742
  catch (error) {
693
743
  // A command-wide refusal before dispatch applies to every requested host.
694
- if (command === 'handoff' || command === 'ack') {
695
- const failureCode = error instanceof Refusal ? error.code : 'handoff_operation_failed';
744
+ if (command === 'handoff' || command === 'ack' || command === 'receipt') {
745
+ const failureCode = error instanceof Refusal ? error.code : command === 'receipt' ? 'receipt_operation_failed' : 'handoff_operation_failed';
696
746
  console.log(JSON.stringify({ schemaVersion: 1, host: hostname(), command, ok: false, error: failureCode }));
697
747
  process.exitCode = error instanceof Refusal ? error.exitCode : 1;
698
748
  }