session-peer 0.3.2 → 0.3.3

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/RELEASING.md CHANGED
@@ -2,19 +2,116 @@
2
2
 
3
3
  Publication is manual. Merging, pushing, tagging or creating a GitHub release
4
4
  never dispatches `publish.yml`. Python session-peer and its Relay release train
5
- remain independent. The npm Trusted Publisher for `abruption/session-peer-ts`,
6
- `publish.yml`, environment `npm` allows `npm stage publish` only. The workflow
5
+ remain independent. The last directly verified npm Trusted Publisher mapping
6
+ for `abruption/session-peer-ts`, `publish.yml`, environment `npm` allowed
7
+ `npm stage publish` only. Stage-only permission remains the required policy;
8
+ the historical 0.3.2 settings-read exception is recorded below. The workflow
7
9
  uses OIDC and no npm token. The protected GitHub environment requires a reviewer
8
10
  and permits deployments from `main` only.
9
11
 
10
- ## 0.3.2 release procedure
12
+ ## 0.3.3 candidate preparation — #128 (2026-10-09 KST)
13
+
14
+ This dated checkpoint records preparation only. The candidate integrated reviewed
15
+ dependency heads
16
+ [PR #125](https://github.com/abruption/session-peer-ts/pull/125) (`d4c9138`),
17
+ [PR #127](https://github.com/abruption/session-peer-ts/pull/127) (`8c882fa`), and
18
+ [Draft PR #126](https://github.com/abruption/session-peer-ts/pull/126) (`f10b971`).
19
+ At this checkpoint all three remained open and unmerged; human review and merge
20
+ were required. Candidate integration did not establish an approved main release SHA.
21
+ No staging, publication, tag, GitHub Release or fleet rollout is authorized by
22
+ preparation [#128](https://github.com/abruption/session-peer-ts/issues/128).
23
+
24
+ The registry baseline checked at this checkpoint was **latest=0.3.2** and
25
+ **preview=0.1.0-preview.1**; 0.3.3 was the new target and was not published at that checkpoint.
26
+ Previous stable integrity:
27
+ `sha512-VNlzBqELXLFI8uCopfEdYrfweIacHeP6dMK32/4vwQJy8fUIKC64c5WCE3IwQVeCTKGMz9mXSxhzZnXmSGMuuA==`.
28
+ Previous stable attestation metadata:
29
+ `https://registry.npmjs.org/-/npm/v1/attestations/session-peer@0.3.2`.
30
+ Preserve the immutable public 0.3.2 source
31
+ `f335f07352c842f2f6ceb12bd2ca6274b52f69f7` and all historical evidence below.
32
+
33
+ 1. Review the exact dependency heads and companion guard profile before their
34
+ human merge gate. Review and merge the 0.3.3 preparation after its dependencies.
35
+ Require successful CI and release gate for the exact resulting 40-character
36
+ `main` SHA, including Windows Node 22/24; candidate-only checks do not qualify
37
+ a different main SHA. Record bounded strict SSH/native and metadata reader
38
+ evidence in VALIDATION.md without claiming ACK, consumption, general platform
39
+ qualification or 0.4 features.
40
+ 2. Perform fresh authenticated reads of package ownership, pending npm stages,
41
+ stage-only Trusted Publisher mapping/permissions, package MFA settings and
42
+ protected GitHub `npm` environment/reviewer/main restrictions. Recheck the
43
+ registry baseline, previous integrity, unchanged preview tag and absence of
44
+ 0.3.3. The historical 0.3.2 settings-read exception does **not** carry forward.
45
+ A reauthentication or unread setting leaves this gate incomplete.
46
+ 3. Build and verify the local candidate archive from that exact merged source,
47
+ including packed four-language documentation:
48
+ package, lockfile, runtime banner, examples and tarball must agree on 0.3.3;
49
+ archive documentation must describe its approved publication state, retain
50
+ dated historical records, and pass the artifact documentation gate. Record
51
+ source SHA, tarball integrity and validation without editing a validated
52
+ archive in place. See [artifact documentation policy](#documentation-gate-for-the-next-release).
53
+ 4. Obtain a separate approval naming that exact merged `main` SHA, **0.3.3**,
54
+ **stable-stage**, and promotion of `latest` to **0.3.3**. Preparation, dependency
55
+ review and previous release approvals do not authorize this action.
56
+ 5. Only after that approval dispatch `publish.yml` with `mode=stable-stage`,
57
+ `version=0.3.3`, `source_sha=<approved main SHA>` and
58
+ `confirmation=session-peer@0.3.3 stable-stage`. Download the prepare job’s
59
+ `npm-release-<SHA>` artifact and apply the documentation gate before protected
60
+ GitHub environment approval. Verify staged bytes against that retained
61
+ artifact and review provenance, then obtain the
62
+ **separate final npm 2FA approval** for publication and `latest` promotion.
63
+ Stop on uncertain staging outcomes and inspect the existing stage; do not
64
+ retry uploads or broaden publisher permissions.
65
+ 6. Verify public integrity, provenance/signatures, exact version and isolated
66
+ install/removal; record the new public checkpoint while keeping preview and
67
+ historical checkpoints intact. Only an **actually published** guard runtime
68
+ can precede separate successor skill finalization/tag/publication/pin updates.
69
+ Companion [Draft #20 design acceptance at `699a325`](https://github.com/abruption/session-peer-skill/blob/699a3251830c30c62d0f812363faf4d0eb0c8e0c/docs/typescript-compatibility.md)
70
+ records static review of exact #126 `ba18bb8` and release Draft #129
71
+ `bfb3d6f` on 2026-10-09; full heads/design hashes are recorded in the
72
+ [guard design](docs/design/typescript-skill-compatibility.md#exact-companion-design-acceptance--2026-10-09-kst). No tests were rerun in that review. At that
73
+ checkpoint, runtime and successor skill were unpublished. Design-only
74
+ acceptance does not authorize runtime merge/release, final successor skill
75
+ metadata/publication/installation or replace pin
76
+ `081cc3c1d16a394bd92824333f4bc61c36951799`.
77
+
78
+ 0.3.2 and 0.3.3 refuse each other's SSH version preflight. Operators and package
79
+ managers own coordinated endpoint upgrades; no postinstall, automatic deployment
80
+ or uncertain-send retry is introduced. Windows jump-host #20 and provisioning
81
+ #23 limitations remain; the Python 1.0.2 oracle and 0.4 proposals stay separate.
82
+
83
+ ## Public release checkpoint — 0.3.2 (2026-10-07 KST)
84
+
85
+ Public `session-peer@0.3.2` was verified with `latest=0.3.2` and unchanged
86
+ `preview=0.1.0-preview.1`; see [the dated record](VALIDATION.md#public-032--2026-10-07-kst).
87
+ Publication source: `f335f07352c842f2f6ceb12bd2ca6274b52f69f7`; stage-only run
88
+ `37571653938`; stage `2226865d-2dac-4d42-bd4e-2e1c998b9833`.
89
+ The Actions/staged/public bytes matched, and integrity, source provenance,
90
+ signature audit and isolated install/removal passed. This is not a GitHub
91
+ Release/tag or fleet rollout record.
92
+
93
+ The procedure below is historical for this completed publication. Do not
94
+ replay its approvals, stage 0.3.2 again or republish that version. A later
95
+ release needs a new baseline, exact source approval and validation.
96
+
97
+ ## Historical 0.3.2 release procedure and recorded exception
98
+
99
+ Public 0.3.2 publication completed **with a recorded exception to step 2**.
100
+ Authenticated ownership and pending stages, GitHub environment protection and
101
+ registry baselines were checked. Fresh Trusted Publisher permission and
102
+ package MFA settings reads requested reauthentication, and the operator
103
+ explicitly instructed skipping those two reads. No fresh confirmation of
104
+ either setting is claimed. Successful OIDC staging, protected environment
105
+ approval and separate npm 2FA publication are execution evidence; they do not
106
+ establish the skipped settings. This exception applies only to the historical
107
+ 0.3.2 release; future releases require their own checks and approvals.
11
108
 
12
109
  The release preparation is based on reviewed main `488ddddac302ba2ad0841061dc8df9187ff6a983`; 0.4 feature branches are excluded. The required pre-staging baseline is **0.3.1**, with `latest=0.3.1` and `preview=0.1.0-preview.1`; these are preconditions, not a permanent statement of registry state. Check the registry and dated validation record for publication status. Previous stable integrity is pinned to:
13
110
  `sha512-iZq06dbm6NavHuPZYMIxAnzQN5ksqm66yufpppddVWUYkuaG5TJvktbUXTSX7v3BBFnuybEJekI0KSaDo3Xfbg==`.
14
111
  Previous stable attestation metadata: `https://registry.npmjs.org/-/npm/v1/attestations/session-peer@0.3.1`. Historical records below remain historical.
15
112
 
16
113
  1. Review and merge the 0.3.2 preparation PR, then require successful CI and release gate for the exact merged main SHA, including Windows Node 22/24. Check the current deployment qualification evidence in VALIDATION.md; pending F5 evidence is not a pass.
17
- 2. Recheck package ownership/2FA, the npm environment reviewer/main-only policy, stage-only Trusted Publisher mapping, and authenticated pending stages. Require 0.3.2 absent, `latest=0.3.1`, unchanged preview tag/integrity and the pinned public 0.3.1 integrity/provenance.
114
+ 2. Required preflight: recheck package ownership/2FA, npm environment protection, stage-only Trusted Publisher permissions and authenticated pending stages; verify registry baselines. Historical 0.3.2 execution: ownership, authenticated stages, environment protection and registry baselines were checked; fresh Trusted Publisher permissions and package MFA settings reads were explicitly skipped under the recorded operator exception above. Those two reads are not marked complete.
18
115
  3. Obtain separate approval naming the exact merged 40-character main SHA, **0.3.2**, **stable-stage**, and promotion of `latest` to 0.3.2. Preparation approval and previous release approvals do not authorize staging or publication.
19
116
  4. Only after that approval, dispatch publish.yml with `mode=stable-stage`, `version=0.3.2`, `source_sha=<approved main SHA>` and `confirmation=session-peer@0.3.2 stable-stage`. Review the staged artifact and complete separate npm 2FA approval before publication.
20
117
 
package/SECURITY.md CHANGED
@@ -14,7 +14,7 @@ homes, SQLite DBs, transcripts, browser profiles or .env files. Rotate exposed
14
14
  secrets with their provider; deleting a comment does not revoke a secret.
15
15
 
16
16
  Review is manual and best-effort, with no response or fix deadline. The project is
17
- a published npm client, with 0.3.1 release evidence in [VALIDATION.md](VALIDATION.md#public-031--2026-10-04-kst).
17
+ a published npm client, with 0.3.2 release evidence in [VALIDATION.md](VALIDATION.md#public-032--2026-10-07-kst).
18
18
  Reports on published versions and source commits are welcome; no maintenance
19
19
  window or backport promise exists. English and Korean reports are welcome. Disclosure
20
20
  is coordinated with the reporter; private reports are not automatically public.
package/VALIDATION.md CHANGED
@@ -1,4 +1,102 @@
1
- # Validation record — updated 2026-10-07 KST
1
+ # Validation record — updated 2026-10-09 KST
2
+
3
+ ## 0.3.3 candidate preparation — 2026-10-09 KST
4
+
5
+ Preparation [#128](https://github.com/abruption/session-peer-ts/issues/128)
6
+ integrates the still-unmerged dependency heads: documentation #125
7
+ `d4c91387b8c968d45a822f82b69ff9333f4ae0bf`, ordinary SSH #127
8
+ `8c882fab220ade044d00beb9d23bf6ecb7727bdc`, and Draft skill guard #126
9
+ `f10b97115830d5968ff7a0583dc470643c3cbeda`, based on main
10
+ `b12699e108c0857b029d4b5c72f82414eb64b21c`. This is an unpublished
11
+ review candidate, not a merged release SHA or publication authorization.
12
+ The 0.4.0 handoff/app-server/observer drafts are excluded. Exact companion
13
+ successor-profile acceptance remains pending; candidate `VERSION=0.3.3`
14
+ exercises a proposed finite row, not published skill compatibility.
15
+
16
+ Local macOS arm64, Node 24.16.0 checks at preparation checkpoint
17
+ `de0472aa6e5ac94d29f227d04dc93671b4d45646`:
18
+
19
+ - `npm test`: 183 tests, 178 passed, zero failed, five Windows-only skips.
20
+ This command also ran `npm run build` and `npm run test:types` successfully.
21
+ Conformance used the existing Python 1.0.2 oracle at
22
+ `47c23713d0a2a3c11ebde6186afd8c43489b8b65`; no reference repin.
23
+ - The release, skill-metadata, updates and multi-host integration selection
24
+ passed 41 tests before the full suite.
25
+ - `npm run test:package`: reproducible package, fresh isolated installation,
26
+ native dependency loading, bash/zsh shorthand contract, actual fixture
27
+ version replacement (`0.3.3` to `0.3.3-fixture.1`) and removal passed.
28
+ - `node scripts/check-repository.mjs`, `git diff --check` and `npm audit`
29
+ passed; audit reported zero vulnerabilities.
30
+
31
+ The first candidate CI run `37886970517` failed its Windows Node 22
32
+ same-size metadata mutation fixture: the automatic timestamp change was not
33
+ observed while the file was open. The fixture now explicitly advances mtime
34
+ and asserts that metadata changed after inspection returns; fixture mutation
35
+ errors also propagate outside the reader’s conservative error handler, so
36
+ a setup/assertion failure cannot count as expected refusal. No timing sleep
37
+ is used. This tests an
38
+ observable metadata change, not an atomic snapshot or undetectable writes.
39
+ Runtime reader behavior is unchanged. After this test-only correction,
40
+ `npm run build`, `npm run test:types` and the 15 skill-metadata tests passed
41
+ locally. Corrected exact-head Windows/aggregate CI results belong in the PR;
42
+ the first failed run is not reported as all green.
43
+
44
+ The registry baseline was read as `latest=0.3.2`,
45
+ `preview=0.1.0-preview.1`, and 0.3.3 absent. Previous stable integrity matches
46
+ its public record below. Authenticated pending-stage, Trusted Publisher,
47
+ package MFA and protected-environment policy reads were not performed for
48
+ this preparation. They remain fresh pre-publication gates.
49
+
50
+ The strict SSH and bounded metadata evidence is fixture/CI evidence described
51
+ in the dependency design documents. No live agent delivery, ACK, real remote
52
+ SSH qualification, crash recovery or fleet update was performed here. Local
53
+ Windows-only skips are not passes; candidate CI and exact post-merge main CI
54
+ must be reported separately at their own exact heads. Local artifact hashes
55
+ and current-head CI results are recorded in the preparation PR, without
56
+ substituting them for an approved Actions publication artifact.
57
+
58
+ ## Public 0.3.2 — 2026-10-07 KST
59
+
60
+ `session-peer@0.3.2` was published at **2026-10-07 13:34:36 KST**
61
+ (`2026-10-07T04:34:36.456Z`). Verified registry tags: `latest=0.3.2`,
62
+ `preview=0.1.0-preview.1` unchanged. Publication source is
63
+ `f335f07352c842f2f6ceb12bd2ca6274b52f69f7` (PR #112 after #111), with exact-main
64
+ CLI run `37570782974` and CodeQL run `37570783335` both successful.
65
+
66
+ Stage-only Trusted Publisher workflow [37571653938](https://github.com/abruption/session-peer-ts/actions/runs/37571653938)
67
+ completed prepare and publish. The approved inputs were exact source above,
68
+ version `0.3.2`, mode `stable-stage`; protected GitHub environment approval and
69
+ separate npm 2FA approval followed. Stage ID:
70
+ `2226865d-2dac-4d42-bd4e-2e1c998b9833`.
71
+
72
+ - Retained Actions archive, downloaded staged tarball and public registry
73
+ tarball were byte-identical. SHA-256:
74
+ `a1ded0c99765f25d0570aa8a38e2ccf0c1c4760b3e25de2b1f20f56061b90540`.
75
+ - Registry integrity:
76
+ `sha512-VNlzBqELXLFI8uCopfEdYrfweIacHeP6dMK32/4vwQJy8fUIKC64c5WCE3IwQVeCTKGMz9mXSxhzZnXmSGMuuA==`.
77
+ - Public publish/SLSA attestation subject digests matched the tarball. SLSA
78
+ named the exact source above, `abruption/session-peer-ts`, `publish.yml` and
79
+ run `37571653938/attempts/1`.
80
+ - `node scripts/release.mjs artifact` and `verify` passed against the retained
81
+ Actions artifact: allowlist/version/source/hash, registry integrity/tags,
82
+ attestation metadata, npm signature audit, fresh isolated installation and
83
+ removal. All 16 packaged Markdown files byte-matched publication source.
84
+ - Authenticated stage listing and ownership were checked. Fresh Trusted
85
+ Publisher permission/package MFA settings reads requested reauthentication;
86
+ the operator instructed skipping those reads. This is a recorded exception
87
+ to the settings-read gate for the historical 0.3.2 release, not completion
88
+ of those reads. No fresh settings confirmation is claimed. Actual OIDC
89
+ staging, protected environment review and separate proof-of-presence
90
+ publication are execution evidence; they do not establish the skipped
91
+ permission or MFA policies. No setting was changed. Future releases require
92
+ their own policy checks and approvals.
93
+
94
+ The Windows destination qualification below used published **0.3.1**, not
95
+ 0.3.2 live delivery. Runtime delta in 0.3.2 is VERSION only; no 0.4.0 drafts
96
+ were included. #20 Windows-client jump and #23 remaining qualification/design
97
+ follow-ups remain open. GitHub tag/Release and fleet upgrades are not claimed.
98
+ The preparation checkpoints below describe their dated pre-publication state.
99
+
2
100
 
3
101
  ## 0.3.2 preparation checkpoint — 2026-10-07 KST
4
102
 
@@ -92,9 +190,9 @@ runtime-identity enforcement remain outside this qualification. The earlier
92
190
  Linux run and its untested newer recovery rules remain historical evidence.
93
191
 
94
192
 
95
- This dated record covers the 0.3.2 preparation checkpoint; public 0.3.1,
96
- 0.3.0, 0.2.1 and 0.2.0 verification; historical 0.1.0 public verification;
97
- earlier candidate checks and live-agent observations. Older sections
193
+ This dated record covers public 0.3.2, 0.3.1, 0.3.0, 0.2.1 and 0.2.0
194
+ verification; the historical 0.3.2 preparation checkpoint; historical 0.1.0
195
+ public verification; earlier candidate checks and live-agent observations. Older sections
98
196
  describe their stated checkpoint rather than current feature availability.
99
197
  It does not claim complete Python parity.
100
198
  Python reference: v1.0.2, commit `47c23713d0a2a3c11ebde6186afd8c43489b8b65`.
package/dist/cli.js CHANGED
@@ -7,7 +7,8 @@ import { lstatSync } from 'node:fs';
7
7
  import { listing, Refusal } from './discovery.js';
8
8
  import { executable, run, UnknownOutcome } from './process.js';
9
9
  import { checkMessage, send, CodexUnknownOutcome } from './send.js';
10
- import { HomeRefusal, uuid } from './writer.js';
10
+ import { HomeRefusal } from './writer.js';
11
+ import { responseOutcome } from './ssh-response.js';
11
12
  import { envelope, host, reply, VERSION, VERSION_LINE } from './protocol.js';
12
13
  import { CHANNELS, checkUpdate, noticeText, refreshCache, refuseSelfUpdate, REFRESH_ARG, updateNotice, UpdateRefusal } from './updates.js';
13
14
  import { jumpOptions, sshConfig, sshJump, sshOptions } from './ssh.js';
@@ -279,48 +280,22 @@ async function remote(options, ssh, target, resolved, message, returnTo) {
279
280
  if (returnTo)
280
281
  args.push('--return-route-host', returnTo);
281
282
  const done = await run(ssh, [...base, invoke('--stdio-request')], {
282
- timeout: 90000, input: JSON.stringify({ schemaVersion: 1, args })
283
+ timeout: 90000, rawStdout: true, input: JSON.stringify({ schemaVersion: 1, args })
283
284
  });
284
285
  const uncertain = () => { if (command === 'send' && !flags.has('--dry-run') && done.spawned)
285
286
  throw new UnknownOutcome(); throw new Refusal('remote_response_unverified', 1); };
286
- if (done.interrupted || !done.spawned)
287
- return uncertain();
288
- let value;
287
+ let verified;
289
288
  try {
290
- value = JSON.parse(done.stdout);
289
+ verified = responseOutcome(done, { command, to: values.get('--to'), dryRun: flags.has('--dry-run'), returnTo,
290
+ home: values.get('--codex-home'), allowInactive: flags.has('--allow-inactive-codex-home') });
291
291
  }
292
292
  catch {
293
293
  return uncertain();
294
294
  }
295
- if (!value || value.schemaVersion !== 1 || value.command !== command || typeof value.ok !== 'boolean' || typeof value.host !== 'string' ||
296
- ![0, 1, 2].includes(done.code ?? -1) || (value.ok !== (done.code === 0)))
297
- return uncertain();
298
- if (command === 'doctor' && value.ok && (value.diagnosticCompleted !== true || typeof value.ready !== 'boolean' || value.implementation !== 'typescript' || !value.agents || typeof value.agents !== 'object' || Array.isArray(value.agents)))
299
- return uncertain();
300
- const probe = value.returnRoute;
301
- if (command === 'doctor' && value.ok && returnTo && (!probe || typeof probe !== 'object' || !['verified', 'failed'].includes(probe.status) || !['local', 'ssh'].includes(probe.transport)))
302
- return uncertain();
303
- const expectedStatus = flags.has('--dry-run') ? 'validated' : values.get('--to')?.startsWith('codex:') ? 'queued' : 'posted';
304
- if (command === 'send' && (value.consumptionConfirmed !== false ||
305
- (value.ok && (value.submitted !== !flags.has('--dry-run') || value.status !== expectedStatus)) ||
306
- (!value.ok && !((value.submitted === false && value.status === 'refused') || (value.submitted === null && value.status === 'unknown')))))
307
- return uncertain();
308
- if (command === 'send' && value.ok) {
309
- const target = value.target;
310
- const requestedTarget = values.get('--to') ?? '';
311
- const requestedCodexThread = requestedTarget.startsWith('codex:') ? requestedTarget.slice(6) : undefined;
312
- const validTarget = target && !Array.isArray(target) &&
313
- (target.agent === undefined || target.agent === (requestedCodexThread ? 'codex' : 'claude')) &&
314
- (requestedCodexThread
315
- ? typeof target.id === 'string' && uuid(target.id) && target.id.toLowerCase() === requestedCodexThread.toLowerCase()
316
- : Number.isSafeInteger(target.pid) && target.pid > 0 &&
317
- (typeof target.name === 'string' || target.name === null));
318
- if (!validTarget)
319
- return uncertain();
320
- }
295
+ const { value } = verified;
321
296
  // `clientUpdate` is client-local: a remote-supplied value is never trusted or shown.
322
297
  delete value.clientUpdate;
323
- return { value: { ...value, host: resolved.canonical, sshHost: target }, exitCode: done.code };
298
+ return { value: { ...value, host: resolved.canonical, sshHost: target }, exitCode: verified.exitCode };
324
299
  }
325
300
  function failure(error, command, where) {
326
301
  const unknown = error instanceof UnknownOutcome;
@@ -513,6 +488,10 @@ try {
513
488
  results = results?.map(item => ({ ...item, ...routing }));
514
489
  result = { ...result, ...routing };
515
490
  }
491
+ // Wire-only request context for remote home canonicalization. The caller
492
+ // validates and removes this scalar; ordinary local result shape is unchanged.
493
+ if (wire && command === 'send' && result.ok === true && options.values.has('--codex-home'))
494
+ result.requestedCodexHome = options.values.get('--codex-home');
516
495
  // Without a return host there is nothing to probe from the destination.
517
496
  if (command === 'doctor' && options.flags.has('--check-return-route') && !returnTo)
518
497
  results = results?.map(item => item.ok === false ? item : ({ ...item, returnRoute: { status: 'failed', transport: 'ssh', host: null, reason: 'return_host_unavailable' } }));
@@ -3,7 +3,8 @@
3
3
  import { accessSync, constants, readdirSync, readFileSync, statSync } from 'node:fs';
4
4
  import { homedir } from 'node:os';
5
5
  import { delimiter, isAbsolute, join } from 'node:path';
6
- import { canonical, listingCandidates, sqliteHome } from './discovery.js';
6
+ import { listingCandidates, sqliteHome } from './discovery.js';
7
+ import { inspectSkill } from './skill-metadata.js';
7
8
  import { batchShim } from './process.js';
8
9
  import { windowsProcessStart } from './windows.js';
9
10
  const failure = (error, missing, unknown) => {
@@ -197,35 +198,5 @@ export async function doctor(agent, home, binary) {
197
198
  export function inspectSkills(home) {
198
199
  const paths = new Set([join(homedir(), '.agents/skills/session-peer-ts/SKILL.md'),
199
200
  join(home || process.env.CODEX_HOME || join(homedir(), '.codex'), 'skills/session-peer-ts/SKILL.md')]);
200
- return [...paths].map(path => {
201
- try {
202
- path = canonical(path);
203
- if (!statSync(path).isFile() || statSync(path).size > 65536)
204
- return { path, status: 'unknown', code: 'skill_metadata_unreadable' };
205
- const text = readFileSync(path, 'utf8');
206
- const front = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(text)?.[1];
207
- if (!front)
208
- return { path, status: 'unknown', code: 'skill_metadata_missing' };
209
- const lines = front.split(/\r?\n/);
210
- const sections = lines.map((line, index) => /^metadata: *(?:#.*)?$/.test(line) ? index : -1).filter(index => index >= 0);
211
- if (sections.length !== 1)
212
- return { path, status: 'unknown', code: 'skill_metadata_missing' };
213
- const start = sections[0] + 1;
214
- let end = start;
215
- while (end < lines.length && (/^ /.test(lines[end]) || /^ *(?:#.*)?$/.test(lines[end])))
216
- end++;
217
- const fields = lines.slice(start, end).map(line => /^ ([a-z-]+): *(?:"([^"\r\n]*)"|'([^'\r\n]*)'|([^#"'\r\n]*?)) *(?:#.*)?$/.exec(line));
218
- const field = (key) => {
219
- const values = fields.filter(match => match?.[1] === key).map(match => (match[2] ?? match[3] ?? match[4]).trim());
220
- return values.length === 1 ? values[0] : undefined;
221
- };
222
- const implementation = field('runtime-implementation'), minimum = field('runtime-min-version');
223
- const policy = field('runtime-capability-policy');
224
- const compatible = implementation === 'typescript' && minimum === '0.1.0' && policy === 'probe-help' && field('version') === '0.1.0' && field('runtime-full-version') === '0.1.0';
225
- return { path, status: compatible ? 'compatible' : 'incompatible', code: compatible ? 'skill_contract_compatible' : 'skill_contract_mismatch', verification: 'metadata_only' };
226
- }
227
- catch (error) {
228
- return { path, ...failure(error, 'skill_missing', 'skill_metadata_unreadable') };
229
- }
230
- });
201
+ return [...paths].map(inspectSkill);
231
202
  }
package/dist/output.js CHANGED
@@ -68,5 +68,11 @@ export function renderOutput(value, format) {
68
68
  if (value.command === 'send')
69
69
  lines.push(value.submitted === null ? 'Submission outcome unknown. Do not retry automatically.' : 'Nothing submitted.');
70
70
  }
71
+ if (value.sshTransport && typeof value.sshTransport === 'object') {
72
+ const transport = value.sshTransport;
73
+ lines.push(`SSH transport: ${safe(transport.status)} (${safe(transport.reason)}); verified remote facts retained.`);
74
+ if (value.submitted === true)
75
+ lines.push('Do not resend automatically.');
76
+ }
71
77
  return lines.join('\n');
72
78
  }
package/dist/process.d.ts CHANGED
@@ -2,16 +2,20 @@ export declare class UnknownOutcome extends Error {
2
2
  }
3
3
  export declare const batchShim: (path: string) => boolean;
4
4
  export declare function executable(name: string): string;
5
+ export type StopReason = 'timeout' | 'output_limit' | 'process_error';
5
6
  export type Done = {
6
7
  code: number | null;
7
8
  stdout: string;
8
9
  stderr: string;
9
10
  spawned: boolean;
10
11
  interrupted: boolean;
12
+ stdoutBytes?: Buffer;
13
+ stopReason?: StopReason;
11
14
  };
12
15
  export declare function run(binary: string, args: string[], options?: {
13
16
  env?: NodeJS.ProcessEnv;
14
17
  input?: string;
15
18
  timeout?: number;
16
19
  limit?: number;
20
+ rawStdout?: boolean;
17
21
  }): Promise<Done>;
package/dist/process.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { accessSync, constants, realpathSync, statSync } from 'node:fs';
3
3
  import { delimiter, isAbsolute, join } from 'node:path';
4
+ import { StringDecoder } from 'node:string_decoder';
4
5
  import { Refusal } from './discovery.js';
5
6
  export class UnknownOutcome extends Error {
6
7
  }
@@ -57,7 +58,9 @@ function forward(signal) {
57
58
  }
58
59
  export function run(binary, args, options = {}) {
59
60
  return new Promise(resolve => {
60
- let stdout = '', stderr = '', bytes = 0, spawned = false, interrupted = false, finished = false, stopped = false;
61
+ let stdout = '', stderr = '', bytes = 0, stderrBytes = 0, spawned = false, interrupted = false, finished = false, stopped = false;
62
+ let stopReason;
63
+ const chunks = [], outputDecoder = new StringDecoder('utf8'), diagnosticDecoder = new StringDecoder('utf8');
61
64
  const child = spawn(binary, args, { shell: false, env: options.env ?? process.env, stdio: ['pipe', 'pipe', 'pipe'], detached: posix });
62
65
  const release = () => {
63
66
  if (child.pid === undefined || !groups.delete(child.pid) || groups.size)
@@ -71,12 +74,16 @@ export function run(binary, args, options = {}) {
71
74
  finished = true;
72
75
  clearTimeout(timer);
73
76
  release();
74
- resolve({ code, stdout, stderr, spawned, interrupted });
77
+ stdout += outputDecoder.end();
78
+ stderr += diagnosticDecoder.end();
79
+ resolve({ code, stdout, stderr, spawned, interrupted,
80
+ ...(options.rawStdout ? { stdoutBytes: Buffer.concat(chunks, bytes) } : {}), ...(stopReason ? { stopReason } : {}) });
75
81
  };
76
- const stop = () => {
82
+ const stop = (reason) => {
77
83
  if (stopped || finished)
78
84
  return;
79
85
  stopped = interrupted = true;
86
+ stopReason = reason;
80
87
  if (posix)
81
88
  reap(child.pid);
82
89
  else
@@ -90,9 +97,9 @@ export function run(binary, args, options = {}) {
90
97
  if (child.exitCode !== null || child.signalCode !== null)
91
98
  setTimeout(() => finish(child.exitCode), 100);
92
99
  };
93
- const timer = setTimeout(stop, options.timeout ?? 3000);
100
+ const timer = setTimeout(() => stop('timeout'), options.timeout ?? 3000);
94
101
  const register = () => {
95
- if (!posix || child.pid === undefined || groups.has(child.pid))
102
+ if (finished || stopped || !posix || child.pid === undefined || groups.has(child.pid))
96
103
  return;
97
104
  if (!groups.size)
98
105
  for (const name of signals)
@@ -104,24 +111,35 @@ export function run(binary, args, options = {}) {
104
111
  register();
105
112
  child.once('spawn', () => { spawned = true; register(); });
106
113
  child.stdin.on('error', () => { });
107
- child.stdout.setEncoding('utf8');
108
114
  child.stdout.on('data', (part) => {
109
- bytes += Buffer.byteLength(part);
110
- if (bytes > (options.limit ?? 1024 * 1024))
111
- stop();
115
+ if (bytes + part.length > (options.limit ?? 1024 * 1024)) {
116
+ stop('output_limit');
117
+ return;
118
+ }
119
+ bytes += part.length;
120
+ if (options.rawStdout)
121
+ chunks.push(part);
112
122
  else
113
- stdout += part;
123
+ stdout += outputDecoder.write(part);
114
124
  });
115
125
  // Drain but never report native stderr (it may contain message text/credentials).
116
126
  // Retain stderr only for allowlisted error classification. Never include it in CLI output.
117
127
  child.stderr.on('data', (part) => {
118
- bytes += part.length;
119
- if (stderr.length < 4096)
120
- stderr += part.toString('utf8').slice(0, 4096 - stderr.length);
121
- if (bytes > (options.limit ?? 1024 * 1024))
122
- stop();
128
+ // Protocol mode has an independent 4096-byte diagnostic budget. Excess
129
+ // diagnostics are drained without retaining them or invalidating stdout.
130
+ if (stderrBytes < 4096) {
131
+ const kept = part.subarray(0, 4096 - stderrBytes);
132
+ stderrBytes += kept.length;
133
+ stderr += diagnosticDecoder.write(kept);
134
+ }
135
+ if (!options.rawStdout) {
136
+ if (bytes + part.length > (options.limit ?? 1024 * 1024))
137
+ stop('output_limit');
138
+ else
139
+ bytes += part.length;
140
+ }
123
141
  });
124
- child.once('error', () => { interrupted = true; });
142
+ child.once('error', () => { interrupted = true; stopReason = 'process_error'; });
125
143
  // After a kill, the exit plus a short fixed grace bounds completion even if
126
144
  // a pipe never closes; otherwise 'close' (all output read) completes it.
127
145
  // A descendant that keeps the pipes open after the child exits runs into
@@ -1,5 +1,5 @@
1
- export declare const VERSION = "0.3.2";
2
- export declare const VERSION_LINE = "session-peer 0.3.2 (typescript)";
1
+ export declare const VERSION = "0.3.3";
2
+ export declare const VERSION_LINE = "session-peer 0.3.3 (typescript)";
3
3
  export declare function host(value: string): string;
4
4
  export declare function reply(value: string): {
5
5
  to: string;
package/dist/protocol.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { isIPv6 } from 'node:net';
2
2
  import { Refusal } from './discovery.js';
3
3
  import { uuid } from './writer.js';
4
- export const VERSION = '0.3.2';
4
+ export const VERSION = '0.3.3';
5
5
  export const VERSION_LINE = `session-peer ${VERSION} (typescript)`;
6
6
  // Return the OpenSSH destination: [user@]name, or an IPv6 literal with any
7
7
  // brackets removed (`ssh` does not strip `[...]` outside ssh:// URIs). Zone IDs
@@ -0,0 +1,10 @@
1
+ export type SkillCheck = {
2
+ status: string;
3
+ code: string;
4
+ verification?: 'metadata_only';
5
+ };
6
+ export declare const SKILL_METADATA_LIMIT = 65536;
7
+ export declare function validateSkillMetadata(text: string, runtime?: unknown): SkillCheck;
8
+ export declare function inspectSkill(original: string): SkillCheck & {
9
+ path: string;
10
+ };