replicas-computer 0.2.15 → 0.3.1

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/viewer.js CHANGED
@@ -18,7 +18,6 @@ var requestBatch = intParam("requestBatch", 1, 1, 8);
18
18
  var inputRefresh = params.get("inputRefresh") === "1" || streamProfile === "tight";
19
19
  var optimisticScroll = params.get("optimisticScroll") === "1";
20
20
  var optimisticScrollMax = intParam("optimisticScrollMax", 220, 0, 720);
21
- var streamDiagnostics = params.get("diagnostics") === "1";
22
21
  var modernCursor = 'url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2724%27 height=%2724%27 viewBox=%270 0 24 24%27%3E%3Cpath d=%27M5 3.5l12.2 11.4-5.8.7 3.2 5.3-2.6 1.5-3.2-5.3-4.1 4.3z%27 fill=%27white%27 stroke=%27%2310161f%27 stroke-width=%272%27 stroke-linejoin=%27round%27/%3E%3C/svg%3E") 5 4, default';
23
22
  var wsUrl = `${location.protocol === "https:" ? "wss" : "ws"}://${location.host}/websockify`;
24
23
  var activeRfb = null;
@@ -121,14 +120,6 @@ var connect = () => {
121
120
  rfb.qualityLevel = intParam("quality", 8);
122
121
  }
123
122
  configureEncodings(rfb);
124
- if (streamDiagnostics) {
125
- const framebufferUpdate = rfb._framebufferUpdate.bind(rfb);
126
- rfb._framebufferUpdate = () => {
127
- const complete = framebufferUpdate();
128
- if (complete) window.dispatchEvent(new Event("replicasdesktopframe"));
129
- return complete;
130
- };
131
- }
132
123
  rfb.addEventListener("connect", () => {
133
124
  if (generation !== connectionGeneration) return;
134
125
  reconnectAttempt = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-computer",
3
- "version": "0.2.15",
3
+ "version": "0.3.1",
4
4
  "description": "Replicas workspace computer-use runtime",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -9,7 +9,10 @@
9
9
  },
10
10
  "files": [
11
11
  "dist",
12
- "assets"
12
+ "assets",
13
+ "scripts/build-webrtc.sh",
14
+ "patches/libdatachannel-dtls-bio.patch",
15
+ "patches/libdatachannel-nack-duplicates.patch"
13
16
  ],
14
17
  "scripts": {
15
18
  "build": "bun run typecheck && tsup",
@@ -35,6 +38,7 @@
35
38
  "@novnc/novnc": "1.7.0",
36
39
  "chalk": "^4.1.2",
37
40
  "commander": "^12.0.0",
41
+ "node-datachannel": "0.33.2",
38
42
  "ws": "8.21.2"
39
43
  },
40
44
  "devDependencies": {
@@ -0,0 +1,20 @@
1
+ diff --git a/src/impl/dtlstransport.cpp b/src/impl/dtlstransport.cpp
2
+ index 3a3a807..d5ce16d 100644
3
+ --- a/src/impl/dtlstransport.cpp
4
+ +++ b/src/impl/dtlstransport.cpp
5
+ @@ -948,4 +948,3 @@ void DtlsTransport::doRecv() {
6
+
7
+ - BIO_write(mInBio, message->data(), int(message->size()));
8
+ -
9
+ + bool incomingWritten = false;
10
+ if (state() == State::Connecting) {
11
+ @@ -955,2 +954,4 @@ void DtlsTransport::doRecv() {
12
+ std::lock_guard lock(mSslMutex);
13
+ + BIO_write(mInBio, message->data(), int(message->size()));
14
+ + incomingWritten = true;
15
+ ret = SSL_do_handshake(mSsl);
16
+ @@ -977,2 +978,4 @@ void DtlsTransport::doRecv() {
17
+ std::lock_guard lock(mSslMutex);
18
+ + if (!incomingWritten)
19
+ + BIO_write(mInBio, message->data(), int(message->size()));
20
+ ret = SSL_read(mSsl, buffer, bufferSize);
@@ -0,0 +1,13 @@
1
+ diff --git a/src/rtcpnackresponder.cpp b/src/rtcpnackresponder.cpp
2
+ index 4d810ff1..841ee0d6 100644
3
+ --- a/src/rtcpnackresponder.cpp
4
+ +++ b/src/rtcpnackresponder.cpp
5
+ @@ -86,6 +86,8 @@ void RtcpNackResponder::Storage::store(message_ptr packet) {
6
+ auto sequenceNumber = rtp->seqNumber();
7
+
8
+ std::lock_guard lock(mutex);
9
+ + if (storage.find(sequenceNumber) != storage.end())
10
+ + return;
11
+ assert((storage.empty() && !oldest && !newest) || (!storage.empty() && oldest && newest));
12
+
13
+ if (size() == 0) {
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ package_dir="$(cd -- "${1:?Pass the installed node-datachannel directory}" && pwd)"
5
+ script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
6
+ [[ "$(node -p 'require(process.argv[1]).version' "$package_dir/package.json")" == '0.33.2' ]]
7
+ build_root="$(mktemp -d)"
8
+ trap 'rm -rf -- "$build_root"' EXIT
9
+
10
+ cp "$package_dir/CMakeLists.txt" "$build_root/"
11
+ cp -R "$package_dir/src" "$build_root/src"
12
+ npm install --prefix "$build_root" --ignore-scripts --no-audit --no-fund \
13
+ node-addon-api@7.0.0 node-api-headers@1.4.0
14
+ source_dir="$build_root/build/_deps/libdatachannel-src"
15
+ git init -q "$source_dir"
16
+ git -C "$source_dir" remote add origin https://github.com/paullouisageneau/libdatachannel.git
17
+ git -C "$source_dir" fetch --depth 1 origin c6696d157b5612df2a741d9a03b192b47ab6cefb
18
+ git -C "$source_dir" checkout -q --detach FETCH_HEAD
19
+ git -C "$source_dir" submodule update --init --recursive --depth 1
20
+ git -C "$source_dir" apply "$script_dir/../patches/libdatachannel-dtls-bio.patch"
21
+ git -C "$source_dir" apply "$script_dir/../patches/libdatachannel-nack-duplicates.patch"
22
+
23
+ cmake -S "$build_root" -B "$build_root/build" -G Ninja \
24
+ -DCMAKE_BUILD_TYPE=Release \
25
+ -DFETCHCONTENT_SOURCE_DIR_LIBDATACHANNEL="$source_dir" \
26
+ -DNO_TESTS=ON -DNO_EXAMPLES=ON
27
+ cmake --build "$build_root/build" --target node_datachannel -j 2
28
+ node -e 'const binding = require(process.argv[1]); if (binding.getLibraryVersion() !== "0.24.3") throw new Error("Unexpected libdatachannel version"); binding.cleanup();' \
29
+ "$build_root/build/node_datachannel.node"
30
+ install -D -m 755 "$build_root/build/node_datachannel.node" "$package_dir/build/node_datachannel.node.next"
31
+ mv "$package_dir/build/node_datachannel.node.next" "$package_dir/build/node_datachannel.node"