@omercnet/paseo-shared-browser 0.4.2-next.129.1 → 0.4.2-next.133.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 +13 -29
- package/package.json +13 -18
- package/paseo-plugin.json +1 -1
- package/scripts/prepare-dependencies.mjs +45 -8
- package/scripts/prepare-runtime.mjs +15 -3
- package/server/agent-browser-runtime.ts +3 -2
- package/server/cdp.ts +13 -3
- package/server/mcp-entry.ts +54 -12
- package/server/runtime-protocol.ts +33 -6
- package/shared/browser.ts +4 -1
package/README.md
CHANGED
|
@@ -72,24 +72,10 @@ paseo plugin install npm:@omercnet/paseo-shared-browser
|
|
|
72
72
|
paseo plugin ls
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
paseo plugin add omercnet/paseo-plugins:paseo-shared-browser
|
|
79
|
-
paseo plugin ls
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Installation runs `npm ci --include=dev` and `npm run prepare:runtime` on the daemon host. The
|
|
83
|
-
preparation step installs the pinned browser runtime and builds both `supervisor.cjs` and
|
|
75
|
+
When Paseo acquires the npm package, it runs the `npm run prepare:runtime` build hook automatically. The
|
|
76
|
+
hook installs the pinned browser runtime and builds both `supervisor.cjs` and
|
|
84
77
|
`shared-browser-mcp.cjs` under
|
|
85
|
-
`$PASEO_HOME/plugin-data/shared-browser/runtime`.
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
cd paseo-plugins/paseo-shared-browser
|
|
89
|
-
npm ci --include=dev
|
|
90
|
-
npm run prepare:runtime
|
|
91
|
-
paseo plugin install "$PWD"
|
|
92
|
-
```
|
|
78
|
+
`$PASEO_HOME/plugin-data/shared-browser/runtime`.
|
|
93
79
|
|
|
94
80
|
The build requires Node.js 24 or newer and npm on the daemon host. On Linux x64, macOS, and
|
|
95
81
|
Windows, runtime preparation installs and stages the platform's Chrome for Testing distribution. On
|
|
@@ -175,23 +161,21 @@ User-supplied `AGENT_BROWSER_*` variables are deliberately ignored.
|
|
|
175
161
|
## Develop
|
|
176
162
|
|
|
177
163
|
```bash
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
paseo plugin install "$PWD"
|
|
185
|
-
paseo plugin reload shared-browser
|
|
164
|
+
bun install
|
|
165
|
+
bun run typecheck
|
|
166
|
+
bun run lint
|
|
167
|
+
bun run format:check
|
|
168
|
+
bun run test:unit
|
|
169
|
+
bun run prepare:runtime
|
|
186
170
|
```
|
|
187
171
|
|
|
188
|
-
`
|
|
172
|
+
`bun run test:smoke` launches the configured real Chromium runtime and exercises two viewers,
|
|
189
173
|
control handoff, reconnect, stale-frame rejection, viewport changes, device emulation, profile
|
|
190
174
|
persistence, and archive teardown.
|
|
191
175
|
|
|
192
176
|
Release Please maintains the version, changelog, component tag, and GitHub release from
|
|
193
177
|
Conventional Commits in the monorepo.
|
|
194
178
|
|
|
195
|
-
Both the Paseo daemon and app must satisfy
|
|
196
|
-
and
|
|
197
|
-
|
|
179
|
+
Both the Paseo daemon and app must satisfy `>=0.8.0 <0.10.0`, which supports Paseo 0.8
|
|
180
|
+
and Paseo 0.9. The client surface uses React Native primitives and works in desktop, web, iOS,
|
|
181
|
+
and Android Paseo clients.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omercnet/paseo-shared-browser",
|
|
3
|
-
"version": "0.4.2-next.
|
|
3
|
+
"version": "0.4.2-next.133.1",
|
|
4
4
|
"description": "One real Chromium session per Paseo workspace, shared live across every connected client.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"browser",
|
|
@@ -38,40 +38,35 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
|
+
"check": "biome check .",
|
|
42
|
+
"check:write": "biome check --write .",
|
|
41
43
|
"typecheck": "tsc --noEmit",
|
|
42
44
|
"prepare:runtime": "node scripts/prepare-runtime.mjs",
|
|
43
|
-
"test
|
|
44
|
-
"test:
|
|
45
|
-
"
|
|
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"
|
|
45
|
+
"test": "vitest run tests/contracts.test.ts tests/lease.test.ts tests/runtime-lifecycle.test.ts tests/agent-access.test.ts",
|
|
46
|
+
"test:unit": "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"
|
|
50
48
|
},
|
|
51
49
|
"dependencies": {
|
|
52
|
-
"@getpaseo/plugin": "0.
|
|
50
|
+
"@getpaseo/plugin": "0.9.0",
|
|
53
51
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
54
52
|
"agent-browser": "0.37.1",
|
|
55
53
|
"esbuild": "0.28.2",
|
|
56
54
|
"zod": "4.4.3"
|
|
57
55
|
},
|
|
58
56
|
"devDependencies": {
|
|
59
|
-
"@biomejs/biome": "^2.5.
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
"@types/node": "^22.0.0",
|
|
64
|
-
"@types/react": "~19.2.0",
|
|
65
|
-
"npm-run-all2": "^9.0.3",
|
|
57
|
+
"@biomejs/biome": "^2.5.10",
|
|
58
|
+
"@tanstack/react-query": "^5.102.3",
|
|
59
|
+
"@types/node": "^24.10.1",
|
|
60
|
+
"@types/react": "^19.2.18",
|
|
66
61
|
"react": "19.1.0",
|
|
67
62
|
"react-native": "0.81.5",
|
|
68
|
-
"typescript": "^7.0.
|
|
63
|
+
"typescript": "^7.0.2",
|
|
69
64
|
"vitest": "^5.0.0"
|
|
70
65
|
},
|
|
71
66
|
"engines": {
|
|
72
67
|
"node": ">=24"
|
|
73
68
|
},
|
|
74
|
-
"packageManager": "
|
|
69
|
+
"packageManager": "bun@1.4.2",
|
|
75
70
|
"allowScripts": {
|
|
76
71
|
"agent-browser": true,
|
|
77
72
|
"esbuild@0.28.2": true
|
package/paseo-plugin.json
CHANGED
|
@@ -1,21 +1,58 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
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
8
|
|
|
9
|
+
function loadRootCatalog(root) {
|
|
10
|
+
for (let directory = root; ; directory = dirname(directory)) {
|
|
11
|
+
const manifestPath = join(directory, "package.json");
|
|
12
|
+
if (existsSync(manifestPath)) {
|
|
13
|
+
const catalog = JSON.parse(readFileSync(manifestPath, "utf8")).catalog;
|
|
14
|
+
if (catalog) return catalog;
|
|
15
|
+
}
|
|
16
|
+
if (directory === dirname(directory)) return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function stageManifest(root, catalog, install) {
|
|
21
|
+
const manifestPath = join(root, "package.json");
|
|
22
|
+
const source = readFileSync(manifestPath, "utf8");
|
|
23
|
+
const manifest = JSON.parse(source);
|
|
24
|
+
|
|
25
|
+
for (const [name, spec] of Object.entries(manifest.dependencies)) {
|
|
26
|
+
if (spec !== "catalog:") continue;
|
|
27
|
+
if (typeof catalog[name] !== "string") throw new Error(`Missing catalog entry for ${name}`);
|
|
28
|
+
manifest.dependencies[name] = catalog[name];
|
|
29
|
+
}
|
|
30
|
+
delete manifest.devDependencies;
|
|
31
|
+
|
|
32
|
+
writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
33
|
+
try {
|
|
34
|
+
install();
|
|
35
|
+
} finally {
|
|
36
|
+
writeFileSync(manifestPath, source);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
9
40
|
export function resolveDependencyRoot(packageName, from = import.meta.url) {
|
|
10
|
-
|
|
11
|
-
return dirname(require.resolve(`${packageName}/package.json`));
|
|
41
|
+
return dirname(createRequire(from).resolve(`${packageName}/package.json`));
|
|
12
42
|
}
|
|
13
|
-
export function prepareDependencies(root = projectRoot, execute = execFileSync) {
|
|
14
|
-
if (!existsSync(join(root, "package-lock.json"))) return false;
|
|
15
43
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
44
|
+
export function prepareDependencies(root = projectRoot, execute = execFileSync) {
|
|
45
|
+
const catalog = loadRootCatalog(root);
|
|
46
|
+
if (!catalog) return false;
|
|
47
|
+
stageManifest(root, catalog, () => {
|
|
48
|
+
execute(
|
|
49
|
+
process.platform === "win32" ? "npm.cmd" : "npm",
|
|
50
|
+
["install", "--omit=dev", "--ignore-scripts", "--no-package-lock", "--workspaces=false"],
|
|
51
|
+
{
|
|
52
|
+
cwd: root,
|
|
53
|
+
stdio: "inherit",
|
|
54
|
+
},
|
|
55
|
+
);
|
|
19
56
|
});
|
|
20
57
|
return true;
|
|
21
58
|
}
|
|
@@ -12,12 +12,19 @@ import {
|
|
|
12
12
|
symlink,
|
|
13
13
|
writeFile,
|
|
14
14
|
} from "node:fs/promises";
|
|
15
|
+
import { createRequire } from "node:module";
|
|
15
16
|
import { arch, homedir, platform, userInfo } from "node:os";
|
|
16
17
|
import { dirname, join, resolve } from "node:path";
|
|
17
18
|
import { fileURLToPath } from "node:url";
|
|
18
19
|
import { promisify } from "node:util";
|
|
19
20
|
import { build } from "esbuild";
|
|
20
|
-
|
|
21
|
+
|
|
22
|
+
const require = createRequire(import.meta.url);
|
|
23
|
+
|
|
24
|
+
function resolveDependencyRoot(packageName) {
|
|
25
|
+
const packageJsonPath = require.resolve(`${packageName}/package.json`);
|
|
26
|
+
return dirname(packageJsonPath);
|
|
27
|
+
}
|
|
21
28
|
|
|
22
29
|
const execFileAsync = promisify(execFile);
|
|
23
30
|
const expectedVersion = "0.37.1";
|
|
@@ -54,7 +61,9 @@ async function requireExecutable(path, label) {
|
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
async function validateAgentBrowser(path) {
|
|
57
|
-
const { stdout } = await execFileAsync(path, ["--version"], {
|
|
64
|
+
const { stdout } = await execFileAsync(path, ["--version"], {
|
|
65
|
+
encoding: "utf8",
|
|
66
|
+
});
|
|
58
67
|
const version = stdout.match(/\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?/)?.[0];
|
|
59
68
|
if (version !== expectedVersion) {
|
|
60
69
|
throw new Error(`Expected agent-browser ${expectedVersion}, received ${version ?? "unknown"}`);
|
|
@@ -185,7 +194,10 @@ async function installChromium() {
|
|
|
185
194
|
if (!releaseDir) throw new Error("agent-browser install did not produce a Chromium release");
|
|
186
195
|
const chrome = installedChromiumExecutable(releaseDir);
|
|
187
196
|
await requireExecutable(chrome, "Installed Chromium executable");
|
|
188
|
-
await cp(releaseDir, join(stagingRoot, "chromium"), {
|
|
197
|
+
await cp(releaseDir, join(stagingRoot, "chromium"), {
|
|
198
|
+
recursive: true,
|
|
199
|
+
force: true,
|
|
200
|
+
});
|
|
189
201
|
if (hostPlatform === "darwin") {
|
|
190
202
|
// chrome can't be a symlink to the .app's real binary here: macOS dyld
|
|
191
203
|
// resolves @executable_path from the invoked path's own directory, so a
|
|
@@ -669,9 +669,10 @@ export class AgentBrowserRuntime {
|
|
|
669
669
|
if (!force) {
|
|
670
670
|
try {
|
|
671
671
|
await this.invoke(["--session", this.session, "--json", "close"]);
|
|
672
|
-
} catch
|
|
672
|
+
} catch {
|
|
673
673
|
this.stopping = false;
|
|
674
|
-
|
|
674
|
+
await this.shutdown(true);
|
|
675
|
+
return;
|
|
675
676
|
}
|
|
676
677
|
} else {
|
|
677
678
|
const pid = await this.daemonPid();
|
package/server/cdp.ts
CHANGED
|
@@ -102,7 +102,11 @@ export class CdpConnection extends EventEmitter {
|
|
|
102
102
|
async send<T = unknown>(
|
|
103
103
|
method: string,
|
|
104
104
|
params: Record<string, unknown> = {},
|
|
105
|
-
options: {
|
|
105
|
+
options: {
|
|
106
|
+
sessionId?: string;
|
|
107
|
+
mutation?: boolean;
|
|
108
|
+
timeoutMs?: number;
|
|
109
|
+
} = {},
|
|
106
110
|
): Promise<T> {
|
|
107
111
|
if (!this.isOpen) throw new CdpUnavailableError("CDP connection is closed");
|
|
108
112
|
const id = this.nextId++;
|
|
@@ -173,7 +177,10 @@ export class CdpConnection extends EventEmitter {
|
|
|
173
177
|
return;
|
|
174
178
|
}
|
|
175
179
|
if (message.method) {
|
|
176
|
-
const event: CdpEvent = {
|
|
180
|
+
const event: CdpEvent = {
|
|
181
|
+
method: message.method,
|
|
182
|
+
params: message.params ?? {},
|
|
183
|
+
};
|
|
177
184
|
if (message.sessionId) event.sessionId = message.sessionId;
|
|
178
185
|
this.emit("event", event);
|
|
179
186
|
this.emit(message.method, event.params, event.sessionId);
|
|
@@ -220,7 +227,10 @@ export class CdpSession extends EventEmitter {
|
|
|
220
227
|
params: Record<string, unknown> = {},
|
|
221
228
|
options: { mutation?: boolean; timeoutMs?: number } = {},
|
|
222
229
|
): Promise<T> {
|
|
223
|
-
return this.connection.send<T>(method, params, {
|
|
230
|
+
return this.connection.send<T>(method, params, {
|
|
231
|
+
...options,
|
|
232
|
+
sessionId: this.sessionId,
|
|
233
|
+
});
|
|
224
234
|
}
|
|
225
235
|
|
|
226
236
|
detach(): Promise<void> {
|
package/server/mcp-entry.ts
CHANGED
|
@@ -71,7 +71,9 @@ function asObject(value: JsonValue): Record<string, JsonValue> {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
function textResult(value: JsonValue) {
|
|
74
|
-
return {
|
|
74
|
+
return {
|
|
75
|
+
content: [{ type: "text" as const, text: JSON.stringify(value, null, 2) }],
|
|
76
|
+
};
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
async function main(): Promise<void> {
|
|
@@ -83,7 +85,10 @@ async function main(): Promise<void> {
|
|
|
83
85
|
});
|
|
84
86
|
await client.open();
|
|
85
87
|
|
|
86
|
-
const server = new McpServer({
|
|
88
|
+
const server = new McpServer({
|
|
89
|
+
name: "paseo-shared-browser",
|
|
90
|
+
version: "0.2.2",
|
|
91
|
+
});
|
|
87
92
|
|
|
88
93
|
server.registerTool(
|
|
89
94
|
"shared_browser_status",
|
|
@@ -100,7 +105,9 @@ async function main(): Promise<void> {
|
|
|
100
105
|
{
|
|
101
106
|
description:
|
|
102
107
|
"Capture the current shared browser frame and state. Capture before sending input.",
|
|
103
|
-
inputSchema: z.object({
|
|
108
|
+
inputSchema: z.object({
|
|
109
|
+
quality: z.enum(["low", "medium", "high"]).default("medium"),
|
|
110
|
+
}),
|
|
104
111
|
annotations: { readOnlyHint: true, idempotentHint: true },
|
|
105
112
|
},
|
|
106
113
|
async ({ quality }) => {
|
|
@@ -113,7 +120,11 @@ async function main(): Promise<void> {
|
|
|
113
120
|
if (frame && typeof frame === "object" && !Array.isArray(frame)) {
|
|
114
121
|
const image = frame as Record<string, JsonValue>;
|
|
115
122
|
if (typeof image.dataBase64 === "string" && typeof image.mimeType === "string")
|
|
116
|
-
content.push({
|
|
123
|
+
content.push({
|
|
124
|
+
type: "image",
|
|
125
|
+
data: image.dataBase64,
|
|
126
|
+
mimeType: image.mimeType,
|
|
127
|
+
});
|
|
117
128
|
}
|
|
118
129
|
return { content };
|
|
119
130
|
},
|
|
@@ -125,7 +136,11 @@ async function main(): Promise<void> {
|
|
|
125
136
|
description:
|
|
126
137
|
"Acquire browser control if no human or other viewer currently holds it. Forced takeover is unavailable.",
|
|
127
138
|
inputSchema: z.object({}),
|
|
128
|
-
annotations: {
|
|
139
|
+
annotations: {
|
|
140
|
+
readOnlyHint: false,
|
|
141
|
+
destructiveHint: false,
|
|
142
|
+
idempotentHint: false,
|
|
143
|
+
},
|
|
129
144
|
},
|
|
130
145
|
async () => textResult(await client.request("acquire-control", {})),
|
|
131
146
|
);
|
|
@@ -135,7 +150,11 @@ async function main(): Promise<void> {
|
|
|
135
150
|
{
|
|
136
151
|
description: "Release this agent's browser control lease.",
|
|
137
152
|
inputSchema: z.object({}),
|
|
138
|
-
annotations: {
|
|
153
|
+
annotations: {
|
|
154
|
+
readOnlyHint: false,
|
|
155
|
+
destructiveHint: false,
|
|
156
|
+
idempotentHint: false,
|
|
157
|
+
},
|
|
139
158
|
},
|
|
140
159
|
async () => textResult(await client.request("release-control", {})),
|
|
141
160
|
);
|
|
@@ -145,16 +164,27 @@ async function main(): Promise<void> {
|
|
|
145
164
|
description: "Navigate the shared browser using the agent's current observed state.",
|
|
146
165
|
inputSchema: z.object({
|
|
147
166
|
action: z.discriminatedUnion("kind", [
|
|
148
|
-
z.object({
|
|
167
|
+
z.object({
|
|
168
|
+
kind: z.literal("goto"),
|
|
169
|
+
url: z.string().trim().min(1).max(8_192),
|
|
170
|
+
}),
|
|
149
171
|
z.object({ kind: z.literal("back") }),
|
|
150
172
|
z.object({ kind: z.literal("forward") }),
|
|
151
173
|
z.object({ kind: z.literal("reload") }),
|
|
152
174
|
]),
|
|
153
175
|
}),
|
|
154
|
-
annotations: {
|
|
176
|
+
annotations: {
|
|
177
|
+
readOnlyHint: false,
|
|
178
|
+
destructiveHint: false,
|
|
179
|
+
idempotentHint: false,
|
|
180
|
+
},
|
|
155
181
|
},
|
|
156
182
|
async ({ action }) =>
|
|
157
|
-
textResult(
|
|
183
|
+
textResult(
|
|
184
|
+
await client.request("navigate", {
|
|
185
|
+
action: action as unknown as JsonValue,
|
|
186
|
+
}),
|
|
187
|
+
),
|
|
158
188
|
);
|
|
159
189
|
|
|
160
190
|
server.registerTool(
|
|
@@ -163,7 +193,11 @@ async function main(): Promise<void> {
|
|
|
163
193
|
description:
|
|
164
194
|
"Send one input event using the exact frame returned by the latest capture. Stale frames are rejected.",
|
|
165
195
|
inputSchema: z.object({ event: inputEventSchema }),
|
|
166
|
-
annotations: {
|
|
196
|
+
annotations: {
|
|
197
|
+
readOnlyHint: false,
|
|
198
|
+
destructiveHint: false,
|
|
199
|
+
idempotentHint: false,
|
|
200
|
+
},
|
|
167
201
|
},
|
|
168
202
|
async ({ event }) =>
|
|
169
203
|
textResult(await client.request("input", { event: event as unknown as JsonValue })),
|
|
@@ -177,10 +211,18 @@ async function main(): Promise<void> {
|
|
|
177
211
|
width: z.number().int().min(MIN_VIEWPORT.width).max(MAX_VIEWPORT.width),
|
|
178
212
|
height: z.number().int().min(MIN_VIEWPORT.height).max(MAX_VIEWPORT.height),
|
|
179
213
|
}),
|
|
180
|
-
annotations: {
|
|
214
|
+
annotations: {
|
|
215
|
+
readOnlyHint: false,
|
|
216
|
+
destructiveHint: false,
|
|
217
|
+
idempotentHint: false,
|
|
218
|
+
},
|
|
181
219
|
},
|
|
182
220
|
async (viewport) =>
|
|
183
|
-
textResult(
|
|
221
|
+
textResult(
|
|
222
|
+
await client.request("viewport", {
|
|
223
|
+
viewport: viewport as unknown as JsonValue,
|
|
224
|
+
}),
|
|
225
|
+
),
|
|
184
226
|
);
|
|
185
227
|
|
|
186
228
|
const transport = new StdioServerTransport();
|
|
@@ -41,7 +41,11 @@ export type AgentBrowserOperation =
|
|
|
41
41
|
export type RuntimeRequest =
|
|
42
42
|
| (AdminRequestBase & { method: "bridge.claim"; takeover?: boolean })
|
|
43
43
|
| (AdminRequestBase & { method: "bridge.heartbeat"; epoch: number })
|
|
44
|
-
| (AdminRequestBase & {
|
|
44
|
+
| (AdminRequestBase & {
|
|
45
|
+
method: "workspace.ensure";
|
|
46
|
+
epoch: number;
|
|
47
|
+
workspaceId: string;
|
|
48
|
+
})
|
|
45
49
|
| (AdminRequestBase & {
|
|
46
50
|
method: "workspace.request";
|
|
47
51
|
epoch: number;
|
|
@@ -49,14 +53,22 @@ export type RuntimeRequest =
|
|
|
49
53
|
operation: string;
|
|
50
54
|
input: JsonValue;
|
|
51
55
|
})
|
|
52
|
-
| (AdminRequestBase & {
|
|
56
|
+
| (AdminRequestBase & {
|
|
57
|
+
method: "workspace.archive";
|
|
58
|
+
epoch: number;
|
|
59
|
+
workspaceId: string;
|
|
60
|
+
})
|
|
53
61
|
| (AdminRequestBase & {
|
|
54
62
|
method: "browser.request";
|
|
55
63
|
epoch: number;
|
|
56
64
|
operation: string;
|
|
57
65
|
input: JsonValue;
|
|
58
66
|
})
|
|
59
|
-
| (AdminRequestBase & {
|
|
67
|
+
| (AdminRequestBase & {
|
|
68
|
+
method: "ticket.issue";
|
|
69
|
+
epoch: number;
|
|
70
|
+
ticket: string;
|
|
71
|
+
})
|
|
60
72
|
| (AdminRequestBase & {
|
|
61
73
|
method: "ticket.bind";
|
|
62
74
|
epoch: number;
|
|
@@ -64,7 +76,11 @@ export type RuntimeRequest =
|
|
|
64
76
|
agentId: string;
|
|
65
77
|
workspaceId: string;
|
|
66
78
|
})
|
|
67
|
-
| (AdminRequestBase & {
|
|
79
|
+
| (AdminRequestBase & {
|
|
80
|
+
method: "agent.revoke";
|
|
81
|
+
epoch: number;
|
|
82
|
+
agentId: string;
|
|
83
|
+
})
|
|
68
84
|
| (RuntimeRequestBase & {
|
|
69
85
|
method: "agent.request";
|
|
70
86
|
ticket: string;
|
|
@@ -76,7 +92,11 @@ export type RuntimeResult = BridgeLease | RuntimeDescriptor | JsonValue | { arch
|
|
|
76
92
|
|
|
77
93
|
export type RuntimeResponse =
|
|
78
94
|
| { id: string; ok: true; result: RuntimeResult }
|
|
79
|
-
| {
|
|
95
|
+
| {
|
|
96
|
+
id: string;
|
|
97
|
+
ok: false;
|
|
98
|
+
error: { code: RuntimeErrorCode; message: string };
|
|
99
|
+
};
|
|
80
100
|
|
|
81
101
|
export type RuntimeErrorCode =
|
|
82
102
|
| "AUTHENTICATION_FAILED"
|
|
@@ -145,7 +165,14 @@ export function parseRuntimeRequest(value: unknown): RuntimeRequest {
|
|
|
145
165
|
};
|
|
146
166
|
const epoch = requireInteger(value, "epoch");
|
|
147
167
|
if (method === "bridge.heartbeat")
|
|
148
|
-
return {
|
|
168
|
+
return {
|
|
169
|
+
id,
|
|
170
|
+
version: RUNTIME_PROTOCOL_VERSION,
|
|
171
|
+
method,
|
|
172
|
+
token,
|
|
173
|
+
bridgeId,
|
|
174
|
+
epoch,
|
|
175
|
+
};
|
|
149
176
|
if (method === "workspace.ensure" || method === "workspace.archive")
|
|
150
177
|
return {
|
|
151
178
|
id,
|
package/shared/browser.ts
CHANGED
|
@@ -206,7 +206,10 @@ export const navigateBrowserRpc = defineRpc({
|
|
|
206
206
|
controlToken: opaqueTokenSchema,
|
|
207
207
|
expected: expectedStateSchema,
|
|
208
208
|
action: z.discriminatedUnion("kind", [
|
|
209
|
-
z.object({
|
|
209
|
+
z.object({
|
|
210
|
+
kind: z.literal("goto"),
|
|
211
|
+
url: z.string().trim().min(1).max(8_192),
|
|
212
|
+
}),
|
|
210
213
|
z.object({ kind: z.literal("back") }),
|
|
211
214
|
z.object({ kind: z.literal("forward") }),
|
|
212
215
|
z.object({ kind: z.literal("reload") }),
|