@omercnet/paseo-shared-browser 0.4.1 → 0.4.2-next.129.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.
@@ -1,46 +1,46 @@
1
- import { useMutation, useQuery } from "@tanstack/react-query";
2
1
  import {
3
2
  type PluginClientContext,
4
3
  type PluginWorkspacePanelProps,
5
4
  useRpc,
6
5
  } from "@getpaseo/plugin/client";
7
6
  import { Icon, Modal, ScrollView, TextInput } from "@getpaseo/plugin/client/react-native";
8
- import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
7
+ import { useMutation, useQuery } from "@tanstack/react-query";
8
+ import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from "react";
9
9
  import {
10
10
  ActivityIndicator,
11
+ type GestureResponderEvent,
11
12
  Image,
13
+ type LayoutChangeEvent,
12
14
  PanResponder,
13
15
  Pressable,
16
+ type StyleProp,
14
17
  StyleSheet,
15
18
  Text,
16
- View,
17
- type GestureResponderEvent,
18
- type LayoutChangeEvent,
19
- type StyleProp,
20
19
  type TextInputProps,
21
20
  type TextStyle,
21
+ View,
22
22
  type ViewStyle,
23
23
  } from "react-native";
24
24
  import {
25
- DEVICE_PRESETS,
26
- MAX_VIEWPORT,
27
- MIN_VIEWPORT,
28
25
  acquireControlRpc,
29
26
  applyDevicePresetRpc,
30
27
  attachBrowserRpc,
28
+ type BrowserFrame,
29
+ type BrowserInputEvent,
30
+ type BrowserState,
31
31
  captureBrowserRpc,
32
+ DEVICE_PRESETS,
33
+ type DevicePresetId,
32
34
  detachBrowserRpc,
35
+ didBrowserRuntimeRestart,
36
+ isBrowserStateCurrent,
33
37
  listOpenBrowserWorkspacesRpc,
38
+ MAX_VIEWPORT,
39
+ MIN_VIEWPORT,
34
40
  navigateBrowserRpc,
35
41
  releaseControlRpc,
36
42
  resizeBrowserRpc,
37
43
  sendBrowserInputRpc,
38
- didBrowserRuntimeRestart,
39
- isBrowserStateCurrent,
40
- type BrowserFrame,
41
- type BrowserInputEvent,
42
- type BrowserState,
43
- type DevicePresetId,
44
44
  } from "../shared/browser";
45
45
 
