mirror of
https://github.com/stablyai/orca.git
synced 2026-11-17 03:15:01 +00:00
* 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
75 lines
2.4 KiB
JavaScript
75 lines
2.4 KiB
JavaScript
import { createHash } from 'node:crypto'
|
|
import { mkdir, writeFile } from 'node:fs/promises'
|
|
import { dirname, join } from 'node:path'
|
|
import {
|
|
ORCAD_MOBILE_WEB_MANIFEST,
|
|
ORCAD_NODE_RUNTIME_MARKER_FILENAME,
|
|
ORCAD_SERVER_TARGET_FILENAME,
|
|
ORCAD_TEMPLATE_MANIFEST_FILENAME,
|
|
ORCAD_TEMPLATE_TARGETS_DIR,
|
|
orcadTemplateCommonFilenames,
|
|
orcadTemplateTargetFilenames
|
|
} from '../../../../src/shared/orcad-artifacts.ts'
|
|
import {
|
|
COMPAT_SERVER_TARGETS,
|
|
ORCAD_TEMPLATE_TARGETS,
|
|
pinnedNodeRuntimeAsset
|
|
} from '../../../../src/shared/node-runtime-pin.ts'
|
|
|
|
async function write(path, contents) {
|
|
await mkdir(dirname(path), { recursive: true })
|
|
await writeFile(path, contents)
|
|
return createHash('sha256').update(contents).digest('hex')
|
|
}
|
|
|
|
function targetFileContents(target, filename) {
|
|
if (filename === ORCAD_SERVER_TARGET_FILENAME) {
|
|
return `${target}\n`
|
|
}
|
|
if (filename === ORCAD_NODE_RUNTIME_MARKER_FILENAME) {
|
|
return `${pinnedNodeRuntimeAsset(target).executableSha256}\n`
|
|
}
|
|
return `${target}:${filename}`
|
|
}
|
|
|
|
export async function writeOrcadTemplateTestFixture(resourcesDir, { compat = false } = {}) {
|
|
const templateDir = join(resourcesDir, 'orcad-template')
|
|
const commonSha256 = {}
|
|
for (const filename of orcadTemplateCommonFilenames(['out/mobile-web/index.html'])) {
|
|
commonSha256[filename] = await write(
|
|
join(templateDir, ...filename.split('/')),
|
|
Buffer.from(
|
|
filename === ORCAD_MOBILE_WEB_MANIFEST
|
|
? JSON.stringify({ assets: [{ path: 'index.html' }] })
|
|
: `common:${filename}`
|
|
)
|
|
)
|
|
}
|
|
const targets = {}
|
|
for (const target of [...ORCAD_TEMPLATE_TARGETS, ...(compat ? COMPAT_SERVER_TARGETS : [])]) {
|
|
const targetDir = join(templateDir, ORCAD_TEMPLATE_TARGETS_DIR, target)
|
|
const files = {}
|
|
for (const filename of orcadTemplateTargetFilenames(target)) {
|
|
files[filename] = await write(
|
|
join(targetDir, ...filename.split('/')),
|
|
targetFileContents(target, filename)
|
|
)
|
|
}
|
|
targets[target] = { files }
|
|
}
|
|
const browserName = 'agent-browser-linux-x64'
|
|
targets['linux-x64-glibc'] = {
|
|
...targets['linux-x64-glibc'],
|
|
browserName,
|
|
browserSha256: await write(
|
|
join(templateDir, ORCAD_TEMPLATE_TARGETS_DIR, 'linux-x64-glibc', browserName),
|
|
'browser'
|
|
)
|
|
}
|
|
await writeFile(
|
|
join(templateDir, ORCAD_TEMPLATE_MANIFEST_FILENAME),
|
|
JSON.stringify({ schemaVersion: 3, commonSha256, targets })
|
|
)
|
|
return templateDir
|
|
}
|