chore: rename browser agent to server (#521)

This commit is contained in:
Pavel Feldman
2025-06-04 16:43:11 -07:00
committed by GitHub
parent 0fb9646c4d
commit 27c498e0e7
4 changed files with 9 additions and 8 deletions

View File

@@ -24,7 +24,7 @@ import * as playwright from 'playwright';
import { userDataDir } from './fileUtils.js';
import type { FullConfig } from './config.js';
import type { BrowserInfo, LaunchBrowserRequest } from './browserAgent.js';
import type { BrowserInfo, LaunchBrowserRequest } from './browserServer.js';
const testDebug = debug('pw:mcp:test');
@@ -36,7 +36,7 @@ export function contextFactory(browserConfig: FullConfig['browser']): BrowserCon
if (browserConfig.isolated)
return new IsolatedContextFactory(browserConfig);
if (browserConfig.browserAgent)
return new AgentContextFactory(browserConfig);
return new BrowserServerContextFactory(browserConfig);
return new PersistentContextFactory(browserConfig);
}
@@ -217,7 +217,7 @@ class PersistentContextFactory implements BrowserContextFactory {
}
}
export class AgentContextFactory extends BaseContextFactory {
export class BrowserServerContextFactory extends BaseContextFactory {
constructor(browserConfig: FullConfig['browser']) {
super('persistent', browserConfig);
}

View File

@@ -47,7 +47,7 @@ type BrowserEntry = {
info: BrowserInfo;
};
class Agent {
class BrowserServer {
private _server = new HttpServer();
private _entries: BrowserEntry[] = [];
@@ -121,7 +121,7 @@ class Agent {
private _updateReport() {
// Clear the current line and move cursor to top of screen
process.stdout.write('\x1b[2J\x1b[H');
process.stdout.write(`Playwright Browser agent v${packageJSON.version}\n`);
process.stdout.write(`Playwright Browser Server v${packageJSON.version}\n`);
process.stdout.write(`Listening on ${this._server.urlPrefix('human-readable')}\n\n`);
if (this._entries.length === 0) {
@@ -173,8 +173,8 @@ program
void program.parseAsync(process.argv);
async function main(options: { port: string }) {
const agent = new Agent();
await agent.start(+options.port);
const server = new BrowserServer();
await server.start(+options.port);
}
function readBody<T>(req: http.IncomingMessage): Promise<T> {