feat: remove legacy OpenCode runtime
Cut product flows over to Coding/Pi and retain only the migration-owned v1 boundary. Promote supported native optional packages because electron-builder omitted pnpm transitive optional closure from the packaged ASAR.
This commit is contained in:
@@ -146,9 +146,6 @@ const npmPackagePath = join(npmRuntimeDir, 'package.json');
|
||||
const npmCliPath = join(npmRuntimeDir, 'bin', 'npm-cli.js');
|
||||
const appAsarPath = join(resourcesDir, 'app.asar');
|
||||
const appAsarUnpackedPath = join(resourcesDir, 'app.asar.unpacked');
|
||||
const opencodeRuntimeDir = join(resourcesDir, 'opencode-ai');
|
||||
const opencodePackagePath = join(opencodeRuntimeDir, 'package.json');
|
||||
const opencodeExecutable = join(opencodeRuntimeDir, 'bin', 'opencode.exe');
|
||||
const pythonRuntimeDir = join(resourcesDir, 'python');
|
||||
const pythonExecutable = join(pythonRuntimeDir, 'python.exe');
|
||||
const toolsBinDir = join(resourcesDir, 'bin');
|
||||
@@ -159,8 +156,6 @@ for (const filePath of [
|
||||
appAsarPath,
|
||||
npmPackagePath,
|
||||
npmCliPath,
|
||||
opencodePackagePath,
|
||||
opencodeExecutable,
|
||||
pythonExecutable,
|
||||
uvExecutable,
|
||||
]) {
|
||||
@@ -170,31 +165,20 @@ for (const filePath of [
|
||||
const PE_MACHINE_AMD64 = 0x8664;
|
||||
for (const [label, executable] of [
|
||||
['Makelore executable', appExecutable],
|
||||
['OpenCode executable', opencodeExecutable],
|
||||
['Python executable', pythonExecutable],
|
||||
['uv executable', uvExecutable],
|
||||
]) {
|
||||
assertPeMachine(executable, PE_MACHINE_AMD64, label);
|
||||
}
|
||||
|
||||
const declaredOpencodeVersion = packageJson.devDependencies?.['opencode-ai']
|
||||
?? packageJson.dependencies?.['opencode-ai'];
|
||||
const packagedOpencode = JSON.parse(readFileSync(opencodePackagePath, 'utf8'));
|
||||
assertEqual(packagedOpencode.version, declaredOpencodeVersion, 'packaged OpenCode version');
|
||||
|
||||
const systemRoot = process.env.SystemRoot ?? process.env.WINDIR ?? 'C:\\Windows';
|
||||
const installLocalProbeEnv = {
|
||||
...process.env,
|
||||
PATH: [join(systemRoot, 'System32'), systemRoot].join(';'),
|
||||
};
|
||||
for (const key of ['NODE_PATH', 'BUN_INSTALL', 'OPENCODE_BIN', 'OPENCODE_PATH', 'NIANCODE_PYTHON_PATH', 'NIANCODE_UV_PATH']) {
|
||||
for (const key of ['NODE_PATH', 'BUN_INSTALL', 'NIANCODE_PYTHON_PATH', 'NIANCODE_UV_PATH']) {
|
||||
delete installLocalProbeEnv[key];
|
||||
}
|
||||
const opencodeVersion = run(opencodeExecutable, ['--version'], {
|
||||
cwd: opencodeRuntimeDir,
|
||||
env: installLocalProbeEnv,
|
||||
});
|
||||
assertEqual(opencodeVersion, declaredOpencodeVersion, 'OpenCode executable version');
|
||||
const uvVersion = run(uvExecutable, ['--version'], {
|
||||
cwd: toolsBinDir,
|
||||
env: installLocalProbeEnv,
|
||||
@@ -232,8 +216,6 @@ const appRequire = createRequire(join(dirname(process.execPath), 'resources', 'a
|
||||
const packagedPackage = appRequire('./package.json');
|
||||
const msgpackResolved = appRequire.resolve('msgpackr');
|
||||
const canvasResolved = appRequire.resolve('@napi-rs/canvas');
|
||||
const playwrightPackageResolved = appRequire.resolve('@playwright/mcp/package.json');
|
||||
const playwrightCliResolved = join(dirname(playwrightPackageResolved), 'cli.js');
|
||||
const { pack, unpack } = appRequire('msgpackr');
|
||||
const { createCanvas } = appRequire('@napi-rs/canvas');
|
||||
const packedValue = unpack(pack({ ok: true, text: '\u5362\u6b22' }));
|
||||
@@ -271,8 +253,6 @@ console.log('NIANCODE_ARTIFACT_PROBE=' + JSON.stringify({
|
||||
},
|
||||
msgpackResolved,
|
||||
canvasResolved,
|
||||
playwrightPackageResolved,
|
||||
playwrightCliResolved,
|
||||
nativeModules,
|
||||
packedValue,
|
||||
canvas: [canvas.width, canvas.height],
|
||||
@@ -316,12 +296,6 @@ if (!isPathInside(appAsarPath, probe.msgpackResolved)) {
|
||||
if (!isPathInside(appAsarPath, probe.canvasResolved)) {
|
||||
throw new Error(`@napi-rs/canvas was not resolved from app.asar: ${probe.canvasResolved}`);
|
||||
}
|
||||
if (!isPathInside(appAsarPath, probe.playwrightPackageResolved)) {
|
||||
throw new Error(`@playwright/mcp was not resolved from app.asar: ${probe.playwrightPackageResolved}`);
|
||||
}
|
||||
if (!isPathInside(appAsarPath, probe.playwrightCliResolved)) {
|
||||
throw new Error(`@playwright/mcp CLI was not resolved from app.asar: ${probe.playwrightCliResolved}`);
|
||||
}
|
||||
const packagedNpm = JSON.parse(readFileSync(npmPackagePath, 'utf8'));
|
||||
assertEqual(packagedNpm.version, packageJson.dependencies.npm, 'packaged npm version');
|
||||
const npmVersion = run(appExecutable, [npmCliPath, '--version'], {
|
||||
@@ -329,10 +303,6 @@ const npmVersion = run(appExecutable, [npmCliPath, '--version'], {
|
||||
env: { ...installLocalProbeEnv, ELECTRON_RUN_AS_NODE: '1' },
|
||||
});
|
||||
assertEqual(npmVersion, packageJson.dependencies.npm, 'packaged npm CLI version');
|
||||
run(appExecutable, [probe.playwrightCliResolved, '--help'], {
|
||||
cwd: dirname(appExecutable),
|
||||
env: { ...installLocalProbeEnv, ELECTRON_RUN_AS_NODE: '1' },
|
||||
});
|
||||
const msgpackNative = probe.nativeModules.find(({ modulePath, physicalPath, exists }) => (
|
||||
exists
|
||||
&& isPathInside(appAsarPath, modulePath)
|
||||
@@ -372,15 +342,6 @@ const evidence = {
|
||||
installerSha256,
|
||||
runtime: { electron: probe.electron, node: probe.node },
|
||||
installLocalRuntimes: {
|
||||
opencode: {
|
||||
executable: opencodeExecutable,
|
||||
version: opencodeVersion,
|
||||
sha256: await sha256(opencodeExecutable),
|
||||
},
|
||||
playwrightMcp: {
|
||||
packageJson: probe.playwrightPackageResolved,
|
||||
cli: probe.playwrightCliResolved,
|
||||
},
|
||||
python: pythonProbe,
|
||||
uv: { executable: uvExecutable, version: uvVersion },
|
||||
npm: { packageJson: npmPackagePath, cli: npmCliPath, version: npmVersion },
|
||||
|
||||
Reference in New Issue
Block a user