mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-21 05:32:53 +00:00
refactor: remove redundant browser helper conversions
This commit is contained in:
@@ -691,7 +691,7 @@ export function readBrowserVersion(executablePath: string): string | null {
|
||||
}
|
||||
|
||||
export function parseBrowserMajorVersion(rawVersion: string | null | undefined): number | null {
|
||||
const matches = [...String(rawVersion ?? "").matchAll(CHROME_VERSION_RE)];
|
||||
const matches = [...(rawVersion ?? "").matchAll(CHROME_VERSION_RE)];
|
||||
const match = matches.at(-1);
|
||||
if (!match?.[1]) {
|
||||
return null;
|
||||
|
||||
@@ -340,7 +340,7 @@ export function buildRoleSnapshotFromAiSnapshot(
|
||||
aiSnapshot: string,
|
||||
options: RoleSnapshotOptions = {},
|
||||
): { snapshot: string; refs: RoleRefMap } {
|
||||
const lines = String(aiSnapshot ?? "").split("\n");
|
||||
const lines = aiSnapshot.split("\n");
|
||||
const refs: RoleRefMap = {};
|
||||
|
||||
if (options.interactive) {
|
||||
|
||||
@@ -256,7 +256,7 @@ export async function downloadViaPlaywright(opts: {
|
||||
const timeout = normalizeTimeoutMs(opts.timeoutMs, 120_000);
|
||||
|
||||
const ref = requireRef(opts.ref);
|
||||
const outPath = String(opts.path ?? "").trim();
|
||||
const outPath = opts.path?.trim() ?? "";
|
||||
if (!outPath) {
|
||||
throw new Error("path is required");
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ export async function storageSetViaPlaywright(opts: {
|
||||
}): Promise<void> {
|
||||
const page = await getPageForTargetId(opts);
|
||||
ensurePageState(page);
|
||||
const key = String(opts.key ?? "");
|
||||
const key = opts.key;
|
||||
if (!key) {
|
||||
throw new Error("key is required");
|
||||
}
|
||||
@@ -108,7 +108,7 @@ export async function storageSetViaPlaywright(opts: {
|
||||
const store = kind === "session" ? window.sessionStorage : window.localStorage;
|
||||
store.setItem(k, value);
|
||||
},
|
||||
{ kind: opts.kind, key, value: String(opts.value ?? "") },
|
||||
{ kind: opts.kind, key, value: opts.value },
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user