@rstreamlabs/webtty 1.12.1 → 1.12.2

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
@@ -1,6 +1,6 @@
1
1
  # `@rstreamlabs/webtty`
2
2
 
3
- Browser-side client for the rstream WebTTY protocol.
3
+ WebTTY is rstream's remote terminal and command-execution protocol. A server runs on the remote machine and an operator connects through the CLI or a browser. This package implements the browser client so an application can exchange terminal input/output and track process completion.
4
4
 
5
5
  Use this package when you need to connect a web application to a WebTTY server
6
6
  over WebSocket or WebTransport. It handles the protobuf session handshake,
@@ -52,18 +52,6 @@ webtty.connect();
52
52
 
53
53
  ## Interactive Sessions
54
54
 
55
- Connection failures are delivered once through `onError`, including normal
56
- WebTransport closure before the stream opens. Disconnecting also releases a
57
- stream that becomes available after the opening was cancelled. A normal close
58
- after opening still drains buffered output before reporting the session result.
59
-
60
- Error messages redact values from the configured endpoint's query parameters,
61
- userinfo and fragment, including their common URL-encoded forms. Avoid logging
62
- the endpoint separately. An identifiable browser `SecurityError` points to
63
- browser policy and `connect-src`; an empty browser error reports that diagnostic
64
- details are unavailable. Such an error does not establish that CSP is the cause.
65
- Invalid endpoint configuration still throws synchronously without echoing the URL.
66
-
67
55
  For an interactive terminal, write encoded input to stdin and forward terminal
68
56
  resize events.
69
57
 
@@ -86,6 +74,20 @@ Call `closeStdin()` to send EOF, or `disconnect()` to release the reader.
86
74
  For an Engine-managed detached execution, releasing the reader leaves the
87
75
  command running within its original execution budget.
88
76
 
77
+ ## Connection failures and diagnostics
78
+
79
+ Connection failures are delivered once through `onError`, including normal
80
+ WebTransport closure before the stream opens. Disconnecting also releases a
81
+ stream that becomes available after the opening was cancelled. A normal close
82
+ after opening still drains buffered output before reporting the session result.
83
+
84
+ Error messages redact values from the configured endpoint's query parameters,
85
+ userinfo and fragment, including their common URL-encoded forms. Avoid logging
86
+ the endpoint separately. An identifiable browser `SecurityError` points to
87
+ browser policy and `connect-src`; an empty browser error reports that diagnostic
88
+ details are unavailable. Such an error does not establish that CSP is the cause.
89
+ Invalid endpoint configuration still throws synchronously without echoing the URL.
90
+
89
91
  ## Execute Commands
90
92
 
91
93
  For non-interactive agent workflows, use `runWebTTYCommand` or
@@ -217,9 +219,8 @@ grant is obtained from the control-plane API, then sent as the first protobuf
217
219
  message on the terminal stream. Terminal input and output stay on the WebTTY
218
220
  data path. The Engine participant stream uses WebSocket, including when the
219
221
  original execution used WebTransport. Check the session's `live.attachable`
220
- state before requesting an Attach grant; older Engines can support fewer
221
- combinations. WebTransport Attach encoding in the SDK alone does not establish
222
- Engine participant-stream support.
222
+ state before requesting an Attach grant and use its advertised participant
223
+ transport.
223
224
 
224
225
  ```ts
225
226
  import { WebTTY } from "@rstreamlabs/webtty";
@@ -293,7 +294,7 @@ const files = await fs.list("/");
293
294
  const compose = await fs.readText("/compose.yaml");
294
295
  const stream = await fs.readStream("/large.log");
295
296
 
296
- await fs.writeFile("/notes/codex.txt", "checked by Codex\n");
297
+ await fs.writeFile("/notes/status.txt", "Ready\n");
297
298
  ```
298
299
 
299
300
  When the WebTTY server is discovered through `@rstreamlabs/tunnels`, pass the
