@omercnet/paseo-shared-browser 4.1.1-next.338.1 → 4.1.1-next.354.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.
@@ -12,7 +12,7 @@
12
12
  "@modelcontextprotocol/sdk": "1.30.0",
13
13
  "agent-browser": "0.39.4",
14
14
  "esbuild": "0.28.2",
15
- "zod": "4.4.3"
15
+ "zod": "4.6.6"
16
16
  }
17
17
  },
18
18
  "node_modules/@agentclientprotocol/sdk": {
@@ -1874,9 +1874,9 @@
1874
1874
  "license": "ISC"
1875
1875
  },
1876
1876
  "node_modules/ws": {
1877
- "version": "8.22.0",
1878
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.22.0.tgz",
1879
- "integrity": "sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg==",
1877
+ "version": "8.22.1",
1878
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.22.1.tgz",
1879
+ "integrity": "sha512-oyL6OPYme/CmiFvNuGzeoxCJ4nOrZE2O1FwM9MWM1AsGri6nLXB2pg+lNA8aLeXMSav0J6eIVS1j6vUPzUtK9g==",
1880
1880
  "license": "MIT",
1881
1881
  "peer": true,
1882
1882
  "engines": {
@@ -1896,9 +1896,9 @@
1896
1896
  }
1897
1897
  },
