INNER CODE UNIT · JavaScript
syncBrowserState
figranium/figranium · src/agent/figranite/index.js:211
const syncBrowserState = async () => {
if (statelessExecution || isTestMode || !context) return;
// Agent contexts import the shared cookies after launch, but their persistent
// profile does not contain headful-only local storage for unrelated origins.
// Keep those origins intact while publishing the agent's updated cookies.
await saveSharedBrowserState(context, { preserveOrigins: true });
};
const forceStop = async () => {
isForceStopped = true;
userStopped = true;
stopRequested = true;
logs.push('Execution force-stopped by user after 3s timeout.');
try {
await syncBrowserState();
if (page) await page.close().catch(() => {});
if (context) await context.close().catch(() => {});
if (browser) await browser.close().catch(() => {});