@johnhenry/wsh 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnhenry/wsh",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Web Shell \u2014 browser-native remote command execution over WebTransport and WebSocket with Ed25519 authentication",
5
5
  "type": "module",
6
6
  "main": "./src/index.mjs",
package/src/index.d.ts CHANGED
@@ -127,9 +127,6 @@ export const MSG: {
127
127
  readonly REVERSE_ACCEPT: 0x54;
128
128
  readonly REVERSE_REJECT: 0x55;
129
129
 
130
- // Framing
131
- readonly WS_DATA: 0x60;
132
-
133
130
  // Gateway
134
131
  readonly OPEN_TCP: 0x70;
135
132
  readonly OPEN_UDP: 0x71;
package/src/index.mjs CHANGED
@@ -49,8 +49,8 @@ export {
49
49
  } from './auth.mjs';
50
50
 
51
51
  // Transport
52
- export { WshTransport, WebTransportTransport } from './transport.mjs';
53
- export { WebSocketTransport } from './transport-ws.mjs';
52
+ export { WshTransport, WebTransportTransport, dispatchSerially, SerialQueue } from './transport.mjs';
53
+ export { WebSocketTransport, WS_FRAME_TYPE } from './transport-ws.mjs';
54
54
 
55
55
  // Session + Client
56
56
  export { WshSession } from './session.mjs';
@@ -66,11 +66,6 @@ export const MSG = Object.freeze({
66
66
  // Session
67
67
  SESSION_LIST: 0x5f,
68
68
  DETACH: 0x60,
69
-
70
- // Framing
71
- WS_DATA: 0x60,
72
-
73
- // Session
74
69
  DETACH_OK: 0x61,
75
70
  DETACH_FAIL: 0x62,
76
71
 
@@ -20,19 +20,33 @@ import { WshTransport, dispatchSerially, SerialQueue } from './transport.mjs';
20
20
 
21
21
  // ── Frame type constants ─────────────────────────────────────────────
22
22
  //
23
- // NOTE: these are unrelated to MSG.WS_DATA (0x60) in messages.gen.mjs.
24
- // WS_DATA is a JS-only, CBOR-layer bookkeeping marker (it shares its
25
- // opcode with MSG.DETACH and is explicitly excluded from the Rust
26
- // message enum by spec/codegen.mjs) — it is never sent as the outer
27
- // envelope's frame-type byte below. See spec/wsh-v1.yaml's
28
- // `transport.websocket` section for the authoritative outer-envelope
29
- // framing docs.
23
+ // Unrelated to the CBOR-layer MSG opcodes (messages.gen.mjs) -- these are
24
+ // the outer envelope's frame-type byte. See spec/wsh-v1.yaml's
25
+ // `transport.websocket` section for the authoritative framing docs.
30
26
 
31
27
  const FRAME_CONTROL = 0x01;
32
28
  const FRAME_DATA = 0x02;
33
29
  const FRAME_OPEN_STREAM = 0x03;
34
30
  const FRAME_CLOSE_STREAM = 0x04;
35
31
 
32
+ /**
33
+ * The mux frame-type byte values, exported for anything outside this
34
+ * module that needs to name or inspect them correctly — tooling,
35
+ * logging, or an alternative from-scratch implementation of this
36
+ * transport in another runtime, which needs these exact wire values to
37
+ * interoperate. Not related to `MSG` (messages.gen.mjs): that's the
38
+ * CBOR-layer protocol-message opcode space carried *inside* a
39
+ * FRAME_CONTROL payload, a separate numbering space at a different
40
+ * layer of the stack. (An earlier, since-removed `MSG.WS_DATA` conflated
41
+ * the two and collided with a real MSG opcode — see CHANGELOG 0.6.0.)
42
+ */
43
+ export const WS_FRAME_TYPE = Object.freeze({
44
+ CONTROL: FRAME_CONTROL,
45
+ DATA: FRAME_DATA,
46
+ OPEN_STREAM: FRAME_OPEN_STREAM,
47
+ CLOSE_STREAM: FRAME_CLOSE_STREAM,
48
+ });
49
+
36
50
  // ── Header helpers ───────────────────────────────────────────────────
37
51
 
38
52
  const HEADER_SIZE = 5; // 1 byte type + 4 bytes stream ID