@rstreamlabs/webtty 1.6.2 → 1.6.4
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/dist/index.js +18 -10
- package/dist/index.mjs +18 -10
- package/package.json +7 -5
package/dist/index.js
CHANGED
|
@@ -1881,6 +1881,12 @@ var rstream = $root.rstream = (() => {
|
|
|
1881
1881
|
})();
|
|
1882
1882
|
|
|
1883
1883
|
// src/webtty.ts
|
|
1884
|
+
function getErrorMessage(error) {
|
|
1885
|
+
return error instanceof Error ? error.message : String(error);
|
|
1886
|
+
}
|
|
1887
|
+
function getWebSocketPayload(payload) {
|
|
1888
|
+
return new Uint8Array(payload);
|
|
1889
|
+
}
|
|
1884
1890
|
var WebTTY = class {
|
|
1885
1891
|
ws = null;
|
|
1886
1892
|
connectionState = "preparing";
|
|
@@ -1897,15 +1903,17 @@ var WebTTY = class {
|
|
|
1897
1903
|
*/
|
|
1898
1904
|
constructor(clientConfig, execConfig, events) {
|
|
1899
1905
|
this.clientConfig = {
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1906
|
+
heartbeatIntervalMs: clientConfig.heartbeatIntervalMs ?? 5e3,
|
|
1907
|
+
sendHeartbeat: clientConfig.sendHeartbeat ?? true,
|
|
1908
|
+
url: clientConfig.url
|
|
1903
1909
|
};
|
|
1904
1910
|
this.execConfig = {
|
|
1905
|
-
allocateTty: true,
|
|
1906
|
-
|
|
1907
|
-
envVars: [],
|
|
1908
|
-
|
|
1911
|
+
allocateTty: execConfig?.allocateTty ?? true,
|
|
1912
|
+
cmdArgs: execConfig?.cmdArgs,
|
|
1913
|
+
envVars: execConfig?.envVars ?? [],
|
|
1914
|
+
interactive: execConfig?.interactive ?? true,
|
|
1915
|
+
username: execConfig?.username,
|
|
1916
|
+
workdir: execConfig?.workdir
|
|
1909
1917
|
};
|
|
1910
1918
|
this.events = events || {};
|
|
1911
1919
|
}
|
|
@@ -2077,8 +2085,8 @@ var WebTTY = class {
|
|
|
2077
2085
|
this.close("Unexpected data message.");
|
|
2078
2086
|
}
|
|
2079
2087
|
}
|
|
2080
|
-
} catch (
|
|
2081
|
-
this.close(`Failed to decode message: ${
|
|
2088
|
+
} catch (error) {
|
|
2089
|
+
this.close(`Failed to decode message: ${getErrorMessage(error)}`);
|
|
2082
2090
|
}
|
|
2083
2091
|
};
|
|
2084
2092
|
handleClose = () => {
|
|
@@ -2103,7 +2111,7 @@ var WebTTY = class {
|
|
|
2103
2111
|
if (this.connectionState === "preparing" || this.connectionState === "closed")
|
|
2104
2112
|
return;
|
|
2105
2113
|
const buffer = rstream.webtty.protobuf.Message.encode(message).finish();
|
|
2106
|
-
this.ws.send(buffer);
|
|
2114
|
+
this.ws.send(getWebSocketPayload(buffer));
|
|
2107
2115
|
}
|
|
2108
2116
|
/**
|
|
2109
2117
|
* Closes the WebTTY session and fires exactly one of:
|
package/dist/index.mjs
CHANGED
|
@@ -1845,6 +1845,12 @@ var rstream = $root.rstream = (() => {
|
|
|
1845
1845
|
})();
|
|
1846
1846
|
|
|
1847
1847
|
// src/webtty.ts
|
|
1848
|
+
function getErrorMessage(error) {
|
|
1849
|
+
return error instanceof Error ? error.message : String(error);
|
|
1850
|
+
}
|
|
1851
|
+
function getWebSocketPayload(payload) {
|
|
1852
|
+
return new Uint8Array(payload);
|
|
1853
|
+
}
|
|
1848
1854
|
var WebTTY = class {
|
|
1849
1855
|
ws = null;
|
|
1850
1856
|
connectionState = "preparing";
|
|
@@ -1861,15 +1867,17 @@ var WebTTY = class {
|
|
|
1861
1867
|
*/
|
|
1862
1868
|
constructor(clientConfig, execConfig, events) {
|
|
1863
1869
|
this.clientConfig = {
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1870
|
+
heartbeatIntervalMs: clientConfig.heartbeatIntervalMs ?? 5e3,
|
|
1871
|
+
sendHeartbeat: clientConfig.sendHeartbeat ?? true,
|
|
1872
|
+
url: clientConfig.url
|
|
1867
1873
|
};
|
|
1868
1874
|
this.execConfig = {
|
|
1869
|
-
allocateTty: true,
|
|
1870
|
-
|
|
1871
|
-
envVars: [],
|
|
1872
|
-
|
|
1875
|
+
allocateTty: execConfig?.allocateTty ?? true,
|
|
1876
|
+
cmdArgs: execConfig?.cmdArgs,
|
|
1877
|
+
envVars: execConfig?.envVars ?? [],
|
|
1878
|
+
interactive: execConfig?.interactive ?? true,
|
|
1879
|
+
username: execConfig?.username,
|
|
1880
|
+
workdir: execConfig?.workdir
|
|
1873
1881
|
};
|
|
1874
1882
|
this.events = events || {};
|
|
1875
1883
|
}
|
|
@@ -2041,8 +2049,8 @@ var WebTTY = class {
|
|
|
2041
2049
|
this.close("Unexpected data message.");
|
|
2042
2050
|
}
|
|
2043
2051
|
}
|
|
2044
|
-
} catch (
|
|
2045
|
-
this.close(`Failed to decode message: ${
|
|
2052
|
+
} catch (error) {
|
|
2053
|
+
this.close(`Failed to decode message: ${getErrorMessage(error)}`);
|
|
2046
2054
|
}
|
|
2047
2055
|
};
|
|
2048
2056
|
handleClose = () => {
|
|
@@ -2067,7 +2075,7 @@ var WebTTY = class {
|
|
|
2067
2075
|
if (this.connectionState === "preparing" || this.connectionState === "closed")
|
|
2068
2076
|
return;
|
|
2069
2077
|
const buffer = rstream.webtty.protobuf.Message.encode(message).finish();
|
|
2070
|
-
this.ws.send(buffer);
|
|
2078
|
+
this.ws.send(getWebSocketPayload(buffer));
|
|
2071
2079
|
}
|
|
2072
2080
|
/**
|
|
2073
2081
|
* Closes the WebTTY session and fires exactly one of:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstreamlabs/webtty",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"description": "Client-side implementation of the rstream WebTTY protocol.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,20 +16,22 @@
|
|
|
16
16
|
"clean": "rm -rf .generated && rm -rf dist",
|
|
17
17
|
"generate-proto-files": "bash scripts/generate-proto-files.sh",
|
|
18
18
|
"lint": "eslint \"./**/*.ts*\"",
|
|
19
|
+
"pretest": "npm run generate-proto-files && npm run build",
|
|
20
|
+
"test": "node --test ./test/**/*.test.cjs",
|
|
19
21
|
"type-check": "tsc --noEmit"
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|
|
22
|
-
"@turbo/gen": "^2.
|
|
24
|
+
"@turbo/gen": "^2.9.5",
|
|
23
25
|
"@types/node": "^25",
|
|
24
26
|
"eslint-config": "*",
|
|
25
|
-
"eslint": "9.39.
|
|
26
|
-
"protobufjs-cli": "^2.0.
|
|
27
|
+
"eslint": "9.39.4",
|
|
28
|
+
"protobufjs-cli": "^2.0.1",
|
|
27
29
|
"tsup": "^8.5.1",
|
|
28
30
|
"typescript-config": "*",
|
|
29
31
|
"typescript": "5.9.3"
|
|
30
32
|
},
|
|
31
33
|
"dependencies": {
|
|
32
|
-
"protobufjs": "^
|
|
34
|
+
"protobufjs": "^8.0.1"
|
|
33
35
|
},
|
|
34
36
|
"publishConfig": {
|
|
35
37
|
"access": "public"
|