mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
Co-authored-by: m4air <m4air@Mac.localdomain>
This commit is contained in:
@@ -301,6 +301,7 @@ module.exports = {
|
||||
// disappears from Agent Session History in packaged builds only. Worker
|
||||
// entries reached solely from the Electron main process stay packed, since
|
||||
// asar redirects their app.asar paths.
|
||||
// Why: `orca serve` runs the orcad selection entry under ELECTRON_RUN_AS_NODE too (#27307).
|
||||
asarUnpack: [
|
||||
'out/package.json',
|
||||
'out/cli/**',
|
||||
@@ -327,6 +328,7 @@ module.exports = {
|
||||
'out/main/plugin-host-entry.js',
|
||||
'out/main/computer-sidecar.js',
|
||||
'out/main/parcel-watcher-process-entry.js',
|
||||
'out/main/orcad/orcad-local-serve-selection-entry.js',
|
||||
'out/main/chunks/**',
|
||||
'resources/**',
|
||||
'node_modules/ws/**',
|
||||
|
||||
@@ -357,6 +357,28 @@ describe('electron-builder config', () => {
|
||||
expect(viteConfig).toMatch(new RegExp(`'${entryFilename.replace(/\.js$/, '')}':\\s*resolve\\(`))
|
||||
})
|
||||
|
||||
// Why: the CLI runs this entry under ELECTRON_RUN_AS_NODE, which cannot read
|
||||
// app.asar, so a packed copy sends every `orca serve` to Electron (#27307).
|
||||
it('unpacks the orcad serve-selection entry the CLI runs', async () => {
|
||||
const sharedSource = await readFile(
|
||||
join(REPO_ROOT, 'src', 'shared', 'orcad-local-serve-selection.ts'),
|
||||
'utf8'
|
||||
)
|
||||
const entryName = sharedSource.match(/ORCAD_LOCAL_SERVE_SELECTION_ENTRY = '([^']+)'/)?.[1]
|
||||
expect(entryName).toBeDefined()
|
||||
|
||||
const matcher = new FileMatcher(
|
||||
'/app',
|
||||
'/dest',
|
||||
(value) => value,
|
||||
electronBuilderConfig.asarUnpack
|
||||
)
|
||||
const isUnpacked = matcher.createFilter()
|
||||
expect(
|
||||
isUnpacked(join('/app', 'out', 'main', `${entryName}.js`), { isDirectory: () => false })
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
// Why: the scanner service is forked with ELECTRON_RUN_AS_NODE, so asar is
|
||||
// invisible to it and a packed worker entry fails closed — dropping every
|
||||
// OpenCode session in packaged builds while dev stays green. Three legs must
|
||||
|
||||
Reference in New Issue
Block a user