mirror of
https://github.com/stablyai/orca.git
synced 2026-11-18 20:06:10 +00:00
Shim tsx's __name in 4a harness pages and install the probe inside the guarded launch
This commit is contained in:
@@ -20,6 +20,7 @@ import { getOrcaElectronLaunchArgs } from '../../../../tests/e2e/helpers/electro
|
||||
import { closeElectronAppForE2E } from '../../../../tests/e2e/helpers/electron-process-shutdown'
|
||||
import { getE2ECompletedOnboardingProfile } from '../../../../tests/e2e/helpers/e2e-completed-onboarding-profile'
|
||||
import { buildFakeAgentCommandOverride } from '../../../../tests/e2e/helpers/fake-agent-command-override'
|
||||
import { installVisibilityProbe } from './native-chat-4a-probes'
|
||||
|
||||
const HARNESS_ROOT = path.resolve(import.meta.dirname, '../../../..')
|
||||
const SYSTEM_DIRS = ['/usr/bin', '/bin', '/usr/sbin', '/sbin']
|
||||
@@ -160,6 +161,10 @@ export async function launchArm(
|
||||
isolation
|
||||
)
|
||||
const page = await app.firstWindow({ timeout: 120_000 })
|
||||
// tsx keeps function names by wrapping them in __name(), which page.evaluate callbacks carry into the renderer.
|
||||
const nameShim = 'globalThis.__name ??= (fn) => fn'
|
||||
await page.addInitScript(nameShim)
|
||||
await page.evaluate(nameShim)
|
||||
// Only an e2e-mode build exposes the store; a desktop build would otherwise wait out the full budget.
|
||||
await page
|
||||
.waitForFunction(() => Boolean(window.__store), null, { timeout: 60_000 })
|
||||
@@ -173,6 +178,7 @@ export async function launchArm(
|
||||
null,
|
||||
{ timeout: 600_000, polling: 16 }
|
||||
)
|
||||
await installVisibilityProbe(page)
|
||||
return { app, page, pid, startedAt, userDataDir, launchedAtEpochMs, readyEpochMs: Date.now() }
|
||||
} catch (error) {
|
||||
await closeElectronAppForE2E(app, { cleanupDaemonsForUserDataDir: userDataDir })
|
||||
|
||||
@@ -100,7 +100,6 @@ async function runArm(input: {
|
||||
largeSource?: { seedDir: string; manifest: Manifest }
|
||||
}): Promise<ArmResult> {
|
||||
const { copyProfile, launchArm, stopArm } = await import('./native-chat-4a-arm')
|
||||
const { installVisibilityProbe } = await import('./native-chat-4a-probes')
|
||||
const { resetTags } = await import('./native-chat-4a-run-context')
|
||||
const lifecycle = await import('./native-chat-4a-ops-lifecycle')
|
||||
const queue = await import('./native-chat-4a-ops-queue')
|
||||
@@ -121,11 +120,7 @@ async function runArm(input: {
|
||||
}
|
||||
copyProfile(seedDir, profileDir)
|
||||
resetTags()
|
||||
const open = async () => {
|
||||
const launch = await launchArm(input.arm, profileDir, input.stubCommand)
|
||||
await installVisibilityProbe(launch.page)
|
||||
return launch
|
||||
}
|
||||
const open = () => launchArm(input.arm, profileDir, input.stubCommand)
|
||||
const ctx = {
|
||||
arm: input.arm,
|
||||
launch: await open(),
|
||||
|
||||
Reference in New Issue
Block a user