Files
orca/config/scripts/desktop-distribution/runtime-verification/verify-packaged-windows-agent-hook.cjs
Neil 9bd6272fdf refactor(tooling): organize build, CI, and test owners (#38130)
* refactor(tooling): organize test runtime and maintenance owners

* test(tooling): preserve relocated runtime fixture dependency edges

* refactor(tooling): preserve xterm routing owner checks

* ci(tooling): include routing owner in sparse checkout

* test(tooling): preserve copied workflow dependency closures

* fix(tooling): normalize hashed JSON assets in release parity

* fix(tooling): distinguish asset aliases from literal references

* fix(tooling): frame normalized asset reference payloads

* fix(tooling): normalize decoded JSON asset references

* refactor(tooling): organize build, CI and release owners

* fix(tooling): align moved generator and workflow path contracts

* fix(tooling): update generated plugin bundle owner banners

* test(tooling): create relocated mobile verifier fixture directories

* test(tooling): copy headless detector dependency closure

* test(tooling): align native batch policy fixtures with owner path

* fix(tooling): link moved reliability command to historical evidence

* fix(tooling): preserve nested sandbox owners and canonical guide source

* fix(tooling): target release version owners in checkout fixture
2026-11-04 21:08:19 -08:00

32 lines
1.2 KiB
JavaScript

'use strict'
const { existsSync } = require('node:fs')
const { join } = require('node:path')
const {
PE_MACHINE,
describePeMachine,
readPeMachine
} = require('../../native-build/windows/windows-pe-machine.cjs')
// electron-builder's `Arch` enum values for the Windows slices Orca can package.
const ARCH_BY_ELECTRON_BUILDER_ENUM = { 1: 'x64', 3: 'arm64' }
// Require correct-arch native hook: missing extraResources only warns and otherwise silently leaves users on slower .cmd form.
function verifyPackagedWindowsAgentHook(resourcesDir, electronBuilderArch) {
const hookPath = join(resourcesDir, 'bin', 'orca-agent-hook.exe')
if (!existsSync(hookPath)) {
throw new Error(
`Missing packaged agent hook ${hookPath}; run node config/scripts/native-build/windows/build-windows-agent-hook.mjs`
)
}
const arch = ARCH_BY_ELECTRON_BUILDER_ENUM[electronBuilderArch]
const machine = readPeMachine(hookPath)
if (arch === undefined || machine !== PE_MACHINE[arch]) {
throw new Error(
`Packaged agent hook for ${arch ?? `arch ${electronBuilderArch}`} has ${describePeMachine(machine)}`
)
}
}
module.exports = { verifyPackagedWindowsAgentHook }