1898
1898
  "node_modules/zod": {
1899
- "version": "4.4.3",
1900
- "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz",
1901
- "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==",
1899
+ "version": "4.6.6",
1900
+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.6.tgz",
1901
+ "integrity": "sha512-4UmzQUF5fxvfcYHlbjBmejU+w+hbDnWFx4aS8kBx7nPBHcO2SqPbpAG8snbdg+Xse4pRefR98hgjFgIMCI/UhA==",
1902
1902
  "license": "MIT",
1903
1903
  "funding": {
1904
1904
  "url": "https://github.com/sponsors/colinhacks"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omercnet/paseo-shared-browser",
3
- "version": "4.1.1-next.338.1",
3
+ "version": "4.1.1-next.354.1",
4
4
  "description": "One real Chromium session per Paseo workspace, shared live across every connected client.",
5
5
  "keywords": [
6
6
  "browser",
@@ -59,7 +59,7 @@
59
59
  "@modelcontextprotocol/sdk": "1.30.0",
60
60
  "agent-browser": "0.39.4",
61
61
  "esbuild": "0.28.2",
62
- "zod": "4.4.3"
62
+ "zod": "4.6.6"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@biomejs/biome": "^2.5.10",
@@ -1,10 +1,12 @@
1
- import { execFileSync } from "node:child_process";
1
+ import { execSync } from "node:child_process";
2
2
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
3
3
  import { createRequire } from "node:module";
4
4
  import { dirname, join } from "node:path";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
6
6
 
7
7
  const projectRoot = dirname(dirname(fileURLToPath(import.meta.url)));
8
+ // Run through the shell so Windows resolves npm.cmd: Node refuses to spawn .cmd files without one.
9
+ const INSTALL_COMMAND = "npm ci --omit=dev --ignore-scripts --workspaces=false";
8
10
 
9
11
  function loadRootCatalog(root) {
10
12
  for (let directory = root; ; directory = dirname(directory)) {
@@ -28,6 +30,8 @@ function stageManifest(root, catalog, install) {
28
30
  manifest.dependencies[name] = catalog[name];
29
31
  }
30
32
  delete manifest.devDependencies;
33
+ // npm-shrinkwrap.json is generated without overrides, so npm ci rejects a manifest that keeps them.
34
+ delete manifest.overrides;
31
35
 
32
36
  writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
33
37
  try {
@@ -41,18 +45,11 @@ export function resolveDependencyRoot(packageName, from = import.meta.url) {
41
45
  return dirname(createRequire(from).resolve(`${packageName}/package.json`));
42
46
  }
43
47
 
44
- export function prepareDependencies(root = projectRoot, execute = execFileSync) {
48
+ export function prepareDependencies(root = projectRoot, execute = execSync) {
45
49
  const catalog = loadRootCatalog(root);
46
50
  if (!catalog) return false;
47
51
  stageManifest(root, catalog, () => {
48
- execute(
49
- process.platform === "win32" ? "npm.cmd" : "npm",
50
- ["ci", "--omit=dev", "--ignore-scripts", "--workspaces=false"],
51
- {
52
- cwd: root,
53
- stdio: "inherit",
54
- },
55
- );
52
+ execute(INSTALL_COMMAND, { cwd: root, stdio: "inherit" });
56
53
  });
57
54
  return true;
58
55
  }
@@ -17,7 +17,7 @@ async function fixture(failFirstEncoder = false) {
17
17
  }),
18
18
  cancel: async () => deliver({ done: true }),
19
19
  };
20
- const pending: { timestamp: number; type: string }[] = [];
20
+ const pending: { timestamp: number; type: string; queued: boolean }[] = [];
21
21
  const encoded: { timestamp: number; keyFrame: boolean }[] = [];
22
22
  let encoder: Encoder;
23
23
  const instances: Encoder[] = [];
@@ -37,14 +37,31 @@ async function fixture(failFirstEncoder = false) {
37
37
  if (failFirstEncoder && this === instances[0]) throw new Error("Codec stopped");
38
38
  this.encodeQueueSize++;
39
39
  encoded.push({ timestamp: frame.timestamp, keyFrame: options.keyFrame });
40
- pending.push({ timestamp: frame.timestamp, type: options.keyFrame ? "key" : "delta" });
40
+ pending.push({
41
+ timestamp: frame.timestamp,
42
+ type: options.keyFrame ? "key" : "delta",
43
+ queued: true,
44
+ });
45
+ }
46
+ /** WebCodecs lowers encodeQueueSize once the codec starts a frame, before its output. */
47
+ dequeue() {
48
+ const value = pending.find((entry) => entry.queued);
49
+ if (!value) throw new Error("No queued fixture frame");
50
+ value.queued = false;
51
+ this.encodeQueueSize--;
41
52
  }
53
+ /** Emits in submission order, as an in-order realtime codec does. */
42
54
  output() {
43
55
  const value = pending.shift();
44
56
  if (!value) throw new Error("No queued fixture frame");
45
- this.encodeQueueSize--;
57
+ if (value.queued) this.encodeQueueSize--;
46
58
  this.callbacks.output(
47
- { ...value, byteLength: 10, copyTo: (bytes: Uint8Array) => bytes.fill(1) },
59
+ {
60
+ timestamp: value.timestamp,
61
+ type: value.type,
62
+ byteLength: 10,
63
+ copyTo: (bytes: Uint8Array) => bytes.fill(1),
64
+ },
48
65
  {},
49
66
  );
50
67
  }
@@ -94,6 +111,7 @@ async function fixture(failFirstEncoder = false) {
94
111
  await turn();
95
112
  },
96
113
  output: () => encoder!.output(),
114
+ dequeue: () => encoder!.dequeue(),
97
115
  ack: () =>
98
116
  runInContext(
99
117
  'for(const p of fixturePackets) acknowledge("stream",p.sequence)',
@@ -189,6 +207,28 @@ it("still suppresses dependencies after an actual encoded output is dropped", as
189
207
  }
190
208
  });
191
209
 
210
+ it("emits outputs from a codec that lags further behind than its dequeued queue size", async () => {
211
+ const f = await fixture();
212
+ try {
213
+ const timestamps = [0, 33334, 66668, 100002, 133336, 166670];
214
+ for (const timestamp of timestamps) {
215
+ await f.frame(timestamp);
216
+ f.dequeue();
217
+ }
218
+ expect(f.encoded).toHaveLength(timestamps.length);
219
+ for (const _ of timestamps) {
220
+ f.output();
221
+ f.ack();
222
+ }
223
+ expect(f.packets.map((p) => [p.timestampUs, p.type])).toEqual(
224
+ timestamps.map((timestamp, index) => [timestamp, index ? "delta" : "key"]),
225
+ );
226
+ expect(f.encoded.filter((e) => e.keyFrame)).toHaveLength(1);
227
+ } finally {
228
+ await f.stop();
229
+ }
230
+ });
231
+
192
232
  it("shipped packet conversion is exact with native and legacy byte APIs", () => {
193
233
  for (const native of [true, false]) {
194
234
  const context = createContext({
@@ -132,7 +132,12 @@ async function startCapture(targetId, width, height, generation) {
132
132
  continue;
133
133
  state.lastEncodedTimestampUs = frame.timestamp;
134
134
  state.frameGenerations.set(frame.timestamp, current.generation);
135
- while (state.frameGenerations.size > 4)
135
+ // encodeQueueSize drops when the codec dequeues a frame, not when it
136
+ // outputs, so a slow encode keeps more frames in flight than the gate
137
+ // above admits. Bound by one second at the 60fps ceiling, the host's
138
+ // packet age limit, so an in-flight output keeps its generation
139
+ // for as long as the host would still accept it.
140
+ while (state.frameGenerations.size > 60)
136
141
  state.frameGenerations.delete(state.frameGenerations.keys().next().value);
137
142
  const keyFrame =
138
143
  state.forceKey || frame.timestamp - state.lastKeyTimestamp >= 1000000;