Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
host: one Python resolver for every spawn (env, repo venv, py -3, python.exe on Windows; python3 elsewhere)
Niko12211ee7c7337de9
diff --git a/apps/host/server/index.mjs b/apps/host/server/index.mjsindex 09695db4e..3a3b41170 100644--- a/apps/host/server/index.mjs+++ b/apps/host/server/index.mjs@@ -3,6 +3,7 @@ import { createCloudflare } from './cloudflare.mjs';import { createConnectorInstaller } from './cloudflared-install.mjs';import { openArtifact } from './artifacts.mjs';import { saveSnapshot } from './snapshot.mjs';+import { resolvePython, shellPrefix } from './python-resolver.mjs';import { chooseFolder, typedFolder, TYPE_A_PATH } from './folder-dialog.mjs';import { createLocalShare } from './local-share.mjs';import { createTaskService, validateTask } from './tasks.mjs';@@ -548,14 +549,15 @@ async function runTurn({ message, history = [], onFrame, signal, client, workspaconst REPO_ROOT = resolve(HERE, '..', '..', '..');// The interpreter that drives the job is the same one the launcher would pick, named explicitly so// a packaged run uses the runtime the bundle carries rather than whatever `python3` resolves to.-const TS_PYTHON = process.env.STRATA_PYTHON || 'python3';+const PYTHON = resolvePython({ repo: REPO_ROOT });+const TS_PYTHON = PYTHON.command;const REVISE_SCRIPT = resolve(REPO_ROOT, 'integrations', 'harness', 'revise_once.py');// A revision attempt is an agent turn, performed by the Harness through the pinned integration// script — which is a *Python* program, so it is invoked with the interpreter, not with Node.// This is a configured path, never a value an HTTP caller supplies: accepting one would hand a// remote caller command execution on the user's machine.const TIMESKIP_REVISE = process.env.STRATA_TIMESKIP_REVISE- ?? `"${TS_PYTHON}" "${REVISE_SCRIPT}"`;+ ?? `${shellPrefix(PYTHON)} "${REVISE_SCRIPT}"`;/*** Tuning, from the App Host.*@@ -570,15 +572,15 @@ const TIMESKIP_REVISE = process.env.STRATA_TIMESKIP_REVISE* the engine with each candidate, and inventing measurements is exactly what the handoff forbids.* The plan and the report are real; the sweep is gated on that harness.*/-function createTuning({ repoRoot, python, env = process.env } = {}) {+function createTuning({ repoRoot, python, pythonArgs = [], env = process.env } = {}) {const cli = join(repoRoot, 'strata.py');const stateDir = () => env.STRATA_TUNE_DIR|| join(env.XDG_STATE_HOME || join(env.HOME || '.', '.local', 'state'), 'strata', 'tuning');function runCli(args) {return new Promise((resolve) => {- const child = spawn(python, [cli, ...args, '--output', 'json'], {- cwd: repoRoot, env: { ...env, STRATA_TUNE_DIR: stateDir() },+ const child = spawn(python, [...pythonArgs, cli, ...args, '--output', 'json'], {+ cwd: repoRoot, windowsHide: true, env: { ...env, STRATA_TUNE_DIR: stateDir() },stdio: ['ignore', 'pipe', 'pipe'],});let out = '', err = '';@@ -639,11 +641,12 @@ function createTuning({ repoRoot, python, env = process.env } = {}) {};}-const tuning = createTuning({ repoRoot: REPO_ROOT, python: TS_PYTHON });+const tuning = createTuning({ repoRoot: REPO_ROOT, python: TS_PYTHON, pythonArgs: PYTHON.args });const timeskip = createTimeSkip({repoRoot: REPO_ROOT,python: TS_PYTHON,+ pythonArgs: PYTHON.args,env: { ...process.env, STRATA_TIMESKIP_DIR: process.env.STRATA_TIMESKIP_DIR ?? '' },});diff --git a/apps/host/server/native-control.mjs b/apps/host/server/native-control.mjsindex 701db83cf..b1324424e 100644--- a/apps/host/server/native-control.mjs+++ b/apps/host/server/native-control.mjs@@ -7,6 +7,7 @@ import { fileURLToPath } from 'node:url';import { createServer } from 'node:net';import { NATIVE_FIELDS, validateNativeSettings, validateMcpServers, publicMcpServers, publicNativeEnv, restoreNativeEnv } from './native-settings.mjs';import { resourceSettings } from './native-resources.mjs';+import { resolvePython, venvPython } from './python-resolver.mjs';import { runtimeVision } from './native-vision.mjs';const ROOT=resolve(dirname(fileURLToPath(import.meta.url)),'..');@@ -30,13 +31,13 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},spfunction nativeFields(){const source=sourceText();return NATIVE_FIELDS.map(field=>({...field,supported:field.id.startsWith('vision_')||field.id.startsWith('mcp_')||field.id==='vram_reserve_mib'||source.includes(field.id)}));}function installedInfo(info){if(!info)return info;return {...info,models:(info.models??[]).map(entry=>{const cfg=/^strata-[a-z0-9_-]+\.json$/i.test(entry.config??'')?readJson(join(repo(),entry.config)):{};const at=cfg.args?.indexOf('--native')??-1,nativeFile=at>=0?cfg.args[at+1]:null;const dataFolder=typeof nativeFile==='string'&&basename(dirname(dirname(nativeFile)))==='models'?dirname(dirname(dirname(nativeFile))):info.data_folder;return {...entry,dataFolder,visionEnabled:cfg.ui_vision_enabled??[...instances.values()].some(i=>i.model===entry.model&&i.status==='ready'&&i.vision),visionDevice:cfg.ui_vision_device,resourceProfile:cfg.ui_resource_profile,lowRamMode:cfg.args?.includes('--resident-experts')?'resident':cfg.args?.includes('--mmap-experts')?'mmap':'auto'};})};}function repo(){const path=realpathSync(preferences.repo);if(!existsSync(join(path,'setup.py'))||!existsSync(join(path,'tools/strata_mcp.py'))||!existsSync(join(path,'serve/server.py')))throw new Error('Choose the Strata repository folder containing setup.py and tools/strata_mcp.py.');return path;}- function python(){const choices=[process.env.STRATA_NATIVE_PYTHON,join(preferences.repo,'.venv',process.platform==='win32'?'Scripts/python.exe':'bin/python'),'/opt/homebrew/bin/python3.11','/opt/homebrew/bin/python3.10'];return choices.find(p=>p&&existsSync(p))??(process.platform==='win32'?'python':'python3');}+ function python(){return resolvePython({repo:preferences.repo});}function send(method,params,timeout=30000){return new Promise((resolve,reject)=>{const id=++seq;const alarm=setTimeout(()=>{pending.delete(id);reject(new Error('The native engine did not respond in time. Check engine logs.'));},timeout);pending.set(id,{resolve,reject,alarm});child.stdin.write(JSON.stringify({jsonrpc:'2.0',id,method,params})+'\n');});}function disconnect(){child?.kill();child=null;definitions=[];for(const p of pending.values()){clearTimeout(p.alarm);p.reject(new Error('Native control connection closed.'));}pending.clear();}async function connect(){if(closing)throw new Error("The host is shutting down.");if(child&&definitions.length)return;if(!connecting)connecting=startClient().finally(()=>{connecting=null;});return connecting;}async function startClient(){const folder=repo();- buffer='';const client=child=spawnProcess(python(),[join(folder,'tools/strata_mcp.py')],{cwd:folder,stdio:['pipe','pipe','pipe'],env:{...process.env,PYTHONUNBUFFERED:'1',PYTHONIOENCODING:'utf-8'}});+ buffer='';const py0=python();const client=child=spawnProcess(py0.command,[...py0.args,join(folder,'tools/strata_mcp.py')],{cwd:folder,windowsHide:true,stdio:['pipe','pipe','pipe'],env:{...process.env,PYTHONUNBUFFERED:'1',PYTHONIOENCODING:'utf-8'}});client.stdout.on('data',chunk=>{if(child!==client)return;buffer+=chunk.toString();let end;while((end=buffer.indexOf('\n'))>=0){const line=buffer.slice(0,end);buffer=buffer.slice(end+1);let message;try{message=JSON.parse(line);}catch{continue;}const p=pending.get(message.id);if(p){clearTimeout(p.alarm);pending.delete(message.id);message.error?p.reject(new Error(message.error.message)):p.resolve(message.result);}}});child.stderr.on('data',chunk=>append('control',chunk.toString()));client.on('error',error=>{if(child===client){snapshot.error=error.message;disconnect();}});@@ -86,7 +87,7 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},spcfg.aliases=[...new Set([...(Array.isArray(cfg.aliases)?cfg.aliases:typeof cfg.aliases==='string'?cfg.aliases.split(',').map(s=>s.trim()).filter(Boolean):[]),apiModelId])];const key=randomBytes(32).toString('hex');cfg.api_key=key;cfg.port=await freePort(args.port);const work=join(directory,'native-instances');mkdirSync(work,{recursive:true});const configPath=join(work,`${id}.json`);- const py=join(repo(),'.venv',process.platform==='win32'?'Scripts/python.exe':'bin/python');if(!existsSync(py))throw new Error('The Strata Python environment is missing. Use Download / repair first.');+ const py=venvPython(repo());if(!existsSync(py))throw new Error('The Strata Python environment is missing. Use Download / repair first.');if(job.state!=='running')return;await beforeLoad();if(job.state!=='running')return;if(!args.multiple){if(busy(requests().filter(r=>instances.has(r.instanceId))))throw new Error('Finish or cancel native requests before switching models.');for(const id of [...instances.keys()])await unload(id);}else if(matching)await unload(matching.id);@@ -110,13 +111,13 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},spfunction ensurePoll(){if(!timer){timer=setInterval(()=>void poll(),2000);timer.unref?.();}void poll();}async function benchmark(job,args){const instance=resolveInstance(args.instanceId);job.instanceId=instance.id;if(busy(requests().filter(r=>r.instanceId===instance.id)))throw new Error('Wait for this model to finish before benchmarking.');const started=Date.now();job.abort=new AbortController();const response=await fetcher(`http://127.0.0.1:${instance.port}/v1/chat/completions`,{method:'POST',headers:{'content-type':'application/json',authorization:`Bearer ${instance.key}`},signal:AbortSignal.any([job.abort.signal,AbortSignal.timeout(180000)]),body:JSON.stringify({model:instance.apiModelId,messages:[{role:'user',content:'Explain how a rainbow forms in clear, simple language.'}],temperature:0,reasoning_effort:'none',max_tokens:200,stream:false})});const body=await response.json();if(!response.ok)throw new Error(body.error?.message??'Benchmark failed.');if(job.state!=='running')return;const result={summary:'Measured benchmark complete.',at:new Date().toISOString(),model:instance.apiModelId,durationMs:Date.now()-started,tokensIn:body.usage?.prompt_tokens??null,tokensOut:body.usage?.completion_tokens??null,outputTps:body.timings?.predicted_per_second??null,promptTps:body.timings?.prompt_per_second??null,source:'engine',settings:'Greedy · thinking off · up to 200 output tokens'};writeFileSync(join(directory,'native-benchmark.json'),JSON.stringify(result,null,2),{mode:0o600});return result;}function resolveInstance(id){const aliases=[...instances.values()].filter(i=>i.aliases?.includes(id));if(aliases.length>1&&!instances.has(id)&&![...instances.values()].some(i=>i.apiModelId===id))throw new Error('This alias matches more than one instance. Choose its exact model ID.');const i=instances.get(id)??[...instances.values()].find(i=>i.apiModelId===id)??aliases[0]??(!id&&instances.size===1?[...instances.values()][0]:undefined);if(!i)throw new Error('Choose a loaded model ID.');if(i.status!=='ready')throw new Error('This model is not ready.');return i;}- async function program(job,args){if(externalRunning().length)throw new Error('Stop the native server running outside this UI before changing engine files.');if(instances.size)throw new Error('Unload native models before changing engine files.');const folder=repo();let command=python(),argv;- if(job.kind==='calibrate'||job.kind==='tune'){if(!state().capabilities.calibration)throw new Error('This installation calibrates NVIDIA GPUs only. Use the short benchmark on other devices.');const model=args.model??snapshot.installed?.models?.[0]?.model;const chosen=record(model);if(!chosen.entry.ready)throw new Error('Prepare this model before calibrating.');command=join(folder,'.venv',process.platform==='win32'?'Scripts/python.exe':'bin/python');if(!existsSync(command))throw new Error('Prepare the Python environment first.');argv=['-c','import sys; from pathlib import Path; import setup; sys.exit(0 if setup.calibrate_config(Path(sys.argv[1])) else 1)',chosen.path];}+ async function program(job,args){if(externalRunning().length)throw new Error('Stop the native server running outside this UI before changing engine files.');if(instances.size)throw new Error('Unload native models before changing engine files.');const folder=repo();let {command,args:prefix}=python(),argv;+ if(job.kind==='calibrate'||job.kind==='tune'){if(!state().capabilities.calibration)throw new Error('This installation calibrates NVIDIA GPUs only. Use the short benchmark on other devices.');const model=args.model??snapshot.installed?.models?.[0]?.model;const chosen=record(model);if(!chosen.entry.ready)throw new Error('Prepare this model before calibrating.');command=venvPython(folder);prefix=[];if(!existsSync(command))throw new Error('Prepare the Python environment first.');argv=['-c','import sys; from pathlib import Path; import setup; sys.exit(0 if setup.calibrate_config(Path(sys.argv[1])) else 1)',chosen.path];}else if(job.kind==='rollback'){if(!previousEngine())throw new Error('No saved previous engine is available.');argv=[join(folder,'setup.py'),'--rollback-engine'];}else if(job.kind==='update-engine'){if(!snapshot.installed?.models?.length)throw new Error('Prepare a model first. Its installer downloads the matching engine.');argv=[join(folder,'setup.py'),'--update'];}else if(job.kind==='update-strata'){const status=await execute('git',['status','--porcelain'],folder);if(status.trim())throw new Error('This Strata checkout has local edits. Save or commit them before updating.');const remote=await execute('git',['remote','get-url','origin'],folder);if(!/^https:\/\/github\.com\/Niko1221\/Strata(?:\.git)?\s*$/.test(remote))throw new Error('The native installation must use the official Strata repository to update here.');await execute('git',['pull','--ff-only'],folder);argv=[join(folder,'setup.py'),'--update'];}else throw new Error('Unsupported native operation.');- return new Promise((resolve,reject)=>{const proc=spawnProcess(command,argv,{cwd:folder,detached:process.platform!=='win32',stdio:['ignore','pipe','pipe'],env:{...process.env,PYTHONUNBUFFERED:'1'}});job.process=proc;for(const stream of [proc.stdout,proc.stderr])stream.on('data',chunk=>{chunk.toString().split('\n').filter(Boolean).forEach(line=>append(job.id,line));job.summary=chunk.toString().trim().slice(-500);emit();});proc.on('error',reject);proc.on('exit',code=>{delete job.process;code===0?resolve({summary:job.kind==='calibrate'?'Calibration complete. Native settings were saved.':'Native installation updated.'}):reject(new Error(`Operation stopped (exit ${code}). Open diagnostics for details.`));});});+ return new Promise((resolve,reject)=>{const proc=spawnProcess(command,[...prefix,...argv],{cwd:folder,windowsHide:true,detached:process.platform!=='win32',stdio:['ignore','pipe','pipe'],env:{...process.env,PYTHONUNBUFFERED:'1'}});job.process=proc;for(const stream of [proc.stdout,proc.stderr])stream.on('data',chunk=>{chunk.toString().split('\n').filter(Boolean).forEach(line=>append(job.id,line));job.summary=chunk.toString().trim().slice(-500);emit();});proc.on('error',reject);proc.on('exit',code=>{delete job.process;code===0?resolve({summary:job.kind==='calibrate'?'Calibration complete. Native settings were saved.':'Native installation updated.'}):reject(new Error(`Operation stopped (exit ${code}). Open diagnostics for details.`));});});}function execute(cmd,args,cwd){return new Promise((resolve,reject)=>{let output='';const process=spawnProcess(cmd,args,{cwd,stdio:['ignore','pipe','pipe']});process.stdout.on('data',c=>{output+=c;if(output.length>100000)process.kill();});process.stderr.on('data',c=>append('update',c.toString()));process.on('error',reject);process.on('exit',code=>code===0?resolve(output):reject(new Error('Git could not update this installation. Open diagnostics.')));});}function writeModelConfig(path,next){copyFileSync(path,path+'.bak');chmodSync(path+'.bak',0o600);const temp=path+'.ui-tmp';writeFileSync(temp,JSON.stringify(next,null,2)+'\n',{mode:0o600});renameSync(temp,path);}diff --git a/apps/host/server/python-resolver.mjs b/apps/host/server/python-resolver.mjsnew file mode 100644index 000000000..d2a3cbc5f--- /dev/null+++ b/apps/host/server/python-resolver.mjs@@ -0,0 +1,59 @@+/**+ * The one place the App Host decides which Python to run. Every spawn of Python goes through it+ * (tuning, Time-skip, the revise command, the native MCP client, setup/calibration jobs, the native server).+ *+ * Order:+ * 1. STRATA_PYTHON, then STRATA_NATIVE_PYTHON (an explicit choice is never second-guessed)+ * 2. the repository's own venv: .venv\Scripts\python.exe on Windows, .venv/bin/python elsewhere+ * 3. Windows: `py -3` (the launcher), then python.exe; each one must actually start+ * (the Microsoft Store alias in WindowsApps exists on PATH but only opens the Store)+ * POSIX: Homebrew 3.11 / 3.10, then python3, then python+ * It returns { command, args } so `py -3` can be spawned as spawn(command, [...args, script]).+ */+import { existsSync } from 'node:fs';+import { spawnSync } from 'node:child_process';+import { join } from 'node:path';++export function venvPython(repo, platform = process.platform) {+ return join(repo, '.venv', platform === 'win32' ? 'Scripts' : 'bin', platform === 'win32' ? 'python.exe' : 'python');+}++/** Does this interpreter start? A bare name is looked up on PATH by the spawn itself. */+export function pythonStarts(command, args = []) {+ try {+ const result = spawnSync(command, [...args, '-c', 'import sys'], { timeout: 15000, windowsHide: true, stdio: 'ignore' });+ return !result.error && result.status === 0;+ } catch { return false; }+}++const cache = new Map();++export function resolvePython({ repo = null, env = process.env, platform = process.platform, exists = existsSync, starts = pythonStarts, useCache = true } = {}) {+ const key = JSON.stringify([repo, env.STRATA_PYTHON, env.STRATA_NATIVE_PYTHON, platform]);+ if (useCache && cache.has(key)) return cache.get(key);+ const found = (() => {+ const explicit = env.STRATA_PYTHON || env.STRATA_NATIVE_PYTHON;+ if (explicit) return { command: explicit, args: [], source: 'environment' };+ if (repo) {+ const venv = venvPython(repo, platform);+ if (exists(venv)) return { command: venv, args: [], source: 'venv' };+ }+ if (platform === 'win32') {+ if (starts('py', ['-3'])) return { command: 'py', args: ['-3'], source: 'py launcher' };+ if (starts('python.exe')) return { command: 'python.exe', args: [], source: 'PATH' };+ return { command: 'python.exe', args: [], source: 'fallback' };+ }+ for (const brew of ['/opt/homebrew/bin/python3.11', '/opt/homebrew/bin/python3.10']) {+ if (exists(brew)) return { command: brew, args: [], source: 'homebrew' };+ }+ return { command: 'python3', args: [], source: 'PATH' };+ })();+ // A failed lookup (the fallback) is not cached: the person may install Python and retry.+ if (useCache && found.source !== 'fallback') cache.set(key, found);+ return found;+}++/** A shell-ready command prefix such as `"py" -3`, for the few places that run a command string. */+export function shellPrefix(python) {+ return [`"${python.command}"`, ...python.args].join(' ');+}diff --git a/apps/host/server/timeskip.mjs b/apps/host/server/timeskip.mjsindex 99e154fcf..f156df238 100644--- a/apps/host/server/timeskip.mjs+++ b/apps/host/server/timeskip.mjs@@ -95,14 +95,15 @@ function summarise(run) {* attempt is an agent turn), so the default bound is generous, and exceeding it is reported as a* timeout rather than as success.*/-export function createTimeSkip({ repoRoot, python, timeoutMs = 30 * 60 * 1000, env = process.env } = {}) {+export function createTimeSkip({ repoRoot, python, pythonArgs = [], timeoutMs = 30 * 60 * 1000, env = process.env } = {}) {const cli = join(repoRoot, 'strata.py');function runCli(args, { signal } = {}) {return new Promise((resolve) => {const root = stateDir(env);- const child = spawn(python, [cli, ...args, '--output', 'json'], {+ const child = spawn(python, [...pythonArgs, cli, ...args, '--output', 'json'], {cwd: repoRoot,+ windowsHide: true,env: { ...env, STRATA_TIMESKIP_DIR: root },stdio: ['ignore', 'pipe', 'pipe'],});diff --git a/apps/host/tests/python-resolver.test.mjs b/apps/host/tests/python-resolver.test.mjsnew file mode 100644index 000000000..f9dbfb628--- /dev/null+++ b/apps/host/tests/python-resolver.test.mjs@@ -0,0 +1,62 @@+import test from 'node:test';+import assert from 'node:assert/strict';+import { readFileSync, readdirSync } from 'node:fs';+import { join, resolve } from 'node:path';+import { fileURLToPath } from 'node:url';+import { resolvePython, shellPrefix, venvPython } from '../server/python-resolver.mjs';++const none = () => false;+const pick = (options) => resolvePython({ useCache: false, env: {}, exists: none, starts: none, ...options });++test('an explicit STRATA_PYTHON wins over everything', () => {+ assert.deepEqual(pick({ platform: 'win32', repo: 'C:\\r', env: { STRATA_PYTHON: 'D:\\py\\python.exe' }, exists: () => true }),+ { command: 'D:\\py\\python.exe', args: [], source: 'environment' });+ assert.equal(pick({ platform: 'linux', env: { STRATA_NATIVE_PYTHON: '/opt/py' } }).command, '/opt/py');+});++test('the repository venv is used with the platform layout', () => {+ assert.match(venvPython('C:\\repo', 'win32'), /Scripts[\\/]python\.exe$/);+ assert.match(venvPython('/repo', 'linux'), /bin[\\/]python$/);+ const seen = [];+ const found = pick({ platform: 'win32', repo: 'C:\\repo', exists: (p) => { seen.push(p); return /Scripts[\\/]python\.exe$/.test(p); } });+ assert.equal(found.source, 'venv');+ assert.match(found.command, /Scripts[\\/]python\.exe$/);+ assert.ok(seen.length >= 1);+});++test('Windows falls back to py -3, then python.exe, and skips an interpreter that does not start', () => {+ const tried = [];+ const starts = (command, args = []) => { tried.push([command, ...args].join(' ')); return command === 'py'; };+ assert.deepEqual(pick({ platform: 'win32', starts }), { command: 'py', args: ['-3'], source: 'py launcher' });+ const second = pick({ platform: 'win32', starts: (command) => command === 'python.exe' });+ assert.deepEqual(second, { command: 'python.exe', args: [], source: 'PATH' });+ // the Microsoft Store alias exists on PATH but fails to start: nothing works, so the plain name is returned for a clear error+ assert.equal(pick({ platform: 'win32' }).command, 'python.exe');+ assert.equal(pick({ platform: 'win32' }).source, 'fallback');+});++test('POSIX keeps Homebrew first, then python3', () => {+ assert.equal(pick({ platform: 'darwin', exists: (p) => p.endsWith('python3.11') }).command, '/opt/homebrew/bin/python3.11');+ assert.deepEqual(pick({ platform: 'linux' }), { command: 'python3', args: [], source: 'PATH' });+});++test('the shell prefix keeps the launcher arguments', () => {+ assert.equal(shellPrefix({ command: 'py', args: ['-3'] }), '"py" -3');+ assert.equal(shellPrefix({ command: 'python3', args: [] }), '"python3"');+});++test('the real resolver finds a Python that starts on this machine', () => {+ const found = resolvePython({ useCache: false, env: {} });+ const { spawnSync } = process.getBuiltinModule('node:child_process');+ const run = spawnSync(found.command, [...found.args, '-c', 'import sys; print(sys.version_info[0])'], { encoding: 'utf8', windowsHide: true });+ assert.equal(run.stdout.trim(), '3');+});++test('no server module spawns a bare python3 any more', () => {+ const dir = resolve(fileURLToPath(new URL('../server', import.meta.url)));+ for (const name of readdirSync(dir).filter((n) => /\.(mjs|cjs)$/.test(n))) {+ const text = readFileSync(join(dir, name), 'utf8');+ assert.doesNotMatch(text, /spawn\w*\(\s*['"]python3?['"]/, `${name} spawns python directly`);+ if (name !== 'python-resolver.mjs') assert.doesNotMatch(text, /\|\|\s*'python3'/, `${name} defaults to python3`);+ }+});