mirror of
https://github.com/stablyai/orca.git
synced 2026-11-02 01:57:57 +00:00
* feat(orcad): ship the mobile web page so phones paired to orcad get it orcad never carried out/mobile-web, so it did not advertise mobileWeb.bundle.v1 and phones paired directly to an orcad server fell back to the app's built-in native screens. The built page now ships in every orcad package at out/mobile-web, the path getBundledMobileWebBundleRoot already probes under the install root. Its manifest is a fixed artifact; its content-addressed assets join the hashed artifact list from that manifest, as one shared copy in the template's common files. build-orcad fails when the page is missing or stale, and CI lanes that build orcad now build the page first. * ci(orcad): check out mobile/ for the Windows host template build * refactor(orcad): copy the page tree whole and build it once per CI run The guard already refuses unlisted files, so staging copies the bundle directory as native-chat-visuals is copied. The shipped template takes the page the qualification lanes tested, the e2e build artifact carries it, and the PR smoke builds it through install-mobile-dependencies behind its own scope step. Drops tests that duplicated the guard's own. * fix(orcad): refuse a template page asset name that escapes the slot
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
|
|
}
|