@@ -366,12 +367,10 @@ const result = await runWebTTYCommand(
366
367
  This uses HTTP/1.1 WebSocket with normal TLS verification, a 10-second handshake
367
368
  deadline, a 1-second close deadline and the configured `maxMessageSize` limit.
368
369
  It works independently of the global WebSocket implementation and does not
369
- modify other clients or browser bundles. The same option applies to `WebTTY`,
370
- `openWebTTYCommand` and `WebTTYRemoteExecutor`. WebTransport still requires a
371
- runtime that provides it; selecting it never falls back silently to WebSocket.
372
- Node 26.7's experimental HTTP/2 WebSocket handshake rejects a conforming
373
- [RFC 8441 endpoint](https://www.rfc-editor.org/rfc/rfc8441.html#section-5);
374
- the Node factory avoids that runtime-specific failure.
370
+ modify other clients or browser bundles. The same option is accepted by
371
+ `WebTTY`, `runWebTTYCommand`, `openWebTTYCommand` and `WebTTYRemoteExecutor`.
372
+ Choose WebTransport explicitly when the runtime and endpoint support it;
373
+ transport selection preserves the requested protocol.
375
374
 
376
375
  Use WebTransport when the endpoint is published over HTTP/3 WebTransport:
377
376
 
@@ -558,6 +557,9 @@ Browser WebTTY sessions should use short-lived tokens scoped to the specific
558
557
  tunnel and path. Do not embed personal access tokens or application credentials
559
558
  in frontend code.
560
559
 
560
+ The [Node transport dependency baseline](docs/000-dependencies.md) explains the
561
+ qualified `ws` version and bounded automatic Pong behavior.
562
+
561
563
  ## Development
562
564
 
563
565
  ```sh
@@ -11169,6 +11169,7 @@ async function resolveURL(url) {
11169
11169
  }
11170
11170
  function clientConfig(config, url, execPath) {
11171
11171
  return {
11172
+ webSocketFactory: config.webSocketFactory,
11172
11173
  heartbeatIntervalMs: config.heartbeatIntervalMs,
11173
11174
  managed: config.managed,
11174
11175
  sendHeartbeat: config.sendHeartbeat,
package/dist/index.d.mts CHANGED
@@ -5452,6 +5452,7 @@ type WebTTYURLProvider = string | URL | (() => Promise<string | URL> | string |
5452
5452
  type WebTTYCommandOutput = "both" | "stderr" | "stdout";
5453
5453
  type WebTTYCommandStream = "stderr" | "stdout";
5454
5454
  interface WebTTYRemoteExecutorConfig {
5455
+ webSocketFactory?: WebTTYWebSocketFactory;
5455
5456
  execPath?: string;
5456
5457
  managed?: WebTTYManagedSessionConfig;
5457
5458
  heartbeatIntervalMs?: number;
package/dist/index.d.ts CHANGED
@@ -5452,6 +5452,7 @@ type WebTTYURLProvider = string | URL | (() => Promise<string | URL> | string |
5452
5452
  type WebTTYCommandOutput = "both" | "stderr" | "stdout";
5453
5453
  type WebTTYCommandStream = "stderr" | "stdout";
5454
5454
  interface WebTTYRemoteExecutorConfig {
5455
+ webSocketFactory?: WebTTYWebSocketFactory;
5455
5456
  execPath?: string;
5456
5457
  managed?: WebTTYManagedSessionConfig;
5457
5458
  heartbeatIntervalMs?: number;
package/dist/index.js CHANGED
@@ -11245,6 +11245,7 @@ async function resolveURL(url) {
11245
11245
  }
11246
11246
  function clientConfig(config, url, execPath) {
11247
11247
  return {
11248
+ webSocketFactory: config.webSocketFactory,
11248
11249
  heartbeatIntervalMs: config.heartbeatIntervalMs,
11249
11250
  managed: config.managed,
11250
11251
  sendHeartbeat: config.sendHeartbeat,
package/dist/index.mjs CHANGED
@@ -40,7 +40,7 @@ import {
40
40
  webTTYRecordedEventEncryptedPayload,
41
41
  webTTYServerProofTranscriptBytes,
42
42
  webTTYSigningKeyID
43
- } from "./chunk-V7EU2JPX.mjs";
43
+ } from "./chunk-BSMXY5EO.mjs";
44
44
  export {
45
45
  WebTTY,
46
46
  WebTTYCommand,
package/dist/node.js CHANGED
@@ -11251,6 +11251,7 @@ async function resolveURL(url) {
11251
11251
  }
11252
11252
  function clientConfig(config, url, execPath) {
11253
11253
  return {
11254
+ webSocketFactory: config.webSocketFactory,
11254
11255
  heartbeatIntervalMs: config.heartbeatIntervalMs,
11255
11256
  managed: config.managed,
11256
11257
  sendHeartbeat: config.sendHeartbeat,
package/dist/node.mjs CHANGED
@@ -40,7 +40,7 @@ import {
40
40
  webTTYRecordedEventEncryptedPayload,
41
41
  webTTYServerProofTranscriptBytes,
42
42
  webTTYSigningKeyID
43
- } from "./chunk-V7EU2JPX.mjs";
43
+ } from "./chunk-BSMXY5EO.mjs";
44
44
 
45
45
  // src/local-e2e.ts
46
46
  var localKeyFileVersion = 1;
@@ -6,15 +6,15 @@
6
6
  "type": "module",
7
7
  "dependencies": {
8
8
  "@rstreamlabs/webtty": "file:../..",
9
- "dotenv": "^17.4.2"
9
+ "dotenv": "^18.0.10"
10
10
  },
11
11
  "scripts": {
12
12
  "start": "tsx src/main.ts",
13
13
  "type-check": "tsc --noEmit"
14
14
  },
15
15
  "devDependencies": {
16
- "@types/node": "^26",
17
- "tsx": "^4.23.1",
16
+ "@types/node": "^26.6.6",
17
+ "tsx": "^4.23.15",
18
18
  "typescript": "7.0.2"
19
19
  }
20
20
  }
@@ -9,3 +9,18 @@ cp .env.local.example .env.local
9
9
  npm install
10
10
  npm start
11
11
  ```
12
+
13
+ Use Node.js 24 and npm from this directory after building the monorepo. The Node
14
+ entry point supplies `nodeWebSocketFactory`, so it uses the qualified HTTP/1.1
15
+ WebSocket transport with certificate verification. Set `NODE_EXTRA_CA_CERTS`
16
+ before starting the process when the endpoint uses a private CA. The two commands
17
+ print collected output and then three streamed ticks. The remote server must
18
+ permit these commands and satisfy any endpoint/E2E trust policy; the sample does
19
+ not create a server or mint its URL grant.
20
+
21
+ After installation, run `npm run type-check` to check the sample against the
22
+ package types. From the monorepo root after building,
23
+ `node --test packages/webtty/test/remote-command-example.test.cjs` runs this
24
+ entrypoint against a synthetic TLS/WebSocket server without relying on a global
25
+ WebSocket. It verifies both commands and the selected HTTP/1.1 transport; it does
26
+ not execute a shell on a real host.
@@ -6,15 +6,15 @@
6
6
  "type": "module",
7
7
  "dependencies": {
8
8
  "@rstreamlabs/webtty": "file:../..",
9
- "dotenv": "^17.4.2"
9
+ "dotenv": "^18.0.10"
10
10
  },
11
11
  "scripts": {
12
12
  "start": "tsx src/main.ts",
13
13
  "type-check": "tsc --noEmit"
14
14
  },
15
15
  "devDependencies": {
16
- "@types/node": "^26",
17
- "tsx": "^4.23.1",
16
+ "@types/node": "^26.6.6",
17
+ "tsx": "^4.23.15",
18
18
  "typescript": "7.0.2"
19
19
  }
20
20
  }
@@ -1,7 +1,8 @@
1
1
  // See LICENSE file in the project root for license information.
2
2
 
3
3
  import dotenv from "dotenv";
4
- import { WebTTYRemoteExecutor } from "@rstreamlabs/webtty";
4
+ import { WebTTYRemoteExecutor } from "@rstreamlabs/webtty/node";
5
+ import { nodeWebSocketFactory } from "@rstreamlabs/webtty/node";
5
6
 
6
7
  dotenv.config({ path: ".env.local" });
7
8
 
@@ -14,6 +15,7 @@ function env(name: string): string {
14
15
  async function main(): Promise<void> {
15
16
  const executor = new WebTTYRemoteExecutor({
16
17
  url: env("RSTREAM_WEBTTY_URL"),
18
+ webSocketFactory: nodeWebSocketFactory,
17
19
  });
18
20
  const result = await executor.runCommand("sh", ["-lc", "uname -a && pwd"], {
19
21
  timeoutMs: 30_000,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstreamlabs/webtty",
3
- "version": "1.12.1",
3
+ "version": "1.12.2",
4
4
  "description": "Client-side implementation of the rstream WebTTY protocol.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,20 +41,20 @@
41
41
  "type-check": "tsc --noEmit"
42
42
  },
43
43
  "devDependencies": {
44
- "@turbo/gen": "^2.10.11",
45
- "@types/node": "^26",
46
- "@types/ws": "^8.18.1",
44
+ "@turbo/gen": "^2.11.11",
45
+ "@types/node": "^26.6.6",
46
+ "@types/ws": "^8.18.2",
47
47
  "eslint": "9.39.5",
48
48
  "eslint-config": "*",
49
- "protobufjs-cli": "^2.6.2",
49
+ "protobufjs-cli": "^2.7.1",
50
50
  "tsup": "^8.5.1",
51
51
  "typescript": "6.0.3",
52
52
  "typescript-config": "*"
53
53
  },
54
54
  "dependencies": {
55
- "protobufjs": "^8.7.2",
56
- "ws": "^8.21.3",
57
- "@rstreamlabs/filesystem": "^0.3.0"
55
+ "protobufjs": "^8.8.1",
56
+ "ws": "^8.23.0",
57
+ "@rstreamlabs/filesystem": "^0.3.2"
58
58
  },
59
59
  "publishConfig": {
60
60
  "access": "public"