Node.js Capabilities
Current client, session, context, extension, download, CDP, error, and logging APIs.
Client and regions
import { Lexmount } from "lexmount";
const client = new Lexmount({
region: "<region-id>",
timeout: 60_000,
});
console.log(await client.regionInfo());
console.log(await client.catalogInfo());The client reads credentials from constructor options or environment variables. Region catalog discovery is best effort: an unavailable catalog or probe falls back to the configured base URL.
Sessions
Create options
const session = await client.sessions.create({
browserMode: "normal",
windowSize: "1920,1080",
downloads: { enabled: true },
recording: { persistent: true },
});| Option | Purpose |
|---|---|
browserMode | normal for Chromium or light for Moli |
context / contextDescription | Reuse or create persistent browser state |
extensionIds | Mount uploaded extensions |
proxy / officialProxy | Select a custom upstream proxy or the Lexmount proxy pool |
downloads | Enable or disable stored session downloads |
recording | Enable or disable persistent replay; forced off for Moli |
customImageId | Start an approved custom browser image |
windowSize | Set ACE browser size as width,height |
enableLightmountLayout | Enable the LightMount layout integration; defaults to true |
enableLightmountResource | Override layout-resource integration for this session |
asyncCreate | Use async create and wait for active; defaults to true |
pollIntervalMs / pollTimeoutMs | Control activation polling |
officialProxy: true and proxy are mutually exclusive. Plan capabilities determine whether contexts, extensions, proxies, and custom images are available.
Read, list, targets, and close
const current = await client.sessions.get(session.id);
const sessions = await client.sessions.list({ status: "active" });
console.log(sessions.pagination.totalCount);
for (const item of sessions) {
console.log(item.id, item.status, item.regionId, item.browserType);
}
for (const target of await client.sessions.listTargets(session.id)) {
console.log(target.title, target.url, target.inspectUrl);
}
await session.close();
// Equivalent when only the ID is available:
await client.sessions.delete({ sessionId: session.id });Downloads
const result = await client.sessions.downloads.list(session.id);
console.log(result.summary.count, result.summary.totalSize);
const file = await client.sessions.downloads.get(session.id, "<download-id>");
const archive = await client.sessions.downloads.archive(session.id);
const deleted = await client.sessions.downloads.delete(session.id);
console.log(file.length, archive.length, deleted.deletedCount);Stored downloads are enabled by default. Configure the remote browser download behavior as shown in the quickstart repository so files reach the persistent download directory.
Contexts
const context = await client.contexts.create({
description: "Authenticated storefront",
metadata: { owner: "agent-a" },
});
const session = await client.sessions.create({
context: { id: context.id, mode: "readWrite" },
});
const contexts = await client.contexts.list({ status: "available", limit: 20 });
const details = await client.contexts.get(context.id);
const forked = await client.contexts.fork(context.id);
await client.contexts.forceRelease(context.id);
await client.contexts.delete(forked.id);A context used by an active read-write session is locked. Current fork behavior copies an offline available context; hot fork, copy-on-write, and lineage tracking are not supported.
Extensions
const extension = await client.extensions.upload(
"/absolute/path/to/extension.zip",
{
name: "demo-extension",
},
);
const extensions = await client.extensions.list({ limit: 20, offset: 0 });
const details = await client.extensions.get(extension.id);
const session = await client.sessions.create({ extensionIds: [extension.id] });
await session.close();
await client.extensions.delete(extension.id);The service accepts .zip and .crx archives. An extension cannot be deleted while an active session uses it.
CDP helpers and integrated authentication
import { connectOverCDP, Lexmount } from "lexmount";
const client = new Lexmount();
const session = await client.sessions.create();
const cdp = await connectOverCDP(session);
console.log(await cdp.send("Browser.getVersion"));
await cdp.close();
await session.close();
client.close();The package also exports registerIntegratedAuthCallback and deregisterIntegratedAuthCallback for application-provided authentication handling.
Errors and logs
import {
APIError,
AuthenticationError,
ContextLockedError,
NetworkError,
TimeoutError,
setLogLevel,
} from "lexmount";
setLogLevel("INFO");
try {
await client.sessions.create();
} catch (error) {
if (error instanceof AuthenticationError) {
console.error("Check API Key and Project ID");
} else if (error instanceof ContextLockedError) {
console.error(error.activeSessionId, error.retryAfter);
} else if (error instanceof NetworkError || error instanceof TimeoutError) {
console.error("Check whether a session was reserved before retrying");
} else if (error instanceof APIError) {
console.error(error.statusCode);
} else {
throw error;
}
}Logging helpers are setLogLevel, enableLogging, disableLogging, and getLogger.
Lexmount Browser