@omercnet/paseo-shared-browser 4.1.11 → 4.1.12-next.504.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/README.md +16 -5
- package/STREAMING_DESIGN.md +4 -1
- package/client/browser-input-queue.test.ts +104 -1
- package/client/browser-input-queue.ts +56 -1
- package/client/browser-resolution-picker.tsx +44 -0
- package/client/browser-viewer-recovery.test.ts +69 -0
- package/client/browser-viewer-recovery.ts +41 -2
- package/client/browser.tsx +64 -6
- package/client/use-browser-canvas-input.ts +1 -0
- package/client/use-browser-video.test.ts +22 -0
- package/client/use-browser-video.ts +14 -1
- package/index.server.ts +9 -0
- package/npm-shrinkwrap.json +119 -6
- package/package.json +3 -2
- package/scripts/agent-browser-native.mjs +94 -0
- package/scripts/prepare-runtime.mjs +14 -17
- package/server/agent-browser-runtime.ts +1 -1
- package/server/browser-gesture.ts +10 -0
- package/server/browser-policy.ts +147 -26
- package/server/browser.ts +36 -0
- package/server/live-input-policy.test.ts +71 -0
- package/server/runtime-launch-environment.test.ts +1 -1
- package/server/runtime-owner.ts +10 -2
- package/server/runtime-video-opt-in.test.ts +1 -1
- package/server/stale-wheel-admission.test.ts +1 -0
- package/server/supervisor.ts +55 -1
- package/server/video-preference.test.ts +331 -0
- package/server/video-preference.ts +51 -0
- package/shared/browser.ts +31 -0
|
@@ -172,6 +172,7 @@ function setup(retainDocumentDisplay = false) {
|
|
|
172
172
|
let active = true;
|
|
173
173
|
let bitrate: 2_000_000 | 5_000_000 | 12_000_000 | 24_000_000 = 12_000_000;
|
|
174
174
|
let fps: 15 | 30 | 60 = 30;
|
|
175
|
+
let hostVideoEnabled: boolean | undefined;
|
|
175
176
|
const environment: BrowserVideoDecodeEnvironment = {
|
|
176
177
|
createDecoder(callbacks) {
|
|
177
178
|
return {
|
|
@@ -211,6 +212,7 @@ function setup(retainDocumentDisplay = false) {
|
|
|
211
212
|
active,
|
|
212
213
|
bitrate,
|
|
213
214
|
fps,
|
|
215
|
+
...(hostVideoEnabled === undefined ? {} : { hostVideoEnabled }),
|
|
214
216
|
epoch: () => mutationEpoch,
|
|
215
217
|
viewport: () => ({ width: 1280, height: 800 }),
|
|
216
218
|
// The mounted panel's real source predicate, fed a fake panel context, so a drift
|
|
@@ -276,6 +278,9 @@ function setup(retainDocumentDisplay = false) {
|
|
|
276
278
|
active(value: boolean) {
|
|
277
279
|
active = value;
|
|
278
280
|
},
|
|
281
|
+
hostVideo(value: boolean) {
|
|
282
|
+
hostVideoEnabled = value;
|
|
283
|
+
},
|
|
279
284
|
token(value: string) {
|
|
280
285
|
viewerToken = value;
|
|
281
286
|
},
|
|
@@ -602,6 +607,23 @@ describe("video presentation lifecycle", () => {
|
|
|
602
607
|
await vi.advanceTimersByTimeAsync(10_000);
|
|
603
608
|
expect(harness.reads).toHaveLength(1);
|
|
604
609
|
});
|
|
610
|
+
it("resumes reading after the host turns video on, without a new viewer or reload", async () => {
|
|
611
|
+
const f = setup();
|
|
612
|
+
f.disabled(0);
|
|
613
|
+
await drain();
|
|
614
|
+
f.render();
|
|
615
|
+
f.commit();
|
|
616
|
+
await vi.advanceTimersByTimeAsync(10_000);
|
|
617
|
+
const stopped = harness.reads.length;
|
|
618
|
+
f.hostVideo(true);
|
|
619
|
+
f.render();
|
|
620
|
+
f.commit();
|
|
621
|
+
await drain();
|
|
622
|
+
expect(stopped).toBe(1);
|
|
623
|
+
expect(harness.reads).toHaveLength(2);
|
|
624
|
+
expect(harness.reads.at(-1)!.input.viewerToken).toBe(harness.reads[0]!.input.viewerToken);
|
|
625
|
+
expect(harness.disposals).toBeGreaterThanOrEqual(1);
|
|
626
|
+
});
|
|
605
627
|
it("hidden/unmounted viewers cancel the capacity retry timer and cannot restart background reads", async () => {
|
|
606
628
|
const f = setup();
|
|
607
629
|
f.capacity(0);
|
|
@@ -30,6 +30,11 @@ interface BrowserVideoOptions {
|
|
|
30
30
|
fps?: import("../shared/video-settings").VideoEncoderSettings["fps"];
|
|
31
31
|
/** Explicit host panel suspension, when supplied. Unmount also stops decoding. */
|
|
32
32
|
active?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The host's effective encoded-video setting, when known. A change restarts reading,
|
|
35
|
+
* so turning video on resumes it after a "video-disabled" stop without a reload.
|
|
36
|
+
*/
|
|
37
|
+
hostVideoEnabled?: boolean;
|
|
33
38
|
epoch(): number;
|
|
34
39
|
viewport(): Viewport | null;
|
|
35
40
|
isCurrent(packet: BrowserVideoPacket, epoch: number): boolean;
|
|
@@ -454,7 +459,15 @@ export function useBrowserVideo(options: BrowserVideoOptions) {
|
|
|
454
459
|
runningCleanup?.();
|
|
455
460
|
runningCleanup = null;
|
|
456
461
|
};
|
|
457
|
-
}, [
|
|
462
|
+
}, [
|
|
463
|
+
node,
|
|
464
|
+
options.viewerToken,
|
|
465
|
+
options.quality,
|
|
466
|
+
options.active,
|
|
467
|
+
options.bitrate,
|
|
468
|
+
options.fps,
|
|
469
|
+
options.hostVideoEnabled,
|
|
470
|
+
]);
|
|
458
471
|
|
|
459
472
|
return {
|
|
460
473
|
active,
|
package/index.server.ts
CHANGED
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
handleCreateBrowserTab,
|
|
16
16
|
handleDetachBrowser,
|
|
17
17
|
handleEndBrowserGesture,
|
|
18
|
+
handleGetBrowserVideoSettings,
|
|
19
|
+
handleKeepAliveBrowserGesture,
|
|
18
20
|
handleListBrowserTabs,
|
|
19
21
|
handleListOpenBrowserWorkspaces,
|
|
20
22
|
handleNavigateBrowser,
|
|
@@ -23,6 +25,7 @@ import {
|
|
|
23
25
|
handleReopenBrowser,
|
|
24
26
|
handleResizeBrowser,
|
|
25
27
|
handleSendBrowserInput,
|
|
28
|
+
handleSetBrowserVideoSettings,
|
|
26
29
|
handleSetCaptureDensity,
|
|
27
30
|
handleUpdateBrowserGesture,
|
|
28
31
|
handleWorkspaceArchived,
|
|
@@ -41,6 +44,8 @@ import {
|
|
|
41
44
|
createBrowserTabRpc,
|
|
42
45
|
detachBrowserRpc,
|
|
43
46
|
endBrowserGestureRpc,
|
|
47
|
+
getBrowserVideoSettingsRpc,
|
|
48
|
+
keepAliveBrowserGestureRpc,
|
|
44
49
|
listBrowserTabsRpc,
|
|
45
50
|
listOpenBrowserWorkspacesRpc,
|
|
46
51
|
navigateBrowserRpc,
|
|
@@ -48,6 +53,7 @@ import {
|
|
|
48
53
|
reopenBrowserRpc,
|
|
49
54
|
resizeBrowserRpc,
|
|
50
55
|
sendBrowserInputRpc,
|
|
56
|
+
setBrowserVideoSettingsRpc,
|
|
51
57
|
setCaptureDensityRpc,
|
|
52
58
|
updateBrowserGestureRpc,
|
|
53
59
|
} from "./shared/browser";
|
|
@@ -105,6 +111,9 @@ export default function contribute(server: PluginServerContext) {
|
|
|
105
111
|
server.handle(beginBrowserGestureRpc, handleBeginBrowserGesture);
|
|
106
112
|
server.handle(updateBrowserGestureRpc, handleUpdateBrowserGesture);
|
|
107
113
|
server.handle(endBrowserGestureRpc, handleEndBrowserGesture);
|
|
114
|
+
server.handle(keepAliveBrowserGestureRpc, handleKeepAliveBrowserGesture);
|
|
115
|
+
server.handle(getBrowserVideoSettingsRpc, handleGetBrowserVideoSettings);
|
|
116
|
+
server.handle(setBrowserVideoSettingsRpc, handleSetBrowserVideoSettings);
|
|
108
117
|
server.handle(navigateBrowserRpc, handleNavigateBrowser);
|
|
109
118
|
server.handle(resizeBrowserRpc, handleResizeBrowser);
|
|
110
119
|
server.handle(applyDevicePresetRpc, handleApplyDevicePreset);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,20 +1,124 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omercnet/paseo-shared-browser",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.12",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@omercnet/paseo-shared-browser",
|
|
9
|
-
"version": "4.1.
|
|
9
|
+
"version": "4.1.12",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@getpaseo/plugin": "0.16.0-beta.2",
|
|
12
12
|
"@modelcontextprotocol/sdk": "1.32.2",
|
|
13
|
-
"agent-browser": "0.
|
|
13
|
+
"agent-browser": "0.43.0",
|
|
14
14
|
"esbuild": "0.28.2",
|
|
15
15
|
"zod": "4.6.7"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
+
"node_modules/@agent-browser/cli-darwin-arm64": {
|
|
19
|
+
"version": "0.43.0",
|
|
20
|
+
"resolved": "https://registry.npmjs.org/@agent-browser/cli-darwin-arm64/-/cli-darwin-arm64-0.43.0.tgz",
|
|
21
|
+
"integrity": "sha512-HV6GP59IjNnowlrXR/5rVM8msPWwQDEONt/tWC8STzUfKZQHKZI/Iv9sf2h2ZhwK8xwoqLhxpf+KxcFgJ0sExQ==",
|
|
22
|
+
"cpu": [
|
|
23
|
+
"arm64"
|
|
24
|
+
],
|
|
25
|
+
"license": "Apache-2.0",
|
|
26
|
+
"optional": true,
|
|
27
|
+
"os": [
|
|
28
|
+
"darwin"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"node_modules/@agent-browser/cli-darwin-x64": {
|
|
32
|
+
"version": "0.43.0",
|
|
33
|
+
"resolved": "https://registry.npmjs.org/@agent-browser/cli-darwin-x64/-/cli-darwin-x64-0.43.0.tgz",
|
|
34
|
+
"integrity": "sha512-3NKnKFOWLYDYTz4bJxo4jt+GwjM4VtcW5FDrQY35eUrytig65FEDdXmXKuRbZGq9jEEWxh6rmpS4R6xS53XCaw==",
|
|
35
|
+
"cpu": [
|
|
36
|
+
"x64"
|
|
37
|
+
],
|
|
38
|
+
"license": "Apache-2.0",
|
|
39
|
+
"optional": true,
|
|
40
|
+
"os": [
|
|
41
|
+
"darwin"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"node_modules/@agent-browser/cli-linux-arm64-gnu": {
|
|
45
|
+
"version": "0.43.0",
|
|
46
|
+
"resolved": "https://registry.npmjs.org/@agent-browser/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-0.43.0.tgz",
|
|
47
|
+
"integrity": "sha512-8DC234LGlXCn8A2YXGk6woy1uTjyexvtHd/TOQHLrV2sfUMZD647HTHEJyF+2z1J1oR34LaB5jqHJ9d0REC+Cw==",
|
|
48
|
+
"cpu": [
|
|
49
|
+
"arm64"
|
|
50
|
+
],
|
|
51
|
+
"libc": [
|
|
52
|
+
"glibc"
|
|
53
|
+
],
|
|
54
|
+
"license": "Apache-2.0",
|
|
55
|
+
"optional": true,
|
|
56
|
+
"os": [
|
|
57
|
+
"linux"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"node_modules/@agent-browser/cli-linux-arm64-musl": {
|
|
61
|
+
"version": "0.43.0",
|
|
62
|
+
"resolved": "https://registry.npmjs.org/@agent-browser/cli-linux-arm64-musl/-/cli-linux-arm64-musl-0.43.0.tgz",
|
|
63
|
+
"integrity": "sha512-/dYeGX2E1lWZ25q1IZSVs6PaPmr0GmhHU8z/LtCh0anHN4ND50i5fOPbysRBaE8iQCBY74h+1R2kePfEqD7X4Q==",
|
|
64
|
+
"cpu": [
|
|
65
|
+
"arm64"
|
|
66
|
+
],
|
|
67
|
+
"libc": [
|
|
68
|
+
"musl"
|
|
69
|
+
],
|
|
70
|
+
"license": "Apache-2.0",
|
|
71
|
+
"optional": true,
|
|
72
|
+
"os": [
|
|
73
|
+
"linux"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"node_modules/@agent-browser/cli-linux-x64-gnu": {
|
|
77
|
+
"version": "0.43.0",
|
|
78
|
+
"resolved": "https://registry.npmjs.org/@agent-browser/cli-linux-x64-gnu/-/cli-linux-x64-gnu-0.43.0.tgz",
|
|
79
|
+
"integrity": "sha512-WY8vy2Saa3oRt6XEmz4Sae1W5qS9TjYcbX6IE+dxb8s2APfL9XyQjMHC6jBZrhwqDBIvUeTMCT/P2cq3XLPSBw==",
|
|
80
|
+
"cpu": [
|
|
81
|
+
"x64"
|
|
82
|
+
],
|
|
83
|
+
"libc": [
|
|
84
|
+
"glibc"
|
|
85
|
+
],
|
|
86
|
+
"license": "Apache-2.0",
|
|
87
|
+
"optional": true,
|
|
88
|
+
"os": [
|
|
89
|
+
"linux"
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"node_modules/@agent-browser/cli-linux-x64-musl": {
|
|
93
|
+
"version": "0.43.0",
|
|
94
|
+
"resolved": "https://registry.npmjs.org/@agent-browser/cli-linux-x64-musl/-/cli-linux-x64-musl-0.43.0.tgz",
|
|
95
|
+
"integrity": "sha512-WpCI0cIaVIVj4trdduDmW90h51BAP5Nhx6lALOqHjUhOOae/TkLL4bK8gJfjPb/nOp2FRjsF1l77f6rVwkpsug==",
|
|
96
|
+
"cpu": [
|
|
97
|
+
"x64"
|
|
98
|
+
],
|
|
99
|
+
"libc": [
|
|
100
|
+
"musl"
|
|
101
|
+
],
|
|
102
|
+
"license": "Apache-2.0",
|
|
103
|
+
"optional": true,
|
|
104
|
+
"os": [
|
|
105
|
+
"linux"
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
"node_modules/@agent-browser/cli-win32-x64-msvc": {
|
|
109
|
+
"version": "0.43.0",
|
|
110
|
+
"resolved": "https://registry.npmjs.org/@agent-browser/cli-win32-x64-msvc/-/cli-win32-x64-msvc-0.43.0.tgz",
|
|
111
|
+
"integrity": "sha512-xhk8wnHk3aiBFSR0pd1Ye3ay2jKjgRardgBJLiB9nXJv0ZkbeP/wh3X7jMiKUfUGE1qqJrKdaM5szQ6iz8/8+w==",
|
|
112
|
+
"cpu": [
|
|
113
|
+
"x64",
|
|
114
|
+
"arm64"
|
|
115
|
+
],
|
|
116
|
+
"license": "Apache-2.0",
|
|
117
|
+
"optional": true,
|
|
118
|
+
"os": [
|
|
119
|
+
"win32"
|
|
120
|
+
]
|
|
121
|
+
},
|
|
18
122
|
"node_modules/@agentclientprotocol/sdk": {
|
|
19
123
|
"version": "1.9.0",
|
|
20
124
|
"resolved": "https://registry.npmjs.org/@agentclientprotocol/sdk/-/sdk-1.9.0.tgz",
|
|
@@ -610,9 +714,9 @@
|
|
|
610
714
|
}
|
|
611
715
|
},
|
|
612
716
|
"node_modules/agent-browser": {
|
|
613
|
-
"version": "0.
|
|
614
|
-
"resolved": "https://registry.npmjs.org/agent-browser/-/agent-browser-0.
|
|
615
|
-
"integrity": "sha512-
|
|
717
|
+
"version": "0.43.0",
|
|
718
|
+
"resolved": "https://registry.npmjs.org/agent-browser/-/agent-browser-0.43.0.tgz",
|
|
719
|
+
"integrity": "sha512-TExwnZAW39fUBDJhUPrw8KKGmcjzBo7FxNqoP2/usHG1ODsjGI2jAWq3+Q6I5JYyBMjePFEsj8KGB68mALtglA==",
|
|
616
720
|
"hasInstallScript": true,
|
|
617
721
|
"license": "Apache-2.0",
|
|
618
722
|
"bin": {
|
|
@@ -620,6 +724,15 @@
|
|
|
620
724
|
},
|
|
621
725
|
"engines": {
|
|
622
726
|
"node": ">=22.0.0"
|
|
727
|
+
},
|
|
728
|
+
"optionalDependencies": {
|
|
729
|
+
"@agent-browser/cli-darwin-arm64": "0.43.0",
|
|
730
|
+
"@agent-browser/cli-darwin-x64": "0.43.0",
|
|
731
|
+
"@agent-browser/cli-linux-arm64-gnu": "0.43.0",
|
|
732
|
+
"@agent-browser/cli-linux-arm64-musl": "0.43.0",
|
|
733
|
+
"@agent-browser/cli-linux-x64-gnu": "0.43.0",
|
|
734
|
+
"@agent-browser/cli-linux-x64-musl": "0.43.0",
|
|
735
|
+
"@agent-browser/cli-win32-x64-msvc": "0.43.0"
|
|
623
736
|
}
|
|
624
737
|
},
|
|
625
738
|
"node_modules/ajv": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omercnet/paseo-shared-browser",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.12-next.504.1",
|
|
4
4
|
"description": "One real Chromium session per Paseo workspace, shared live across every connected client.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"browser",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"index.client.tsx",
|
|
30
30
|
"index.server.ts",
|
|
31
31
|
"client",
|
|
32
|
+
"scripts/agent-browser-native.mjs",
|
|
32
33
|
"scripts/chromium-release.mjs",
|
|
33
34
|
"scripts/prepare-dependencies.mjs",
|
|
34
35
|
"scripts/prepare-runtime.mjs",
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
"dependencies": {
|
|
59
60
|
"@getpaseo/plugin": "0.16.0-beta.2",
|
|
60
61
|
"@modelcontextprotocol/sdk": "1.32.2",
|
|
61
|
-
"agent-browser": "0.
|
|
62
|
+
"agent-browser": "0.43.0",
|
|
62
63
|
"esbuild": "0.28.2",
|
|
63
64
|
"zod": "4.6.7"
|
|
64
65
|
},
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { chmod, cp, readFile } from "node:fs/promises";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Detects the C library the way agent-browser's own launcher does
|
|
8
|
+
* (scripts/native.js hostLibc), so the staged platform package is the one it
|
|
9
|
+
* looks up at run time.
|
|
10
|
+
*/
|
|
11
|
+
export function hostLibc() {
|
|
12
|
+
if (process.platform !== "linux") return null;
|
|
13
|
+
process.report.excludeNetwork = true;
|
|
14
|
+
const report = process.report.getReport();
|
|
15
|
+
if (report.header.glibcVersionRuntime) return "glibc";
|
|
16
|
+
if (report.sharedObjects.some((path) => /(?:^|\/)ld-musl-|libc\.musl-/.test(path))) return "musl";
|
|
17
|
+
const loaderArch = process.arch === "arm64" ? "aarch64" : "x86_64";
|
|
18
|
+
return existsSync(`/lib/ld-musl-${loaderArch}.so.1`) ? "musl" : "glibc";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Names the optional dependency that carries the native agent-browser binary
|
|
23
|
+
* for a host, mirroring agent-browser's nativeTarget(). Windows ARM64 runs the
|
|
24
|
+
* x64 build through emulation.
|
|
25
|
+
*/
|
|
26
|
+
export function agentBrowserPlatformPackage(os, cpu, libc) {
|
|
27
|
+
const archKey = cpu === "x64" || cpu === "arm64" ? cpu : null;
|
|
28
|
+
if (!archKey) return null;
|
|
29
|
+
switch (os) {
|
|
30
|
+
case "darwin":
|
|
31
|
+
return { name: `@agent-browser/cli-darwin-${archKey}`, file: "agent-browser" };
|
|
32
|
+
case "linux":
|
|
33
|
+
return {
|
|
34
|
+
name: `@agent-browser/cli-linux-${archKey}-${libc === "musl" ? "musl" : "gnu"}`,
|
|
35
|
+
file: "agent-browser",
|
|
36
|
+
};
|
|
37
|
+
case "win32":
|
|
38
|
+
return { name: "@agent-browser/cli-win32-x64-msvc", file: "agent-browser.exe" };
|
|
39
|
+
default:
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Copies agent-browser and the host's platform package into runtimeModules,
|
|
46
|
+
* side by side, which is the layout agent-browser's launcher resolves the
|
|
47
|
+
* native binary from. The platform package is found from the installed
|
|
48
|
+
* agent-browser, so hoisted, nested and isolated (Bun) layouts all work.
|
|
49
|
+
* Returns the staged native binary.
|
|
50
|
+
*/
|
|
51
|
+
export async function stageAgentBrowserPackages({
|
|
52
|
+
agentBrowserRoot,
|
|
53
|
+
runtimeModules,
|
|
54
|
+
version,
|
|
55
|
+
os = process.platform,
|
|
56
|
+
cpu = process.arch,
|
|
57
|
+
libc = os === "linux" ? hostLibc() : null,
|
|
58
|
+
}) {
|
|
59
|
+
const target = agentBrowserPlatformPackage(os, cpu, libc);
|
|
60
|
+
if (!target) throw new Error(`Unsupported agent-browser platform: ${os}-${cpu}`);
|
|
61
|
+
|
|
62
|
+
let manifestPath;
|
|
63
|
+
try {
|
|
64
|
+
manifestPath = createRequire(join(agentBrowserRoot, "package.json")).resolve(
|
|
65
|
+
`${target.name}/package.json`,
|
|
66
|
+
);
|
|
67
|
+
} catch {
|
|
68
|
+
throw new Error(
|
|
69
|
+
`agent-browser ${version} needs its optional dependency ${target.name}, which is not installed. ` +
|
|
70
|
+
"Reinstall the plugin dependencies without omitting optional packages.",
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
74
|
+
if (manifest.name !== target.name || manifest.version !== version) {
|
|
75
|
+
throw new Error(
|
|
76
|
+
`Expected ${target.name} ${version}, found ${manifest.name ?? "unknown"} ${manifest.version ?? "unknown"} at ${manifestPath}`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
const packageRoot = dirname(manifestPath);
|
|
80
|
+
if (!existsSync(join(packageRoot, "bin", target.file))) {
|
|
81
|
+
throw new Error(`${target.name} ${version} has no bin/${target.file}`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
await cp(agentBrowserRoot, join(runtimeModules, "agent-browser"), {
|
|
85
|
+
recursive: true,
|
|
86
|
+
force: true,
|
|
87
|
+
});
|
|
88
|
+
const stagedPackage = join(runtimeModules, ...target.name.split("/"));
|
|
89
|
+
await cp(packageRoot, stagedPackage, { recursive: true, force: true });
|
|
90
|
+
const binary = join(stagedPackage, "bin", target.file);
|
|
91
|
+
// Package managers do not always keep the execute bit; the staged copy is ours to fix.
|
|
92
|
+
if (os !== "win32") await chmod(binary, 0o700);
|
|
93
|
+
return binary;
|
|
94
|
+
}
|
|
@@ -4,10 +4,11 @@ import { constants } from "node:fs";
|
|
|
4
4
|
import { access, chmod, cp, lstat, mkdir, readdir, rm, symlink, writeFile } from "node:fs/promises";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { arch, homedir, platform } from "node:os";
|
|
7
|
-
import { dirname, join, resolve } from "node:path";
|
|
7
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
9
|
import { promisify } from "node:util";
|
|
10
10
|
import { build } from "esbuild";
|
|
11
|
+
import { stageAgentBrowserPackages } from "./agent-browser-native.mjs";
|
|
11
12
|
import { installChromiumRelease } from "./chromium-release.mjs";
|
|
12
13
|
import { discardRuntime, replaceRuntime } from "./replace-runtime.mjs";
|
|
13
14
|
|
|
@@ -19,7 +20,7 @@ function resolveDependencyRoot(packageName) {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
const execFileAsync = promisify(execFile);
|
|
22
|
-
const expectedVersion = "0.
|
|
23
|
+
const expectedVersion = "0.43.0";
|
|
23
24
|
const hostPlatform = platform();
|
|
24
25
|
const hostArch = arch();
|
|
25
26
|
const projectRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
@@ -187,19 +188,14 @@ async function installChromium() {
|
|
|
187
188
|
return runtimeChromiumEntry;
|
|
188
189
|
}
|
|
189
190
|
|
|
190
|
-
|
|
191
|
+
// The entry runs the native binary directly through a relative link, so the runtime stays
|
|
192
|
+
// relocatable. The agent-browser.js launcher would rewrite .bin/agent-browser to an absolute
|
|
193
|
+
// path on its first run.
|
|
194
|
+
async function stageAgentBrowserEntry(nativeBinary) {
|
|
191
195
|
if (hostPlatform === "win32") {
|
|
192
|
-
|
|
193
|
-
if (executableArch !== "x64") {
|
|
194
|
-
throw new Error(`Unsupported agent-browser Windows architecture: ${hostArch}`);
|
|
195
|
-
}
|
|
196
|
-
await cp(
|
|
197
|
-
join(packagedAgentBrowser, "bin", `agent-browser-win32-${executableArch}.exe`),
|
|
198
|
-
runtimeEntry,
|
|
199
|
-
{ force: true },
|
|
200
|
-
);
|
|
196
|
+
await cp(nativeBinary, runtimeEntry, { force: true });
|
|
201
197
|
} else {
|
|
202
|
-
await symlink(
|
|
198
|
+
await symlink(relative(dirname(runtimeEntry), nativeBinary), runtimeEntry);
|
|
203
199
|
}
|
|
204
200
|
await chmod(runtimeEntry, 0o700);
|
|
205
201
|
}
|
|
@@ -208,11 +204,12 @@ await rm(stagingRoot, { recursive: true, force: true });
|
|
|
208
204
|
try {
|
|
209
205
|
await mkdir(join(runtimeModules, ".bin"), { recursive: true, mode: 0o700 });
|
|
210
206
|
await chmod(pluginDataRoot, 0o700);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
207
|
+
const nativeBinary = await stageAgentBrowserPackages({
|
|
208
|
+
agentBrowserRoot: packagedAgentBrowser,
|
|
209
|
+
runtimeModules,
|
|
210
|
+
version: expectedVersion,
|
|
214
211
|
});
|
|
215
|
-
await stageAgentBrowserEntry();
|
|
212
|
+
await stageAgentBrowserEntry(nativeBinary);
|
|
216
213
|
|
|
217
214
|
const binaryOverride = process.env.PASEO_SHARED_BROWSER_AGENT_BROWSER_BINARY;
|
|
218
215
|
if (binaryOverride)
|
|
@@ -57,7 +57,7 @@ import { createScreencastSourceTime } from "./screencast-source-time";
|
|
|
57
57
|
import { createVideoSourceRecovery } from "./video-source-recovery";
|
|
58
58
|
|
|
59
59
|
const execFileAsync = promisify(execFile);
|
|
60
|
-
export const AGENT_BROWSER_VERSION = "0.
|
|
60
|
+
export const AGENT_BROWSER_VERSION = "0.43.0";
|
|
61
61
|
const PRIVATE_DIRECTORY_MODE = 0o700;
|
|
62
62
|
const PRIVATE_FILE_MODE = 0o600;
|
|
63
63
|
const DEFAULT_TIMEOUT_MS = 15_000;
|
|
@@ -113,6 +113,16 @@ export class BrowserGesture {
|
|
|
113
113
|
this.idleUntil = now + GESTURE_IDLE_MS;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
/** Physical input that a quiet client still holds; only this justifies a keep-alive. */
|
|
117
|
+
isHeld(): boolean {
|
|
118
|
+
return this.buttons.size > 0 || this.touches.size > 0 || this.keys.size > 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Extend only the idle bound; the absolute lifetime and sequence are unchanged. */
|
|
122
|
+
renew(now: number): void {
|
|
123
|
+
this.idleUntil = Math.min(now + GESTURE_IDLE_MS, this.expiresAt);
|
|
124
|
+
}
|
|
125
|
+
|
|
116
126
|
/** Only an unpressed mouse move leaves existing bounded frame authority usable for a new press. */
|
|
117
127
|
isHover(event: BrowserGestureEvent): boolean {
|
|
118
128
|
return (event.kind === "move" || event.kind === "leave") && this.buttons.size === 0;
|