replicas-computer 0.3.19 → 0.3.20

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
@@ -37,7 +37,7 @@ The viewer exposes `?view=fit|native|pixel` (letterboxed, one source pixel per C
37
37
 
38
38
  WebRTC receiver timings use one-second counter differences: `decodeMs` is decode time per decoded frame; `receiverProcessingMs` runs from the first received packet to the decoded frame and already includes buffering and decoding. Neither measures physical display latency. Unsupported counters, counter resets and windows without decoded frames leave these fields absent. The timings appear in diagnostics, `__replicasDesktop` and per-viewer telemetry. See the [WebRTC stats definitions](https://www.w3.org/TR/webrtc-stats/#dom-rtcinboundrtpstreamstats-totalprocessingdelay).
39
39
 
40
- The server records every decision that changes the picture (viewer connects and transport fallbacks with their reason, WebRTC state changes, quality rung moves with the signals that voted for them, encoder swaps, preset changes and keyframe requests) and writes each to the stream log (`/tmp/replicas-computer/stream.log`). `GET /telemetry` returns the `/health` snapshot plus the last 200 events and five minutes of one-second samples (encoder rung, CRF, cap, keyframe interval, preset, fps and kbps; CPU; per-viewer transport, ICE path, pacer counters, socket backlog and the viewer's own reported stats). Fetch it inside the sandbox with `curl -s localhost:6080/telemetry` or through the authenticated preview URL; the dashboard's stream settings menu has **Open stream telemetry**. `REPLICAS_DESKTOP_STREAM_TELEMETRY=1` also writes every sample to the stream log for sessions longer than the in-memory history.
40
+ The server records every decision that changes the picture (viewer connects and transport fallbacks with their reason, WebRTC state changes, quality rung moves with the signals that voted for them, encoder swaps, preset changes and keyframe requests) and writes each to the stream log (`/tmp/replicas-computer/stream.log`). `GET /telemetry` returns the `/health` snapshot plus the last 200 events and five minutes of one-second samples (encoder rung, CRF, cap, keyframe interval, preset, fps and kbps; CPU; per-viewer transport, ICE path, pacer counters, socket backlog and the viewer's own reported stats). Fetch it inside the sandbox with `curl -s localhost:6080/telemetry` or through the authenticated preview URL; the dashboard's stream settings menu has **Open stream telemetry**. `GET /snapshot` returns one 768px JPEG of the current screen; the chat's computer-use tile loads it as a preview of the desktop. `REPLICAS_DESKTOP_STREAM_TELEMETRY=1` also writes every sample to the stream log for sessions longer than the in-memory history.
41
41
 
42
42
  | Variable | Default | Meaning |
43
43
  |---|---|---|
package/dist/index.js CHANGED
@@ -2932,7 +2932,7 @@ async function computerStatusCommand() {
2932
2932
  }
2933
2933
 
2934
2934
  // src/version.ts
2935
- var COMPUTER_USE_VERSION = "0.3.19";
2935
+ var COMPUTER_USE_VERSION = "0.3.20";
2936
2936
  var COMPUTER_USE_PROTOCOL_VERSION = 1;
2937
2937
 
2938
2938
  // src/program.ts
@@ -5412,6 +5412,44 @@ async function runMediaServer() {
5412
5412
  }));
5413
5413
  return;
5414
5414
  }
5415
+ if (url.pathname === "/snapshot") {
5416
+ const capture = spawn5("ffmpeg", [
5417
+ "-hide_banner",
5418
+ "-loglevel",
5419
+ "error",
5420
+ "-f",
5421
+ "x11grab",
5422
+ "-draw_mouse",
5423
+ "0",
5424
+ "-video_size",
5425
+ `${width}x${height}`,
5426
+ "-i",
5427
+ `${display}.0`,
5428
+ "-frames:v",
5429
+ "1",
5430
+ "-vf",
5431
+ "scale=768:-2",
5432
+ "-q:v",
5433
+ "4",
5434
+ "-f",
5435
+ "mjpeg",
5436
+ "pipe:1"
5437
+ ], { env: { ...process.env, DISPLAY: display }, stdio: ["ignore", "pipe", "ignore"] });
5438
+ const chunks = [];
5439
+ capture.stdout.on("data", (chunk) => chunks.push(chunk));
5440
+ capture.on("error", () => void 0);
5441
+ capture.on("close", (code) => {
5442
+ response.setHeader("cache-control", "no-store");
5443
+ if (code !== 0 || chunks.length === 0) {
5444
+ response.statusCode = 503;
5445
+ response.end("Snapshot unavailable");
5446
+ return;
5447
+ }
5448
+ response.setHeader("content-type", "image/jpeg");
5449
+ response.end(Buffer.concat(chunks));
5450
+ });
5451
+ return;
5452
+ }
5415
5453
  const requested = url.pathname === "/" ? "stream-index.html" : url.pathname.slice(1);
5416
5454
  const path = resolve3(webroot, requested);
5417
5455
  if (!path.startsWith(resolve3(webroot) + "/") || !existsSync7(path) || !statSync2(path).isFile()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-computer",
3
- "version": "0.3.19",
3
+ "version": "0.3.20",
4
4
  "description": "Replicas workspace computer-use runtime",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",