46
46
  const SPACE = {
package/index.client.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { PluginClientContext } from "@getpaseo/plugin/client";
2
- import { SharedBrowserPanel, contributeSharedBrowserClient } from "./client/browser";
2
+ import { contributeSharedBrowserClient, SharedBrowserPanel } from "./client/browser";
3
3
 
4
4
  export default function contribute(client: PluginClientContext) {
5
5
  client.addWorkspacePanel({
package/index.server.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { PluginServerContext } from "@getpaseo/plugin/server";
2
1
  import { randomBytes } from "node:crypto";
3
2
  import { homedir } from "node:os";
4
3
  import { join } from "node:path";
4
+ import type { PluginServerContext } from "@getpaseo/plugin/server";
5
5
  import {
6
6
  bindAgentTicket,
7
7
  cleanupBrowserServer,
@@ -94,6 +94,7 @@ export default function contribute(server: PluginServerContext) {
94
94
  env: {
95
95
  PASEO_HOME: paseoHome(),
96
96
  [TICKET_ENV]: ticket,
97
+ ELECTRON_RUN_AS_NODE: "1",
97
98
  },
98
99
  },
99
100
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omercnet/paseo-shared-browser",
3
- "version": "0.4.1",
3
+ "version": "0.4.2-next.129.1",
4
4
  "description": "One real Chromium session per Paseo workspace, shared live across every connected client.",
5
5
  "keywords": [
6
6
  "browser",
@@ -39,12 +39,14 @@
39
39
  },
40
40
  "scripts": {
41
41
  "typecheck": "tsc --noEmit",
42
- "lint": "oxlint --deny-warnings .",
43
- "format": "oxfmt --ignore-path .formatignore .",
44
- "format:check": "oxfmt --check --ignore-path .formatignore .",
45
42
  "prepare:runtime": "node scripts/prepare-runtime.mjs",
46
43
  "test:unit": "node --test scripts/prepare-dependencies.test.mjs && vitest run tests/contracts.test.ts tests/lease.test.ts tests/runtime-lifecycle.test.ts tests/agent-access.test.ts",
47
- "test:smoke": "vitest run tests/browser.smoke.test.ts --testTimeout=30000"
44
+ "test:smoke": "vitest run tests/browser.smoke.test.ts --testTimeout=30000",
45
+ "check": "biome check --error-on-warnings .",
46
+ "check:write": "biome check --write .",
47
+ "test": "run-s test:ci:*",
48
+ "test:ci:unit": "npm run test:unit",
49
+ "build": "node ../.github/scripts/build-plugin.mjs"
48
50
  },
49
51
  "dependencies": {
50
52
  "@getpaseo/plugin": "0.8.0",
@@ -54,12 +56,13 @@
54
56
  "zod": "4.4.3"
55
57
  },
56
58
  "devDependencies": {
59
+ "@biomejs/biome": "^2.5.14",
57
60
  "@getpaseo/plugin": "0.9.0-beta.1",
61
+ "@getpaseo/server": "0.9.0-beta.1",
58
62
  "@tanstack/react-query": "^5.90.11",
59
63
  "@types/node": "^22.0.0",
60
64
  "@types/react": "~19.2.0",
61
- "oxfmt": "0.66.0",
62
- "oxlint": "1.81.0",
65
+ "npm-run-all2": "^9.0.3",
63
66
  "react": "19.1.0",
64
67
  "react-native": "0.81.5",
65
68
  "typescript": "^7.0.0",
package/paseo-plugin.json CHANGED
@@ -3,8 +3,5 @@
3
3
  "requirements": {
4
4
  "paseo": "^0.8.0 || ^0.9.0-beta.1"
5
5
  },
6
- "build": [
7
- ["node", "scripts/prepare-dependencies.mjs"],
8
- ["npm", "run", "prepare:runtime"]
9
- ]
6
+ "build": [["node", "scripts/prepare-dependencies.mjs"], ["npm", "run", "prepare:runtime"]]
10
7
  }
@@ -1,6 +1,6 @@
1
- import { createRequire } from "node:module";
2
1
  import { execFileSync } from "node:child_process";
3
2
  import { existsSync } from "node:fs";
3
+ import { createRequire } from "node:module";
4
4
  import { dirname, join } from "node:path";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
6
6
 
@@ -1,6 +1,5 @@
1
- import { resolveDependencyRoot } from "./prepare-dependencies.mjs";
2
- import { build } from "esbuild";
3
1
  import { execFile } from "node:child_process";
2
+ import { constants } from "node:fs";
4
3
  import {
5
4
  access,
6
5
  chmod,
@@ -13,11 +12,12 @@ import {
13
12
  symlink,
14
13
  writeFile,
15
14
  } from "node:fs/promises";
16
- import { constants } from "node:fs";
17
15
  import { arch, homedir, platform, userInfo } from "node:os";
18
16
  import { dirname, join, resolve } from "node:path";
19
- import { promisify } from "node:util";
20
17
  import { fileURLToPath } from "node:url";
18
+ import { promisify } from "node:util";
19
+ import { build } from "esbuild";
20
+ import { resolveDependencyRoot } from "./prepare-dependencies.mjs";
21
21
 
22
22
  const execFileAsync = promisify(execFile);
23
23
  const expectedVersion = "0.37.1";
@@ -3,14 +3,14 @@ import { chmod, mkdir, readFile, rm } from "node:fs/promises";
3
3
  import { isAbsolute, resolve } from "node:path";
4
4
  import { promisify } from "node:util";
5
5
  import {
6
+ attachToTarget,
6
7
  CdpConnection,
7
- CdpSession,
8
+ type CdpEvent,
9
+ type CdpSession,
10
+ type CdpTarget,
8
11
  CdpUnavailableError,
9
12
  CdpUnknownOutcomeError,
10
- attachToTarget,
11
13
  listPageTargets,
12
- type CdpEvent,
13
- type CdpTarget,
14
14
  } from "./cdp";
15
15
 
16
16
  const execFileAsync = promisify(execFile);
@@ -164,9 +164,7 @@ function parseJsonOutput(stdout: string): unknown {
164
164
  for (const line of lines) {
165
165
  try {
166
166
  return JSON.parse(line);
167
- } catch {
168
- continue;
169
- }
167
+ } catch {}
170
168
  }
171
169
  throw new AgentBrowserIncompatibleError("agent-browser returned invalid JSON");
172
170
  }
@@ -508,9 +506,7 @@ export class AgentBrowserRuntime {
508
506
 
509
507
  async mouseMove(x: number, y: number): Promise<void> {
510
508
  this.assertPoint(x, y);
511
- await (
512
- await this.requirePage()
513
- ).send(
509
+ await (await this.requirePage()).send(
514
510
  "Input.dispatchMouseEvent",
515
511
  {
516
512
  type: "mouseMoved",
@@ -530,9 +526,7 @@ export class AgentBrowserRuntime {
530
526
  clickCount = 1,
531
527
  ): Promise<void> {
532
528
  this.assertPoint(x, y);
533
- await (
534
- await this.requirePage()
535
- ).send(
529
+ await (await this.requirePage()).send(
536
530
  "Input.dispatchMouseEvent",
537
531
  {
538
532
  type: "mousePressed",
@@ -549,9 +543,7 @@ export class AgentBrowserRuntime {
549
543
 
550
544
  async mouseUp(x: number, y: number, button: MouseButton = "left", clickCount = 1): Promise<void> {
551
545
  this.assertPoint(x, y);
552
- await (
553
- await this.requirePage()
554
- ).send(
546
+ await (await this.requirePage()).send(
555
547
  "Input.dispatchMouseEvent",
556
548
  {
557
549
  type: "mouseReleased",
@@ -568,9 +560,7 @@ export class AgentBrowserRuntime {
568
560
 
569
561
  async wheel(x: number, y: number, deltaX: number, deltaY: number): Promise<void> {
570
562
  this.assertPoint(x, y);
571
- await (
572
- await this.requirePage()
573
- ).send(
563
+ await (await this.requirePage()).send(
574
564
  "Input.dispatchMouseEvent",
575
565
  {
576
566
  type: "mouseWheel",
@@ -590,9 +580,7 @@ export class AgentBrowserRuntime {
590
580
  }
591
581
 
592
582
  async keyDown(key: string, code = key): Promise<void> {
593
- await (
594
- await this.requirePage()
595
- ).send(
583
+ await (await this.requirePage()).send(
596
584
  "Input.dispatchKeyEvent",
597
585
  {
598
586
  type: "keyDown",
@@ -606,9 +594,11 @@ export class AgentBrowserRuntime {
606
594
  }
607
595
 
608
596
  async keyUp(key: string, code = key): Promise<void> {
609
- await (
610
- await this.requirePage()
611
- ).send("Input.dispatchKeyEvent", { type: "keyUp", key, code }, { mutation: true });
597
+ await (await this.requirePage()).send(
598
+ "Input.dispatchKeyEvent",
599
+ { type: "keyUp", key, code },
600
+ { mutation: true },
601
+ );
612
602
  this.heldKeys.delete(key);
613
603
  }
614
604
 
@@ -617,9 +607,7 @@ export class AgentBrowserRuntime {
617
607
  points: Array<{ x: number; y: number; id?: number }>,
618
608
  ): Promise<void> {
619
609
  for (const point of points) this.assertPoint(point.x, point.y);
620
- await (
621
- await this.requirePage()
622
- ).send(
610
+ await (await this.requirePage()).send(
623
611
  "Input.dispatchTouchEvent",
624
612
  {
625
613
  type,
@@ -1,20 +1,20 @@
1
- import type { RpcInput } from "@getpaseo/plugin";
2
1
  import { randomBytes } from "node:crypto";
2
+ import type { RpcInput } from "@getpaseo/plugin";
3
3
  import {
4
- DEVICE_PRESETS,
4
+ type applyDevicePresetRpc,
5
+ type BrowserFrame,
6
+ type BrowserInputEvent,
7
+ type BrowserState,
5
8
  DEFAULT_VIEWPORT,
9
+ DEVICE_PRESETS,
10
+ type DevicePresetId,
6
11
  FRAME_MAX_BYTES,
7
12
  MAX_VIEWPORT,
8
13
  MIN_VIEWPORT,
9
14
  mapDisplayedPoint,
10
- applyDevicePresetRpc,
11
- navigateBrowserRpc,
12
- resizeBrowserRpc,
13
- sendBrowserInputRpc,
14
- type BrowserFrame,
15
- type BrowserInputEvent,
16
- type BrowserState,
17
- type DevicePresetId,
15
+ type navigateBrowserRpc,
16
+ type resizeBrowserRpc,
17
+ type sendBrowserInputRpc,
18
18
  type Viewport,
19
19
  } from "../shared/browser";
20
20
  import type { JsonValue } from "./runtime-protocol";
package/server/browser.ts CHANGED
@@ -1,11 +1,11 @@
1
- import type { RpcInput, RpcOutput } from "@getpaseo/plugin";
2
- import type { PluginHandlerContext } from "@getpaseo/plugin/server";
3
1
  import { spawn } from "node:child_process";
4
2
  import { randomUUID } from "node:crypto";
5
3
  import { access } from "node:fs/promises";
6
4
  import { homedir } from "node:os";
7
5
  import { join } from "node:path";
8
- import {
6
+ import type { RpcInput, RpcOutput } from "@getpaseo/plugin";
7
+ import type { PluginHandlerContext } from "@getpaseo/plugin/server";
8
+ import type {
9
9
  acquireControlRpc,
10
10
  applyDevicePresetRpc,
11
11
  attachBrowserRpc,
@@ -18,15 +18,15 @@ import {
18
18
  sendBrowserInputRpc,
19
19
  } from "../shared/browser";
20
20
  import type { JsonValue } from "./runtime-protocol";
21
- import { SupervisorClient } from "./supervisor-client";
22
21
  import { resolveSupervisorPaths } from "./supervisor";
22
+ import { SupervisorClient } from "./supervisor-client";
23
23
 
24
- export { SessionManager, normalizeBrowserUrl } from "./browser-policy";
25
24
  export type {
26
25
  BrowserRuntimeClient,
27
26
  SessionManagerOptions,
28
27
  WorkspaceValidator,
29
28
  } from "./browser-policy";
29
+ export { normalizeBrowserUrl, SessionManager } from "./browser-policy";
30
30
 
31
31
  type AttachInput = RpcInput<typeof attachBrowserRpc>;
32
32
  type AttachOutput = RpcOutput<typeof attachBrowserRpc>;
@@ -1,11 +1,11 @@
1
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
1
  import { homedir } from "node:os";
4
2
  import { join } from "node:path";
3
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
5
  import { z } from "zod";
6
6
  import type { JsonValue } from "./runtime-protocol";
7
- import { AgentSupervisorClient } from "./supervisor-client";
8
7
  import { resolveSupervisorPaths } from "./supervisor";
8
+ import { AgentSupervisorClient } from "./supervisor-client";
9
9
 
10
10
  const TICKET_ENV = "PASEO_SHARED_BROWSER_TICKET";
11
11
  const MIN_VIEWPORT = { width: 320, height: 480 } as const;
@@ -1,14 +1,14 @@
1
+ import { randomUUID } from "node:crypto";
1
2
  import { readFile, stat } from "node:fs/promises";
2
3
  import { createConnection, type Socket } from "node:net";
3
- import { randomUUID } from "node:crypto";
4
4
  import {
5
- RUNTIME_PROTOCOL_VERSION,
6
- RuntimeProtocolError,
7
- isRuntimeResponse,
8
5
  type AgentBrowserOperation,
9
6
  type BridgeLease,
7
+ isRuntimeResponse,
10
8
  type JsonValue,
9
+ RUNTIME_PROTOCOL_VERSION,
11
10
  type RuntimeDescriptor,
11
+ RuntimeProtocolError,
12
12
  type RuntimeRequest,
13
13
  type RuntimeResponse,
14
14
  type RuntimeResult,
@@ -7,15 +7,15 @@ import type { BrowserFrame, BrowserInputEvent, BrowserState, Viewport } from "..
7
7
  import { SessionManager } from "./browser-policy";
8
8
  import { CdpUnknownOutcomeError } from "./cdp";
9
9
  import {
10
+ type BridgeLease,
10
11
  DEFAULT_BRIDGE_HEARTBEAT_MS,
11
12
  DEFAULT_BRIDGE_TIMEOUT_MS,
12
13
  DEFAULT_ORPHAN_GRACE_MS,
13
- RUNTIME_PROTOCOL_VERSION,
14
- RuntimeProtocolError,
15
- parseRuntimeRequest,
16
- type BridgeLease,
17
14
  type JsonValue,
15
+ parseRuntimeRequest,
16
+ RUNTIME_PROTOCOL_VERSION,
18
17
  type RuntimeDescriptor,
18
+ RuntimeProtocolError,
19
19
  type RuntimeRequest,
20
20
  type RuntimeResponse,
21
21
  type RuntimeResult,