INNER CODE UNIT · JavaScript

runFigranite

figranium/figranium · src/agent/figranite/index.js:85

async function runFigranite(data, options = {}) {
    let { url, actions, wait: globalWait, rotateUserAgents, rotateProxies, humanTyping, stealth = {}, sessionId } = data;
    const autoSolveCaptcha = parseBooleanFlag(data.autoSolveCaptcha);

    const runtimeVars = { ...(data.taskVariables || data.variables || {}) };
    let lastBlockOutput = null;
    runtimeVars['block.output'] = lastBlockOutput;

    const setBlockOutput = (value) => {
        lastBlockOutput = value;
        runtimeVars['block.output'] = value;
    };

    const resolveTemplate = (input) => {
        if (typeof input !== 'string' || !input.includes('{$')) return input;
        return input.replace(/\{\$([\w.]+)\}/g, (_match, name) => {
            if (name === 'now') return new Date().toISOString();
            const value = runtimeVars[name];

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…