mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-17 04:11:35 +00:00
Full Chromium serves both headed and headless sessions. The separate shell duplicates the browser payload and is not needed for either mode. Remove the shell from PM and Docker. Select the managed Chromium executable for agent-browser and the full Chromium channel for direct Playwright callers. Route setup through PM and remove retired packages from cached bundle stores without changing the user's tool store. Update signing, architecture checks, launch probes and install guidance. Leave llama packages and Docker archive cleanup unchanged. Verification: - Real agent-browser navigation, clicks, DOM reads and screenshots pass in headed and headless modes with the same Chromium executable. - The direct Playwright doctor probe passes. - Focused Python and desktop packaging tests pass, as do six Docker checks and both real-browser task-scroll tests. - The built linux/amd64 image is 1.393 GB compressed, 223.6 MB smaller. - The broader PM suite and two unrelated setup tests still fail. Those failures reproduce on unchanged HEAD. - Five updated eval scripts parse; their full scenarios were not run.
25 lines
2.1 KiB
JavaScript
25 lines
2.1 KiB
JavaScript
import { chromium } from '../../node_modules/playwright/index.mjs'
|
|
import fs from 'node:fs'
|
|
import { execFileSync } from 'node:child_process'
|
|
const a=process.env.ASYNC_REPORT_ARTIFACT_DIR
|
|
if (!a) throw new Error('Set ASYNC_REPORT_ARTIFACT_DIR to an offline artifact directory')
|
|
const tag=process.argv[2]??'after'
|
|
const browser=await chromium.launch({channel:'chromium',executablePath:process.env.AGENT_BROWSER_EXECUTABLE_PATH,headless:true,args:['--no-sandbox']})
|
|
const page=await browser.newPage({viewport:{width:1400,height:1000}})
|
|
const errors=[];page.on('pageerror',e=>errors.push(String(e)))
|
|
const producer=JSON.parse(fs.readFileSync(`${a}/producer.json`,'utf8'))
|
|
const cases={}
|
|
for (const [name, entry] of Object.entries(producer.cases)) {
|
|
await page.goto('http://127.0.0.1:18164/async-report-probe.html'+(tag==='before'?'?baseline':''),{waitUntil:'domcontentloaded',timeout:120000})
|
|
await page.waitForFunction(()=>typeof window.renderProducer==='function')
|
|
const projected=await page.evaluate(rows=>window.renderProducer(rows),entry.rows)
|
|
await page.waitForSelector('#producer [data-role="system"]')
|
|
if (projected.hydrated[0].asyncResult?.includes('# Generated')) await page.waitForSelector('#producer table')
|
|
const dom=await page.locator('#producer').evaluate(el=>({text:el.textContent,headings:el.querySelectorAll('h1').length,tables:el.querySelectorAll('table').length,strong:el.querySelectorAll('strong').length,html:el.innerHTML}))
|
|
cases[name]={...projected,dom}
|
|
if (name==='cron') { await page.locator('#producer').scrollIntoViewIfNeeded(); await page.waitForTimeout(800); await page.locator('#producer').screenshot({path:`${a}/${tag}.png`}) }
|
|
}
|
|
const result={cases,errors,sourceSha:execFileSync('git',['rev-parse','HEAD'],{encoding:'utf8'}).trim()}
|
|
fs.writeFileSync(`${a}/${tag}.json`,JSON.stringify(result,null,2))
|
|
console.log(JSON.stringify({errors,cases:Object.fromEntries(Object.entries(cases).map(([name,c])=>[name,{headings:c.dom.headings,tables:c.dom.tables,privateLeak:c.dom.text.includes('PRIVATE'),body:c.hydrated[0].asyncResult??null}]))},null,2))
|
|
await browser.close()
|